/usr/share/X11/xkb/rules/evdev
contains a specification of rules. Rules tell XKB how to build keymaps from part, they don't specify a particular keymap. The input of xkbcomp
needs to be a keymap.
The easiest way to figure out what the input should be is to
read the man page (haha no)
read the official documentation (as if)
read the misleadingly named Unreliable guide (which is so good it's linked on the semi-official X.org wiki, but while it does have the information it's not actually stated that this is the input for xkbcomp
)
errr, ask on the Internet? Oh, you just did that.
Well, xkbcomp
works both ways. So if you just ask it to decompile the keymap from your display, you'll see some acceptable input.
xkbcomp :0 - | less
The syntax is:
xkb_keymap {
xkb_keycodes { … };
xkb_types { … };
xkb_compat { … };
xkb_symbols { … };
xkb_geometry { … };
}
The content of the braces after xkb_xxx
are things that go into files in the directories /usr/share/X11/xkb/xxx
. You can use an include
statement to tell xkbcomp
to read existing files. Note that you need a single include
directive with +
between file names. Some files contain multiple xkb_xxx
directives, pass the name of the one you want in parentheses. For example, to use the US layout with Compose
on Menu, use
xkb_symbols { include "us+compose(menu)" }
You can ask setxkbmap
to produce acceptable input for xkbcomp
. Pass the -print
option to see the output rather than push the keymap to the server. With setxkbmap
, pass -compat
, -geometry
, -keycodes
and -types
to set the corresponding xkb_xxx
, and -layout
for xkb_symbols
.
setxkbmap -layout "us+compose(menu)" -print
Actually, I lied by omission above, there's an easier way: the information is on the Arch wiki. If you like understanding how to configure your system, the Arch wiki is an excellent resource, whether you're using Arch Linux or not.