Configure the keyboard for your Macbook and Ubuntu 12.04 (and 12.10)

Configure the keyboard for your Macbook and Ubuntu 12.04 (and 12.10)

I love the new Ubuntu 12.04 Precise Pangolin. Unity – and the graphics drivers – have finally reached a stability that satisfies me and let me keep GNU/Linux as solo operating systems on my Macbook Pro 6,2.

What drives me crazy is the default keyboard mapping, surely not thought for who owns an Apple computer.

First, the Unity Launcher (a.k.a. Dash) default shortcut is the Super key (or Win key). This key corresponds to the cmd key on Apple keyboards.
Under Mac OS X, the combination cmd+space opens Spotlight, while cmd+c, cmd+v are for Copy&Paste. That is, the cmd key is a supercharged ctrl key.

I spent some time to search the best combinations to reproduce this behavior under Ubuntu.
Here is what I managed to create:

  • I swapped the left ctrl and the left/right cmd keys. That is, cmd becomes ctrl and ctrl becomes cmd
  • After the first modification, it becomes unconvenient to open Dash with the ctrl key. Therefore, I changed Unity Launcher key to cmd+space. This (sort of) emulates OS X behavior.

To implement the first tweak, create the file ~/.Xmodmap with the following content:

Logout and login again.
Congratulations, you have the swapped keys. Ubuntu should already take care to load the file automatically.

It is important to not manually load the .Xmodmap file. It may result in a double application of the mappings, resulting in a re-swap of the keys.

To achieve the second tweak, install the package compizconfig-settings-manager.
Open it using the ccsm command, or search for it in Dash.
Find Ubuntu Unity Plugin->Behavior->Key to show the launcher and change it to <Primary>space, using the Grab key combination button. It may be also shown as <Control><Primary>space.

You can now have a behavior similar to Mac OS X in Ubuntu 12.04. You can change the virtual desktop using cmd+alt+arrow. You can cut, copy, and paste using cmd+x, cmd+c, and cmd+v. You can open the Unity launcher with cmd+x.

I hope that this little how-to can help frustrated Apple users who want to embrace GNU/Linux freedom.

(Featured Image credits: Marco Antonio Islas Cruz)

Share Button

Comments are disabled while the website is tranferred to another server. Thank you for your patience.