Archive for November, 2008

Keyboard mappings on Linux

Friday, November 28th, 2008

My Thinkpad doesn’t have a ‘windows’ key and I’m an Emacs user. Conventionally, I’ve always used the left ALT key as Meta (and ALT). All Emacs (and other application) functions rely on that button. The right ALT key, I map to a different modifier (like Hyper or Super) and use it for window management operations. This has been going on fine till my upgrade to Intrepid Ibex which messed things up. Usually, it’s easy to fix this using jwz’s xkeycaps but apparently, that’s not working as well. It detects my right Alt as a numeric keypad enter. I somehow fixed it but then because of a package upgrade, messed up all my settings. I managed to do it again but want to document what I’ve done so that if I mess up again, I’ll know what to do.

All the files you need to modify are in /usr/share/X11/xkb.

  1. find all the files (XML and others) which contain the string hyper_win starting from this directory
  2. To all the .lst files under rules and similar files, I added this
      altwin:ralt_super    Super is mapped to the right Alt key

    just after the entry for hyper_win

  3. To the XML files, I added another option node like so just after the node for hyper_win
              <description>Super is mapped to the right alt key.</description>
  4. Now add the following line to the symbols.dir file in the top level directory

    --p----- -m------ altwin(ralt_super)
  5. Now add this to the symbols/altwin file

    partial modifier_keys
    xkb_symbols "ralt_super" {
        key <ralt> {        [       Super_R                 ]       };
        modifier_map Mod4   { Super_R };

    just below the entry for hyper_win

  6. Copy over the rules/base.xml file to the /etc/X11/xkb directory.
  7. Go to the System/Preferences/Keyboard menu from your panel and select the layouts tab. Click the ‘Other options’ button and under the Alt/Win key behaviour tree, you’ll have the new option we added. Select that and your right alt will work as a Super key. You can verify this using xev.
  8. Use the keyboard bindings application and change the keyboard shortcuts for window operations to use the right key.
  9. Done

Disclaimer : I have no idea how xkb works or whether what I’ve done above is acceptable in any sense. It’s working fine for me now and this is more of a ‘note to self’ rather than a tutorial of any kind.

Media bias?

Sunday, November 23rd, 2008

“Qualified” Terrorism

Friday, November 21st, 2008

Intrepid Ibex, Apple and Anathem

Monday, November 17th, 2008

He won!

Wednesday, November 5th, 2008