Skip to main content

Apple Aluminium Keyboard on Linux

Since I'm a sucker for shiny things, and since I got used to the lovely keyboard on my Macbook, it only seemed right to get a new brushed aluminium keyboard for my non-Macbook computer. Well, that and a hand injury requiring me to have a keyboard with less than 1/16th of an inch key travel ...

I previously used it on Windows and getting it to work with Bootcamp was pretty easy. I even wrote instructions on my old blog. I've since started using it as my primary keyboard on my desktop machine with Ubuntu, and setting it up on there was even easier. There is a built-in keyboard map for it, and everything just works. I use the US layout because I'm more likely to type # than £, but altgr+3 produces the £ so all is good.

Unfortunately there are two things that irk me about this keyboard. First is that there is no insert key. Second is that you have to hold down Fn, which is where the insert key should be, to make the F keys work. Fortunately a bit of magic can make everything OK.

Building A New Insert


I decided to use F13, which is located directly above Fn, as a replacement insert key. I used xev to determine that the scan code of F13 is 191 (the others following on in a linear fashion). Making it into insert is just a bit of xmodmap magic, so put this line into .Xmodmap in your home directory.

    keycode 191 = Insert


That's it. It will be enabled when you log in. If you want to enable it immediately, type this:


    $ xmodmap .Xmodmap


Magic. You now have an insert key.


Fn-less F Keys


I found many, many blog posts by other people trying to figure out how to convert the media keys into standard F keys. Most of them spent time with xev trying to map the scan code of the F keys to the X11 function key mappings. This is a long winded and entirely unnecessary task if you have a 2.6.x kernel. Add this line to /etc/rc.local:


    echo 2 > /sys/modules/hid_apple/parameters/fnmode


On reboot, you will have standard function keys. The media keys are still accessible by holding down Fn, so it's the best of both worlds. If you are running Compiz, you could map the exposé keys to that. Of course, enabling it without a reboot is as simple as running that command as root.

Comments

Popular posts from this blog

Fairy Lights

Street lights at night can be very pretty. For someone who lives close to the centre of a large city, skirting round the edge of the town centre can provide a host of beautiful views at night. One advantage to using a wide open lens when taking these pictures is the capture of bokeh, or creative blur. An extreme example is shown to your right; a mass of coloured circles that roughly represent the city they are part of. A more subtle example, of course, is in the picture of the day at the top of this post. The lights cluster around the top of the leaves like fireflies, obviously part of a cityscape but at the same time abstract. The extreme out of focus image is a blurred version of the picture on the left. A view over Sheffield from Pitsmoor, looking up Netherthorpe Road and up to the university. Even when the buildings are focussed (roughly; I'm still practicing) the lights take on the shape of the lens's aperture. I try to incorporate some foreground focus wh...

In which I complain that coding standards are a waste of time

Just kidding. I'm not going to rail against coding standards. No, I'm going to rail against the absolute and dictatorial enforcement of coding style guidelines, to the point where a single misplaced curly bracket can fail the code review of a thousand line project before it's even started. I'm going to rail against the fact that many people these days don't actually know that coding style guidelines and coding standards are not the same thing. Coding style guidelines are not coding standards. Coding standards are rules on how to construct software. Rules that have practical and defined benefits. Rules than can be proven to assist in the structured and correct building of code. For example: Do not perform database access in the constructor. All database access should use the framework's DAL. Do not rely on complex instantiation instructions; provide a factory method. Do not inherit from a class in a different module or library; only encapsulate. Avoid sin...

DeCSS on Ubuntu 9.10 and later

It used to be the case that enabling DVD playback on Ubuntu was a case of installing ubuntu-restricted-extras and that was that. Unfortunately DMCA nonsense in the US has buggered that up for all of us and so now there's an additional step. So, without further ado, here are the commands that need to be run at a command line: sudo apt-get install libdvdread4 sudo /usr/share/doc/libdvdread4/install-css.sh Voila! DVD playback a-la Ubuntu.