Can I use the Windows® keys on my keyboard in X?
Yes. All you need to do is use xmodmap(1) to define what function you wish them to perform.
Assuming all ``Windows®'' keyboards are standard then the keycodes for the 3 keys are
-
115 - Windows® key, between the left-hand Ctrl and Alt keys
-
116 - Windows® key, to the right of the AltGr key
-
117 - Menu key, to the left of the right-hand Ctrl key
To have the left Windows® key print a comma, try this.
# xmodmap -e "keycode 115 = comma"
You will probably have to re-start your window manager to see the result.
To have the Windows® key-mappings enabled automatically every time you start X either put the xmodmap commands in your ~/.xinitrc file or, preferably, create a file ~/.xmodmaprc and include the xmodmap options, one per line, then add the line
xmodmap $HOME/.xmodmaprc
to your ~/.xinitrc.
For example, you could map the 3 keys to be F13, F14, and F15, respectively. This would make it easy to map them to useful functions within applications or your window manager, as demonstrated further down.
To do this put the following in ~/.xmodmaprc.
keycode 115 = F13 keycode 116 = F14 keycode 117 = F15
If you use fvwm2, for example, you could map the keys so that F13 iconifies (or de-iconifies) the window the cursor is in, F14 brings the window the cursor is in to the front or, if it is already at the front, pushes it to the back, and F15 pops up the main Workplace (application) menu even if the cursor is not on the desktop, which is useful if you do not have any part of the desktop visible (and the logo on the key matches its functionality).
The following entries in ~/.fvwmrc implement the aforementioned setup:
Key F13 FTIWS A Iconify Key F14 FTIWS A RaiseLower Key F15 A A Menu Workplace Nop