Ascending from the ninth circle of X hell

I’ve spent most of yesterday and today in the ninth circle of X hell, also known as XKB onfiguration. However, I’m now starting to see the light from above.

Why would anyone willingly look at XKB configuration you might ask. Well, I recently got a MacBook Pro, and the keyboard layout it used is slightly different than the regular pc105 keyboard. The main problems are that the key to the left of “1″ and the key to the left of “z” somehow got their keycodes swapped, and the fact that there is no right Alt which means its hard to type certain symbols (there is a right Apple key though).

There are various places on the internet that shows you the magic xmodmap incantations you need to “fix” this, but I wanted a real fix that would let anyone set up a MacBook keyboard. So, I set out to add XKB configuration that lets you use the gnome control center to pick the right keyboard.

So, I proudly present the result of my labor:

I added not only fixes for the keycodes, I also added the correct symbol for the eject button, a geometry description, and an option to make the apple keys act as Alt (since they are in the normal Alt positions).

There seems to be some redraw bug in the applet, because the return key isn’t rendered right.

I’ve already build the patch in Fedora Core (development), and the upstreams patch is availible here.

6 Responses to “Ascending from the ninth circle of X hell”

  1. frej says:

    You are my hero!!!! :) Please write up the steps needed(?).
    We really need to make it easy for people to add this info.

    Now I only need to figure out hal so i can get keyboard backlight working. (If it’s supposed to work through hal). The commandline utility exists… but(!).

  2. Alexander Larsson says:

    Its hard to give a set of steps needed to do something like this due to the complexity of XKB. The best docs I found where:
    http://www.charvolant.org/~doug/xkb/html/index.html

    However, once its done its trivial for users to use.

    I haven’t spent any time on the backlight stuff yet, but I think David Zeuten has something for that.

  3. Lalufu says:

    So the MacBook can actually distinguish between the left and right Apple key? My (rather old) iBook fails to do that.

  4. Frank Murphy says:

    My old iBook could distinguish between the two Alt keys — kind of. It would only generate a different key when pressing the ‘fn’ key at the same time. Not totally useful for those who are used to an AltGr key. Here’s the Apple docs on that:
    I think the same behavior exists for later iBooks and the Apple keys.

    Also, when you say that the ‘key to the left of “1″ and the key to the left of “z”‘ are swapped, are they swapped in the Linux console too? There are a lot of layers to Linux keyboard handling; it would be nice to fix this problem at the lowest level. (And you thought there were only 9 circles of hell!)

  5. Alexander Larsson says:

    Frank: Yes, they are swapped in the Linux console too.