This program (xkbgen) takes a .kb file (described below) and translates it to an XKB
keyboard; I use it to simplify editing my keyboard layout.
For examples see ae.kb, and aegreek.kb, my normal and Ancient Greek keyboard layouts, respectively.
For information on how to ‘install’ a custom keyboard layout on linux, see here
KB files are text files that consist of a series of records. Each record has the form:
# this is a comment
key = [ a b c d "comma" '"' ... ]The keys are symbolic XKB names (e.g. <TLDE>); if you’re unsure what name a key
on your keyboard has, run xev | grep keycode and press the key whose name you
want to know, e.g. the 1 key. The output will be something like this:
state 0x10, keycode 10 (keysym 0x31, 1), same_screen YESThis means that the keycode that corresponds to the 1 key is 10; armed with this
knowledge, open /usr/share/X11/xkb/keycodes/evdev, where you’ll see something like
this:
<TLDE> = 49;
<AE01> = 10;
<AE02> = 11;
<AE03> = 12;
<AE04> = 13;
<AE05> = 14;
...This tells us that the name corresponding to the key with keycode 10 (i.e. the 1
key) is <AE01>, which means that we can assign characters to it as follows:
<AE01> = [ 1 ! ¡ ₁ ]This repository also includes a keyboard layout previewer (xkbdisplay), which—unlike
all other previewers (that I know of)—can display keyboard layouts with up to 8 layers.