Note: Content on this page is old and probably no longer applicable, kept online for historical purposes
How To Bind Your Windows Keys (And Other Hotkeys) In Linux
Instructions For RedHat And Debian
In Redhat
In your home directory create (or edited if it exists..) a file called .Xmodmap
In the file write entries for each keycode in this form:
keycode 115=F13
keycode 116=F14
keycode 117=F15
These are previously defined keycodes (these are from using the program called xev it allows you to position your mouse in a window and press keys, the output in your terminal will tell you what they keycode is for the key you just pressed)... use xev to find out the keycodes of your other hotkeys.
Just for reference, these mean:
keycode 115 = left windows key
keycode 116 = right windows key
keycode 117 = right menu key
Now RedHat should automatically look for this .Xmodmap file when x is launched (this was tested by me in Red Hat 7.2, and in Red Hat 7.3 and 9.0 by someone who dropped by this page, thanks again!).
It has also been tested in Redhat 9 on a Great Britain keyboard by another helpful visitor to this page (Thanks Henry!), the only issue found on that keyboard was with the left windows key.
The next step is the easiest. Use your favorite desktop manager to bind these F-keys to applications just like you would any other keys (there should be documentation with your desktop manager to help you actually bind the keys, exploring every possible manager is beyond the scope of this How-To). Each of these F-keys operates separately and so can be used to launch different applications (both windows keys don't actually have to be bound to the same application).
Now you just restart x, these keybindings should work, note that they only work in x (of course...).
In Debian
In your home directory, create a file called .xmodmaprc.
In the file write entries for each keycode in this form:
keycode 115=F13
keycode 116=F14
keycode 117=F15
These are previously defined keycodes (these are from using the program called xev it allows you to position your mouse in a window and press keys, the output in your terminal will tell you what they keycode is for the key you just pressed)... use xev to find out the keycodes of your other hotkeys.
Just for reference, these mean:
keycode 115 = left windows key
keycode 116 = right windows key
keycode 117 = right menu key
Now you will need to load these into xmodmap (to view the keycodes already in xmodmap do xmodmap -pk) by simply typing: xmodmap .xmodmaprc
This will load them into xmodmap and keep them there until you close x, you will need to reload them each time you start x, to do this you can simply add a line to your .xsession file. My own .xsession file looks something like this:
xmodmap .xmodmaprc
exec enlightenment
The next step is the easiest. Use your favorite desktop manager to bind these F-keys to applications just like you would any other keys (there should be documentation with your desktop manager to help you actually bind the keys, exploring every possible manager is beyond the scope of this How-To). Each of these F-keys operates separately and so can be used to launch different applications (both windows keys don't actually have to be bound to the same application).
FAQ
: : xev responds when I hit most keys, but not when I hit my other hotkeys, what am I doing wrong? : :We have run into this problem on one of our USB keyboards. If/When we find a solution I will post it here.
: : I did everything like you said, but the binding does not seem to work, why? : :
I have not tested all window manager software to see that this binding works, some may not understand the extra F-keys like it should. I use Enlightenment and manually edited a keybindings.cfg file, and do not have any trouble.
: : What keyboard was this written for? Will this work for keyboards other than standard US keyboards? : :
They keyboard I am using is a Logitech Wireless iTouch Keyboard (ps2) a pretty standard US keyboard ... I unfortunatly will have to say I have no clue if 'foreign' keyboards will work with this, I have never had the chance to experiment. I would however be interested to know (and so I can add info to this page), so if you have a chance to play with it I'd appreciate it if you dropped me an email at : Lyz@princessleia.com