Swap `Ctrl-Left` and `Alt-Left`
Introduction
I know, not everyone is a fan of Apple, but I enjoyed quite a bit the UX of my old MacBook Pro, so I always swap the left Ctrl
key with the left Alt
key, like the Command
key and Option
key from Apple.
The thing I liked about that is the simplicity of using the Ctrl
shortcuts with the thumb without moving the left hand that much... a personal preference, but still enjoyable IMO.
But swapping keys is not always an easy task, because, if it only works partially, it may completely break your interactions and shortcuts... definitely not a good experience.
Configuration
The easiest and most compatible way I found is the following (it worked for me on Ubuntu and Archlinux):
- Open a terminal
- Type
nano ~/.Xmodmap
and thenEnter
(you can use whatever text editor you prefer: vi, vim, nvim, gedit...) - Type the following lines:
clear control clear mod1 keycode 37 = Alt_L Meta_L keycode 64 = Control_L add control = Control_L Control_R add mod1 = Alt_L Meta_L
- Type
Ctrl-X
, thenY
and thenEnter
(it may differ according to the text editor of your choice (Escape
,:wq
andEnter
for vi, vim and nvim). - Finally type
xmodmap ~/.Xmodmap
to apply the new configuration.
If it doesn't work for you, it may be because of a couple of reasons:
- your keyboard is not mapped the same way (different keycodes)
- you don't have
xmodmap
- another reason I don't know of...
If the reason is the first one, you may be interested to see that post (where I found that tip).