I have finally succeeded in my quest, to get XKB to easily set up the keyboard in an arbitrary fashion, not limited to the options presented in the rules database, using the system database for everything I'm not explicitly overriding, without needing to edit any system files or have any special privileges!
This should allow me to map CapsLock to Super (or Esc, or something else, I'm still playing) on any computer I have an account on.
- Make an xkb symbols file with the new symbols you want. Pattern after the stuff in /usr/share/X11/xkb/symbols/. Mine is called
capslock
and looks like this (there's actually more in there, but it's not relevant):// use the capslock key as a(nother) Super key partial modifier_keys xkb_symbols "super" { key
{ symbols[Group1]= [ Super_L ] }; }; - Put it in a directory called
symbols
, and put that somewhere useful. I recommend$HOME/.xkb/symbols
- Make a keymap
.xkb
file and put it somewhere useful (probably in$HOME/.xkb/keymap/my_keyboard.xkb
or something. It should look something like:xkb_keymap { xkb_keycodes { include "xfree86+aliases(qwerty)" }; xkb_types { include "complete" }; xkb_compat { include "complete" }; xkb_symbols { include "pc+us(altgr-intl)+level3(ralt_alt)+level3(menu_switch)+capslock(super)" }; xkb_geometry { include "pc(pc105)" }; };
Notice the
+capslock(super)
part; that's what's calling the new symbols. You can generate a file for the stock options you like by callingsetxkbmap -print [options]
. - Add the following to a file which will be consistently called when X starts under your username. Mine is in
.xprofile
, which is also sourced from.xinitrc
.# Set up the keyboard the way we like it xkbcomp -I$HOME/.xkb $HOME/.xkb/keymap/my_keyboard.xkb $DISPLAY