I needed a new keyboard as the Logitech one I had just wasn’t cutting it. I was looking at something nice and solid, rather than some cheap eBuyer job. Keyboards that took my fancy included the rather lovely Das Keyboard and Logitech’s new Illuminated Slim Keyboard. However, the Das keyboard is probably going to piss me off with its loud mechanical switches and I can’t find anywhere in the UK selling the Logitech yet.
Apple however has come to my rescue. I had seen there slim keyboard before, but had no idea that it only cost £29!! Complete bonus. It looks great, types great and has a nice solid feel to it. So, I went and bought one. I plug it into my Linux box (running Debian Lenny) and to my surprise most of it works! There are several multimedia buttons on the keyboard for things like sound, and media playback, as well as function keys F13–F19. They media buttons all worked great in Gnome. The function keys F17–F19 didn’t though.
After a little exploration with xev I figured that, not unusually, some of the multimedia keys did not have key symbols associated the keycode generated by the key. Strangely, some of the keys did not even display any keycodes at all, just some weird focus events. After a while I figured out read somewhere that this was because the keyboard shortcuts program in Gnome was stealing the events before they could be registered with xev. I think this is some kind of bug… Anyway, once you get keycodes for all the media keys you can use xmodmap to map them to key symbols.
The first thing to do is create a file named .xmodmap in your home dir. Then you need to fill the file with your associations between key codes and key symbols; mine looked like this:
#.xmodmap file.
keycode 131 = F17
keycode 132 = F19
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 162 = XF86AudioMedia
keycode 247 = F18
In order to make update the associations it’s a case of running.
:~$ xmodmap .xmodmap
On future logins the .xmodmap file will be loaded automatically, as long as you named it correctly.

No Comments