How do I switch the Command key and Control key on a MacBook Pro?
I figured it out. 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
To make it run every time, add it to Startup Applications.
This should work on any MacBook Pro; the issue was that Xmodmap was assigning Super_L to the left and right command keys, and Control_L to the left control key. For some reason, by default, Ubuntu thinks that the MacBook Pro has a standard 105 key keyboard (probably thinking about the full Apple Keyboard) but that is wrong. Anyway, I reassigned the keycodes to the right keysims, then assigned the keysims to control
and mod4
.
I just installed Ubuntu 16.04 dual boot on my MBP13" yesterday. For Ubuntu 16.04, here's how i did it:
Step 1: Launch terminal
Step 2: Edit X Keyboard Extension
sudo nano /usr/share/X11/xkb/symbols/pc
Step 3: Make the following changes. Ensure your file looks like this:
key <LCTL> { [ Super_L ] };
key <LWIN> { [ Control_L ] };
...
key <RCTL> { [ Super_R ] };
key <RWIN> { [ Control_R ] };
Step 4: Clear xkb's cache
sudo rm -rf /var/lib/xkb/*
Step 5 (conditional): If the keys are not swapped after step 4, restart your computer. It worked for me after this.
Hope it helps, good luck!
Go into System -> Preferences -> Keyboard
Click on the "Layouts" tab and then click the "Layout Options" button.
Click on "Alt/Win key behavior"
Select "Control is mapped to Win keys (and the usual ctrl key).
from http://ubuntuforums.org/showthread.php?t=1293081