Linux – How to map “special” keys of the keyboard to some mappings in linux

keyboardkeyboard shortcutslinuxlinux-mint

I have recently bought a new keyboard, and it has a lot of unused special keys – like "launch Excel", "launch Word", etc. I suspect there is a way to map the keypresses on those keys to some useful actions (currently, they do absolutely nothing).

How can I do this?

NOTES:

This is the usb keyboard. I found out that while most of the normal keys provide some info via the /dev/input/event2 device, half the normal keys (not catchable by xev) do some action on /dev/input/event3.

And there are other 9 keys that do not do anything on any of the input devices.

Best Answer

You'll need to find out what key code those buttons generate. You can do this by using a program called "xev". Once you have the key codes, you can use "xmodmap" to map those key codes to keys (usually function keys) and then use them for key combos in your favorite flavor of desktop manager.

This following link has a good tutorial on doing many of the things you need:

http://dev-loki.blogspot.com/2006/04/mapping-unsupported-keys-with-xmodmap.html

Keep in mind that the KHotKeys portion is KDE specific, so you'll have to adapt it to your particular window manager (GNOME, LXDE, etc...).

Edit:

Some "special" keys, especially those on "internet" keyboards, don't give a key code because they are generally software driven. Some options for these keys include:

keyTouch: http://keytouch.sourceforge.net

LinEAK: http://lineak.sourceforge.net/

Related Question