1

I have a 2015 MacBook Pro and I installed VirtualBox 4.3.28 for OS X hosts x86/amd64. I then installed Ubuntu 14.04.2 and the Virtualbox extensions.

I want to use the Ctrl and Alt keys in a similar way as I would find them in a regular PC laptop with respect to the spacebar:

[ Control_L ] [ Alt ] [        Spacebar        ] [ Control_R ]

This is what I usually use in my regular PC laptops in the past, so my brain got used to the keyboard layout, where I basically lean my left thumb on Alt and my right thumb on the R_Ctrl<'kbd> key.

EDITED:

I found an answer to a similar question where they describe how to change the Mac ctrl and cmd keys. This gets me closer to what I want, with the right Ctrl key now working: How do I switch the Command key and Control key on a MacBook Pro?

Put the following in ~/.Xmodmap:

clear control
clear mod4

keycode 105 =
keycode 206 =

keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L

add control = Control_L
add control = Control_R
add mod4 = Super_L

To test, run the command:

xmodmap ~/.Xmodmap

What I want to do now is to complete the modification by swapping the left Ctrl and Alt buttons around. But I don't know how to do that with xmodmap. Any ideas?

Zanna
  • 70,465
719016
  • 6,217

1 Answers1

1

I found the solution for my issue:

clear control
clear mod4
clear mod1

keycode 105 =
keycode 206 =

keycode 64 = Control_L NoSymbol Control_L
keycode 133 = Alt_L NoSymbol Alt_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L

add control = Control_L
add control = Control_R
add mod1 = Alt_L Meta_L
add mod4 = Super_L

If using an external keyboard plugged to the mac laptop, you can also map the keyboard in the list of available inputs in your Ubuntu instance by defining it in Settings -> Text Entry -> Input Sources as shown below (for a UK laptop). After that, you can switch between keyboards with the top-left corner icon (if on Metacity), e.g. En1:

Keyboard setup

719016
  • 6,217