- Find out the keycode of the key that you want remapped.
Execute the showkey command as root in a virtual consolde:$ showkey
kb mode was UNICODE
press any key (program terminates after 10s of last keypress)...
0x9c
Hit the Caps Lock key, wait 10 seconds (default timeout), and the showkey command will exit on its own.$ showkey
kb mode was UNICODE
press any key (program terminates after 10s of last keypress)...
0x9c
0x3a
0xba
The keycode for the Caps Lock key is 0x3a in hex, or 58 in decimal. - Find out the symbolic name (key symbol) of the key that you want to map to.
You can list all the supported symbolic names by dumpkeys -l and grep for esc:$ dumpkeys -l |grep -i esc
0x001b Escape
0x081b Meta_Escape - Remap the keycode 58 to the Escape key symbol.
$ (echo `dumpkeys |grep -i keymaps`; \
echo keycode 58 = Escape) \
| loadkeys -
Thanks to cjwatson who pointed me to prepending the keymaps statement from dumpkeys. The keymaps statement is a shorthand notation defining what key modifiers you are defining with the key. See man keymaps(5) for more info.
To make the new key mapping permanent, you need to put the loadkeys command in a bootup script.
For my Debian Etch system, I put the
(echo `dumpkeys |grep -i keymaps`; echo keycode 58 = Escape) |loadkeys - command in /etc/rc.local.
0 comments:
Post a Comment