A Tech Journal

Menu

Apple keyboard in Linux

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:

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.

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.

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.