You are not logged in.

#1 2013-01-16 05:57:26

Registered: 2013-01-11
Posts: 5

[SOLVED] Apple Keyboard Swap 'Command' and 'Control' in Gnome

I've found one of the odd things I've missed the most since switching from OS X to Arch is using the command button for my keyboard shortcuts, rather than the control button.  My solution to swap the functionality of these keys was to use xmodmap for remapping and a custom .desktop file for automatically executing a command when Gnome starts.

Here are the relevant files:


remove control = Control_L
remove mod4 = Super_L Super_R
keysym Control_L = Super_L
keysym Super_L = Control_L
keysym Super_R = Control_L
add control = Control_L Control_R
add mod4 = Super_L Super_R


[Desktop Entry]
GenericName=Keyboard Remapping
Comment=Remap the Control and Command Keys on the MBP 8,2
Exec=xmodmap /etc/X11/xinit/.Xmodmap

That's it!  Reboot, and it should work.

Note:  ~/.config/autostart is unique to Gnome, but other display managers have similar mechanisms (according to my research, but YMMV).  Also, this was on a Macbook Pro 8,2 but I expect it would work on any apple keyboard.

Last edited by mightyplatapus (2013-01-16 06:03:29)


#2 2013-04-19 14:06:23

Registered: 2013-04-19
Posts: 1

Re: [SOLVED] Apple Keyboard Swap 'Command' and 'Control' in Gnome

Thanks!  Worked perfectly.  Lots of little things to get used to, but this helps a whole lot since I'm going back and forth between the two.


#3 2014-01-17 08:58:57

Registered: 2013-11-28
Posts: 3

Re: [SOLVED] Apple Keyboard Swap 'Command' and 'Control' in Gnome

I used the same scripts, except that I didn't used the desktop entry, I launched it by hand.
But when I hibernate / suspend / or so, I had to launch it again every time.

So instead, I modified directly the keyboard layout.
It's globally in the files in


And I changed the file


swap LCTL and LWIN keycodes

	<LALT> = 64;
	<LCTL> = 133;
	<SPCE> = 65;
	<RCTL> = 105;
	<RALT> = 108;
	// Microsoft keyboard extra keys
	<LWIN> = 37;


Board footer

Powered by FluxBB