Switching CTRL to ALT in Ubuntu

Being an OS X user, the hardest thing about using Ubuntu is that Command (CTRL on Ubuntu) is not next to Space. What you find near the Space key is the ALT button.

After googling the shit out of this problem, I wasn’t able to find a solution that would fit my needs.

Many tutorials and articles advise that you have to edit the /usr/share/X11/xkb/symbols/pc configuration. That did the trick partially, but removed the Meta functionality of ALT. That basically messed up things like ALT+TAB or CTRL+ALT+T.

To fix that we need to edit a tiny include, which adds "altwin(meta_alt)" to the map.

Navigating to /usr/share/X11/xkb/symbols/altwin opens a configuration with various mix-ins. And our meta_alt guy is the first in that list. The final code should look like this in order to achieve the magic:

xkb_symbols "meta_alt" {
  key <LALT> { [ Control_L ] };
  key <LCTL> { [ Alt_L, Meta_L ] };
  key <RALT> { type[Group1] = "TWO_LEVEL",
               symbols[Group1] = [ Alt_R, Meta_R ] };
  modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R };

After that, you should restart the X-session and it should be working as expected.

sudo service lighted restart

Note: I’m using Ubuntu 14.04.