My brain-dump of random code/configuration.

16 Oct 2013

Permanent Remap Keys in X11

Because my shift key got broken, I remapped Caps Lock to Shift using xmodmap:

remove Lock = Caps_Lock
keysym Caps_Lock = Shift_L
add Shift = Shift_L

However these settings got sometimes lost. (ex: after the driver was reloaded after suspend). Finally I found event_key_remap patch from here, which allows to permanently redefine keys in the xorg.conf.

To apply the patch under archlinux simply install xf86-input-evdev-remap from AUR:

yaourt -S xf86-input-evdev-remap

To track down the key, you want to remap use xev on the terminal. Just type the wanted keys a few times. The output will be something like the following:

KeyRelease event,  serial 33,  synthetic NO,  window 0x1e00001,
    root 0x8e,  subw 0x0,  time 5672767,  (611, 262),  root:(613, 288),
    state 0x1,  keycode 50 (keysym 0xffe1,  Shift_L),  same_screen YES
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

The interesting value here is the keycode. Use this code to build your final xorg.conf. In my case this was:

Section "InputClass"
    Identifier             "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option                 "XkbLayout" "de"          # Replace this with your layout
    Option                 "event_key_remap" "58=50" # Caps Lock Key = Shift
comments powered by Disqus