Linux Tools to Remap Keys and Mouse Buttons
From Free Knowledge Base- The DUCK Project: information for everyone
Various facilities available:
- xbindKeys - a program that grab keys and mouse button events in X and starts associated shell command. This is to make a key press do something, such as start a program.
- xbindkeys-config - a graphical front-end to xbindkeys.
- xmodmap - a program which remaps keys to various functions. xmodmap is a utility for modifying keymaps and pointer button mappings in Xorg. Use this to make a key press act as another key press. As of 2013, Ubuntu and derivatives no longer use xmodmap, but instead use xkb.
- xfce4-keyboard-settings - a graphical front-end in Xfce with an "Applications Shortcut" facility for mapping keys to various functions similar to xbindkeys-config, but not using xbindKeys.
- xinput - a utility to list available input devices, query information about a device and change input device settings.
- xkb - The Xorg XKB replaces xmodmap and more. It is new.
xkb
The X KeyBoard extension, otherwise known as xkb, is does the mapping of physical keys to their proper function. The kernel manages console keyboard input, and in X it's managed by xkb, X Keyboard. xkb controls keymapping, keyboard models, and layouts.
xkb symbol files can be found in /usr/share/X11/xkb/symbols and the modifier keys are mapped in /usr/share/X11/xkb/symbols/pc
Example: Disable CAPS LOCK and make it so you can toggle the caps lock state by pressing both shift keys at the same time. Type the following at console:
setxkbmap -option "caps:none" setxkbmap -option "shift:both_capslock"
External resources:
- Extending the X keyboard map with xkb
- The XKB Configuration Guide
- An Unreliable Guide to XKB Configuration
- XKB keyboard remapping
- Hacking Your Linux Keyboard with xkb: Linux.com
keyword: XKeyboardConfig