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)
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)
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! 🙂


Command and Conquer Red Alert on Linux

PortableRA is the software for this classic game, see http://iran.cnc-comm.com/ra/

Here are the instructions to installing it:
(I’m running Ubuntu 13.10 64bit)

1. Install the prerequisites

sudo apt-get install wine mono-complete

2. Download PortableRA (http://iran.cnc-comm.com/ra/PortableRA%20setup.exe)

3. Chmod it and make it executable. Install to it $HOME/.wine/drive_c/Program Files/PortableRA

4. This should have created a shortcut on your desktop.



Ubuntu, finally!!!

Finally got 3d acceleration working on Ubuntu, I used 13.10!!! Clean install it worked!!! Finally!!! 🙂

System Info says Graphics driver is Gallium 0.4 on AMD PITCAIRN. My system specs again:

Asus Rampage IV Formula
2GB Radeon HD 7850
Several hard drives



I was getting tired of running Ubuntu on a virtual machine so I decided to dual boot my PC. I picked Ubuntu 12.04 LTS because that would have better support for hardware, I was concerned whether my graphics card would not work properly. Here are my system specs:

Asus Rampage IV Formula
2GB Radeon HD 7850
Several hard drives

Here are the problems I encountered:

1) BIOS/UEFI: I had heard of UEFI before but I didn’t know what it was. Anyways, my first mistake was trying to install Ubuntu in UEFI mode when my Windows 7 was in BIOS mode. Follow this https://help.ubuntu.com/community/UEFI to see if your Windows is in UEFI or BIOS mode. Once I changed my BIOS settings to boot only in BIOS mode, things started working as expected.

2) Partitioning: I don’t know why I got this wrong so many times, anyways, when installing Ubuntu, partition it yourself:

(assuming you have a 1TB hard drive)
200-300MB    /boot
300MB-960GB  /
30GB         swap

Make sure you select /boot partition correctly in the bootloader dropdown.

3) Graphics Card: Long story short, install the drivers suggested by Ubuntu through the additional drivers window. Ignore the fact that it still says “Unknown” graphics in the System Details window. If you have dual screens like me and want an extended desktop, the Ubuntu Displays menu didn’t allow it so use Catalyst Control Center to do it (gksudo amdcccle). I think I also read somewhere that it also helped that I ran Ubuntu in BIOS mode and UEFI mode.

So I ended doing the whole thing about 10 times, yes yes I know I’m such a n00b but but but it works now 🙂

Programming, Ubuntu

Qt 5.1.0 on Ubuntu 12.04 LTS

Here are instructions to running Qt 5.1.0 on Ubuntu 12.04 LTS. Please note that I got it working on a virtual machine, here are the details:

  • VMware Player 5.0.2 build-1031769
  • New install of Ubuntu using image “ubuntu-12.04.2-desktop-amd64.iso”

Step 1
Get Ubuntu running on the VM, I’m not going go through all that. Once Ubuntu is ready, install the OpenGL development libraries:

sudo apt-get install libgl1-mesa-swx11-dev (see update below)
sudo apt-get install libgl1-mesa-dev

NOTE: I used the mesa libraries because I didn’t have the drivers for my graphics card.

Step 2
Download Qt from their website. I used this “qt-linux-opensource-5.1.0-x86_64-offline.run”.

Step 3
Install Qt:

chmod a+x qt-linux-opensource-5.1.0-x86_64-offline.run
sudo ./qt-linux-opensource-5.1.0-x86_64-offline.run

NOTE: I installed using sudo so that I can install to /opt/ so that everyone has access. For some reason when I installed it to /opt/, the examples directory has no permissions at all. I don’t know why it does that but here’s how you fix it:

sudo chmod -R a+rwx /opt/Qt5.1.0/5.1.0/gcc_64/examples

Step 4
Now you can run the examples. Run the examples from their original directory (in my case it is /opt/Qt5.1.0/5.1.0/gcc_64/examples) because some of the examples have code in folders outside their source folder.

I have tried the following examples and they work:

  1. Analog Clock
  2. Application
  3. Calqlatr*
  4. OpenGL Window*
  5. Same Game*

* Hang on, hang on! I’ll explain in the next section 🙂 See update below.

Yay! I finally got the OpenGL applications working (I’ve struggling for a day to get it working, it turned out i was using the wrong OpenGL mesa libraries). However, it appears that the color black is displayed transparently. WTF you ask?? Don’t look at me 😛

Does anyone know WTF is going here??

Problem fixed!! Yay!!

Use the “libgl1-mesa-dev” package and all is ok. This is because Ubuntu by default installed “libgl1-mesa-dri-lts-quantal” and the matching dev package is “libgl1-mesa-dev” (see http://packages.ubuntu.com/precise/libdevel/).