Ubuntu – Mac Os keyboard layout in Ubuntu


After working for some time in Mac OS I realised that I quite like the position of "Command" key and various system-wide combinations it is used in, such as Command-W for closing document windows or Command-Q for quitting apps.

Form usability/ergonomics standpoint it is way more convenient for me personally to use 'Alt' or 'Command' key and not having to reach for Control key.

Since a lot of programs in Ubuntu do already support similar combinations, namely Ctrl-W/Ctrl-Q, I wanted to re-map those to be like their Mac Os counterparts.

So, I would like to do the following remap:

Ctrl-W -> Alt-W
Ctrl-Q -> Alt-Q
Ctrl-C -> Alt-C
Ctrl-V -> Alt-V


Can that be done via, say xmodmap, or any other means?

Best Answer

  • You can switch the alt and super keys using the keyboard configuration panel. I use xmodmap to switch the left keys and do a few more things. This setup appears to be more reliable over successive system updates. Here is my annotated .xmodmap:

    ! xmodmap for macbook keyboard.
    ! Vertical and horizontal mouse/touchpad scrolls like a touch screen.
    ! Note that 5 4 and 7 6 are reversed.
    pointer = 1 2 3 5 4 7 6 8 9 10 11 12
    ! Switch left command and option (super and alt).
    clear mod1
    clear mod4
    keycode 133 = Alt_L
    keycode 64 = Super_L
    add Mod1 = Alt_L
    add mod4 = Super_L
    ! Right command and option are common keys that can be remapped
    ! using keyboard short cuts.
    keycode 134 = Menu Break
    keycode 108 = Pause Clear
    ! Map expose and dashboard to keys that can be remapped
    ! using keyboard short cuts.
    keycode 128 = F15
    keycode 212 = F16