Setup of Logitech Navigator Keyboard
I bought a Logitech Navigator Keyboard for my laptop, since I hoped it would lower the preasure my wrists gets when writting +14 hours a day - which has been the case for the last few months.
The Navigator Deluxe keyboard comes with a lot of extra keys that I've setup to suit my needs. I'll try to describe how - mostly as a reminder so I can easily do it again later on.
Finding key codes
The first thing to do when mapping keys on a keyboard to commands is to figure out what key codes each key has, since this is needed when assigning a command to the key.
To figure out what keycode a given key has, start up the program xev (works for mouse events as well)
$ xev
Then click on the key you want to examine. This will dump a lot of information in the console
KeyPress event, serial 25, synthetic NO, window 0x3200001,
root 0xae, subw 0x0, time 3795514, (129,86), root:(132,175),
state 0x0, keycode 176 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes: ""
From this dump we can see that the pressed key's keycode is 176.
After having examined all keys' keycodes I've gotten the following lists of keycodes.
KeyCode overview
| Key | Key code | Mapped to |
| Rewind | 164 | |
| Forward | 162 | |
| Play / Pause | 159 | |
| Stop | 151 | |
| Mute | 166 | |
| Volume down (wheel) | 165 | |
| Volume up (wheel) | 158 | |
| Media key | 129 | |
| 236 | mozilla -mail | |
| Messenger | gnomeicu | |
| Webcam | ||
| Favourites | 230 | gnome-terminal |
Binding keys to commands
The next step is to tell X what keys a click on e.g. the E-mail key should represent. The easiest thing is to use F-keys that aren't present on the keyboard e.g. F13
.xinitrc
xmodmap -e "keycode 174 = XF86AudioLowerVolume" xmodmap -e "keycode 176 = XF86AudioRaiseVolume" xmodmap -e "keycode 160 = XF86AudioMute" xmodmap -e "keycode 115 = F13"
Using the gconf-edit tool the newly created keys can be assigned to commands, so key presses will execute these commands. In the above example I've created a F13 key, which I would like to have open an gnome-terminal.
In gconf-editor, click apps and then metacity. This will bring you to the settings for the Window Manager I'm currently using and which is the default for GNOME installations.
Under global_keybindings you set the run_command1 setting to F13 (or they key you want to bind) and then under keybindings_command set command1 to /usr/bin/gnome-terminal
When pressing the key the Window Manager will in the future open a new gnome-terminal.