Linux Set up a Super Key on an IBM Laptop for use in CrunchBang Linux

16 Comments

I recently started using CrunchBang linux on my IBM T43 laptop. I really like CrunchBang and highly recommend it for those looking for a minimalistic, lightweight alternative to Ubuntu, especially on older machines. However, by default, it, or more accurately, its window manager Openbox, makes heavy use of the keyboard “Super” key (also called the “Windows” key) to open many of the most used applications. For example, Super+t opens the default terminal emulator, Super+w opens the default browser, etc. Now normally this would not be a problem, unless of course you own an IBM T43 laptop, in which case you have no windows key. Sure I could go through the hassle of changing all those key assignment in Openbox to something else, say Alt+w, but then both Alt keys would be dedicated to the task. I also wanted to mimic the same key behavior I currently use in Windows. In Windows I assigned my right Alt key as the “Windows” key. Here’s what worked for me in CrunchBox.

First I created the file .Xmodmap so I could add my own key map changes. The standard location for .Xmodmap is your home directory and it (and any key map changes contained therein) should load automatically at start up.

Then I opened the file and added the following lines:

Rebooted and now have a working right Alt key acting as the Super key.

References:

http://cweiske.de/howto/xmodmap/allinone.html

Tags: ,

16 Responses to “Set up a Super Key on an IBM Laptop for use in CrunchBang Linux”

  1. ted Says:

    Thank you for the quick and easy instructions! Worked for me on an IBM Thinkpad T41. BTW I didn’t need to reboot, just log out and log back in.

  2. iceflatline Says:

    Thanks ted, glad it worked for you on the T41. Sadly, since I wrote that post, my T43 finally gave up (backlight issue) after a long and productive life. I’ll really miss that laptop but I’ve replaced it with a Lenovo x301 which … ta da … finally features a “Windows” key!

  3. Gary Says:

    Hey, Thanks much for the tip on the super-key remapping. Worked 100% on my old T40.

  4. iceflatline Says:

    Gary, excellent! Glad it worked for you.

  5. Alastair Says:

    Doesn’t seem to work on a T23

  6. Alastair Says:

    Alt_R wasn’t defined.

    I don’t know whether this is due to my hardware, or because of a different version of crunchbang.
    In any case, here is the solution
    I needed to remove ‘ISO_Level3_Shift’ which was assigned to AltGr

    I used the following ~/.Xmodmap to get it to work

    remove mod1 = Super_R
    remove mod1 = ISO_Level3_Shift
    keycode 108 = Super_R
    add mod4 = Super_R

    Hope this helps someone

  7. iceflatline Says:

    Alastair, glad you got it working! Thanks much for contributing.

  8. Jac Says:

    Alastair – I came across your posting when searching for something else: yes it did help! Two years later and this worked like a charm on my aged T23 which is having a new lease of life thanks to !#.

  9. Nilo Says:

    Thanks for this. I was wondering – would it be possible to assign the Left Alt key instead? If so, how?

  10. iceflatline Says:

    Nilo, I don’t see why not. You could try assigning it to specific tasks by modifying Openbox’s rc.xml file, or configure something more global using .Xmodmap, similar to method described in the post. You would need to determine the correct key code and ensure that .Xmodmap was read at boot time. See the link under “References” in the post. You might also try the CrunchBang forums.

  11. Steve Says:

    Thanks very much for this, but I wonder if you could point me in the right direction. I just moved from Ubuntu/Mint to #! and am finding out just how little I actually know about how to use GNU/Linux – having been protected, so to speak, by the GUI-monster. So, when you say…

    “First I created the file .Xmodmap so I could add my own key map changes. The standard location for .Xmodmap is your home directory and it (and any key map changes contained therein) should load automatically at start up.
    touch ~/.Xmodmap

    Then I opened the file and added the following lines:
    remove mod1 = Super_R
    remove mod1 = Alt_R
    keycode 108 = Super_R
    add mod4 = Super_R”

    …I am lost. And the pathetic part is that I’ve been searching on the subject for three days now, and am only more confused. I appear to have an .Xmodmap already installed – though not in the ~/ directory. But I’m not even sure exactly where it’s located. And if I did know, I’m at a loss as to how to edit the thing.

    So, what I’m looking for is not so much a hand-holding, as a website that clearly explains – in thorough, painful, exquisite detail – how to function in GNU/Linux. What I keep finding are discrete pieces of information that don’t mesh into a coherent whole. And I swear, I’m really not stupid…

  12. Steve Says:

    Forgot to mention: Computer is beloved T43p :)

  13. Steve Says:

    Oh, and when I say that I appear to have .Xmodmap already, I mean that when I type it into Terminal, a long list of Keymappings appears. I can use zev to look at the mappings in detail. What I can’t seem to do is create a new .Xmodmap in ~/ that gives me a Superkey.

  14. Steve Says:

    Okay, I managed to create ~/.Xmodmap and used Geany to copypasta your lines. Rebooted, and…nothing. Wonder what I’m doing wrong? Given the depth of my ignorance, it could be almost anything! lol

  15. Steve Says:

    Tried Alastair’s script to no avail. Used xev to look at detail and don’t see anything pertinent. Will continue to persevere….

  16. iceflatline Says:

    Steve, sorry you’re having issues. It has been awhile since I’ve had to resort to this workaround having long since moved on from the T43. I recommend using xev to make sure you’re using the correct keycode for the key your interested in mapping. keycode 108 may not be valid. The link at the end of the post may also be of some help, and you may also consider posting your question(s) in the #! forums or in their IRC channel. They’re a pretty friendly community.

    Another option would be to simply forgo remapping the key and instead assign a key(s) of your choice to various functions. OpenBox, CrunchBang’s window mangager, supports this. Right-click on the desktop and navigate to Settings->Openbox->edit rc.xml. The rc.xml file contains all of CrunchBang’s default key mappings. These can be modified, so you can bind any combination of keys to open the applications you want. For example, you’ll see that the default is to open a terminal using the Windows key + t, but this could easily be changed to Alt + t. I recommend you make a backup copy of this file before experimenting and note that for any changes to take effect you’ll need to reboot the machine or simply restart OpenBox using Openbox->Settings-Restart.

Leave a Reply