Linux

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

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

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

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.

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!

Gary says:

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

iceflatline says:

Gary, excellent! Glad it worked for you.

Alastair says:

Doesn’t seem to work on a T23

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

iceflatline says:

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

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 !#.

Nilo says:

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

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.

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…

Steve says:

Forgot to mention: Computer is beloved T43p :)

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.

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

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….

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.

DP says:

In bunsenlabs I was able to add the Super key to an Ibm X31 thinkpad by simply doing the following:

Edit Openbox > Autostart

Look for the following line and edit accordingly…

## Disable CapsLock
setxkbmap -option ctrl:nocaps
# alternative: use as compose key
#setxkbmap -option compose:caps

Edited version:

## Disable CapsLock
#setxkbmap -option ctrl:nocaps
# alternative: use as compose key
#setxkbmap -option compose:caps
setxkbmap -option caps:super

DP says:

Apologies. The above modification will make the Caps Lock key the Windows, or Super Key

iceflatline says:

DP, awesome. Thanks for the comment!

arno the UnkownUser says:

hi!
got no SUPER key. on my hardware.
Holding down Ctrl+Esc once substitute for the Windows-key, wonder why not here.

Is there a way to define, that pressing Ctrl + Esc behaves like the SUPER key ?

thank you so much in advanze

arno

iceflatline says:

Hi Arno, and thanks for the comment. I’m afraid I don’t know, nor do I use CrunchBang (now BunsenLabs Linux) much anymore so no way to experiment. The reference link the post may be of help. In addition you could try posting your question to the BunsenLabs forums. Good luck and let me know what you discover.

Leave a Reply

Your email address will not be published. Required fields are marked *