I’ve got myself a wired aluminium USB Apple keyboard, and I’m running Arch Linux that mostly hasn’t been updated since the end of the summer of 2011 (just to give you some idea about how recent my software is: gnome-desktop 3.0.2, gtk3 3.0.11, compiz-core 0.8.6, glibc 2.13, gcc 4.6.0, etc).
As it was reported in this nice post, all keys except Expose and Dashboard work right out of the box (or, more accurately, are recognized but not necessarily do the expected; pleased read on). I successfully assigned Expose key to the Compiz Scale plug-in, however Dashboard was giving me a hard time. I ended up assigning keycode 212 to F13 key symbol, that works just fine, for some reason unknown to me XF86Calculator doesn’t play well with this button.
In my case I have Apple keyboard connected to a Samsung R-20 notebook computer, that is physically placed behind a 24″ DELL display. So, I’m not sure whether there’s some sort of conflict between the two keyboards that have multimedia keys on them connected to a single computer:
% xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=10 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=11 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
↳ Apple Inc. Apple Keyboard id=12 [slave keyboard (3)]
↳ Apple Inc. Apple Keyboard id=13 [slave keyboard (3)]
The output is kind of misleading, there are two Apple keyboards in this output reported, however only one is physically connected.
I don’t seem to have a multimedia key that corresponds to XF86Calculator key symbol on the notebook keyboard, but it just wouldn’t work with Compiz. I could easily launch a GNOME calculator default app, the gcalctool, with Dashboard key, but not the Widget layer.
Here’s a brief report about the multimedia keys:
Decrease Brightness (F1) – WROB
Increase Brightness (F2) – WROB
Expose (F3) – xmodmap
Dashboard (F4) – xmodmap
F5 no multimedia action on the Apple keyboard, but Decrease Contrast is attempted – WROB
F6 no multimedia action on the Apple keyboard, but Increase Contrast is attempted – WROB
Previous Track (F7) – WROB, NC
Play/Pause (F8) – WROB, NC
Next Track (F9) – WROB, NC
Mute (F10) – WROB
Decrease Volume (F11) – WROB
Increase Volume (F12) – WROB
Eject – WROB
WROB – works right out of the box
NC – needs configuration
Some WROB multimedia keys trigger OSD in GNOME+Compiz, but I can’t reliably tell whether F1 and F2 actually work, because brightness control via multimedia keys doesn’t work even with the native notebook keyboard NOR does it work if I use GNOME settings to adjust brightness level.
For F3 and F4 read this article to learn how to use xev and xmodmap to assign these keys to trigger Compiz actions.
F5 and F6, it would seem, weren’t supposed to do anything, but judging by OSD icon they attempt to decrease and increase display contrast, which again didn’t work neither for external DELL display, nor notebook display.
F7, F8 and F9 generate proper key symbols, and thus can be assigned to communicate with your audio player. You can use these buttons in Applications->System Tools->System Settings->Keyboard->Shortcuts. Even though I have Audacious defined as default music player, Banshee was started when I assigned F8 to Launch media player action in System Settings dialog. At least it proves that the keys work, but this clearly needs some more configuration.
F10, F11 and F12 work just fine.
Eject key triggers OSD menu but it doesn’t seem to actually eject the CD-ROM on my notebook.
So, basically the important fact is that the keys generate proper events, and what’s really cool is that all multimedia keys do that. All is left to do is configure your system to catch those key press and release events and associate some actions with them.
Something to do on your own to get more intimate with Linux 🙂