Ubuntu

Super key not working

I was originally running Ubuntu 13.01 with Unity. I was getting bored of the interface so I installed conky and cairo-dock. I ended up uninstalling those because I couldn’t configure it but it broke my super key. Super key, ie, my left Windows key (my keyboard doesn’t have a right Windows key), wouldn’t open the Unity dash. FYI, I did not change these key mappings and I don’t know how to but someone it was broken. Here’s how I fixed it:

Step 1: Find out the key codes

“sudo showkey -k” shows the keycodes for the keys you press but the keycode shown is actually subtracted by 8 (I don’t know why!). So add 8 and that’s the actual keycode. In my case, the left Windows key was showing as 125 but it was actually 133.

NOTE: you can also use the “xev” command and that gives you the correct keycode (no further arithmetic required).

Step 2: Find out the key code mapping

“xmodmap -pke” lists the keycode and its mappings. In my case, 133’s mapping looked like this “keycode 133 = Control_L NoSymbol Control_L”.

My Windows key was suddenly the Left Control Key?!?!? WTF!??!?!

So which keycode was my Super key??? Here “keycode 206 = NoSymbol Super_L NoSymbol Super_L”

Step 3: Fix it!

sudo xmodmap -e "keycode 206 ="
sudo xmodmap -e "keycode 133 = Super_L"

Now the Windows key worked but the Left Control key also behaved liked the Windows key. WTF?!?!?!

Turns out there’s another mapping:

:~$ xmodmap -pm
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69), Super_L (0x85), Control_R (0x86)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 
mod4 Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

“Super_L” is there twice and with different keycodes, so I did this:

sudo xmodmap -e “remove mod4 = Super_L”
sudo xmodmap -e “remove control = Super_L”
sudo xmodmap -e “add mod4 = Super_L”

Now it looks like this:

:~$ sudo xmodmap -pm
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69), Control_R (0x86)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 
mod4 Super_L (0x85), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

And it all works! Hooray!!! 🙂

Hopefully that helps someone else. And remember I’m not an expert but that worked for me! 🙂