Swap Ctrl and Super keys on Linux

For past year I was working only with Macbook Pro and got used to OS X keyboard shortcuts (Super + C / Super + V). Now at work I still using OS X and at home I have Linux (Elementary OS) machine, and switching between OSX and Linux shortcuts is a lot of pain. But Linux has wonderful tool called xmodmap with it you can remap (switch) these two keys.

I found this partial solution on AskUbuntu.com. To remap my keys I executed following commands:

xmodmap -e "remove mod4 = Super_L"
xmodmap -e "add control = Super_L"
xmodmap -e "remove control = Control_L"
xmodmap -e "add mod4 = Control_L"

To execute all these commands automatically on my login. I created .xmodmap (with dot) file on my home directory and added these commands (Gist):

remove mod4 = Super_L
add control = Super_L
remove control = Control_L
add mod4 = Control_L

EDIT: it looks like lightdm does not read ~/.xmodmap file on login. Quick workaround is to add code below to Startup applications in Ubuntu/Elementary OS:

xmodmap ~/.Xmodmap
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
This entry was posted in Linux and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *