system:input:xmodmap
Table of Contents
Xmodmap
xmodmap
is a very useful tool to modify Xorg's keyboard key mappings.
Sample usage scenarios include:
- fixing strange keyboards not fully supported by the predefined maps
- configuring swapcaps and the like
- adding special keys and dead-keys using the Mode_switch key
Use xev
to find out the keycode for any key. The list of keysym names can
be found in <X11/keysymdef.h>.
Write the samples below into ~/.Xmodmap (traditionally) and have it
applied by xmodmap
on WM startup using this in it's init file (or
~/.xinitrc or so):
xmodmap ~/.Xmodmap
(Sometimes this is automatically done by the WM.)
swap caps (with ctrl-r or ctrl-l)
This is for ctrl-r (my favourite, since I seldomly use caps lock, but sometimes want ctrl-l as ctrl key), for ctrl-l just replace Control_R with Control_L:
remove Lock = Caps_Lock remove Control = Control_R keysym Control_R = Caps_Lock keysym Caps_Lock = Control_R add Lock = Caps_Lock add Control = Control_R
Beware: this really does a swap, so if run again things will swap back.
Utilising Mode_switch
! define Alt_R to be Mode_switch ! (and Alt_R when typed with shift pressed): keycode 113 = Mode_switch Alt_R ! now define fancy stuff for keys with Mode_switch pressed ! syntax is: keycode <num> = <regular> <shifted> <mode_switch> <shifted mode_switch> keycode 10 = 1 exclam onesuperior keycode 11 = 2 at twosuperior keycode 12 = 3 numbersign threesuperior keycode 13 = 4 dollar foursuperior keycode 14 = 5 percent fivesuperior keycode 15 = 6 asciicircum sixsuperior dead_circumflex keycode 16 = 7 ampersand sevensuperior keycode 17 = 8 asterisk eightsuperior keycode 18 = 9 parenleft ninesuperior keycode 19 = 0 parenright zerosuperior keycode 24 = q Q degree keycode 26 = e E EuroSign keycode 30 = u U udiaeresis Udiaeresis keycode 31 = i I idiaeresis Idiaeresis keycode 32 = o O odiaeresis Odiaeresis keycode 38 = a A adiaeresis Adiaeresis keycode 39 = s S ssharp keycode 47 = semicolon colon dead_diaeresis dead_diaeresis keycode 48 = apostrophe quotedbl dead_acute dead_doubleacute keycode 49 = grave asciitilde dead_grave dead_tilde dead_caron keycode 54 = c C cent keycode 59 = , < dead_ogonek keycode 60 = period greater dead_diaeresis
system/input/xmodmap.txt · Last modified: 2012/04/22 20:38 by 127.0.0.1