Show the current config with
setxkbmap -query or
setxkbmap -print -verbose 10.
Look at the available options:
cat /usr/share/X11/xkb/rules/evdev.lst |less. Here are some I find useful:
ctrl:nocaps Caps Lock as Ctrl ctrl:lctrl_meta Left Ctrl as Meta shift:both_capslock Both Shift keys together toggle Caps Lock
caps:hyper Caps Lock as Hyper_L
altwin:swap_alt_win Alt is swapped with Win
Invoke options like:
setxkbmap -model pc105 -layout us -option \ -option ctrl:nocaps -option ctrl:lctrl_meta -option shift:both_capslock
-option argument resets things, so we start from a clean slate.)
There are some things
setxkbmap can't do with simple options. For those things, create
Apply the custom keymap with: xkbcomp -I$HOME/.xkb ~/.xkb/keymap/mykeymap $DISPLAY.
Also see the man pages for
N.B. I've found xkb to be a little flaky. For example, if I set keyboard options in my .xsession with xsetkbmap, those options get reset to defaults in the keyboard is unplugged/plugged. As an alternative, system-wide defaults can be set in
xmodmap maps the KeyCodes of physical keys on your keyboard to what KeySym value get sent when you press that key.
Determine what key is what by running
xev from a terminal. It will show you the keycode for any key you press.
xmodmap -pk may also be useful; it prints the current key mappings. (Using
xmodmap -pke gives the same information as a list of commands that can be fed back to
xmodmap -e 'keycode 47 = semicolon colon semicolon colon'.)
Print the keycodes and keysym values for modifier keys like Caps Lock, Alt, and Control with
xmodmap -pm. Changing modifier keys is slightly different from changing other keys, using clear, remove, and add.
Once you know what you want to do with
xmodmap, either save your
xmodmap commands to the beginning of your
.xsession file if you only have one or two changes, or keep your entire key mapping in its own file by adding this to your
if [ -s ~/.Xmodmap ]; then xmodmap ~/.Xmodmap fi
xmodmap create a
.Xmodmap file b:verbose set buftypeased on your current settings:
xmodmap -pke > ~/.Xmodmap
© Paul Gorman