Remap Ctrl to CapsLock
Post updated on July 17, 2021The CapsLock
is a huge keyboard button in prime spot in home row.
Contrarily, Ctrl
and Escape
are somewhere far in corners.
It’s no wonder why Emacs people like to remap Ctrl
to CapsLock
to avoid “Emacs pinky”.
Vim people do the same, but for Escape
key.
For a long time I was tempted to do the remap. However, I never did it because I didn’t want hassle of using different keyboard layouts. I want all my keyboards to be as identical as possible. That’s why I use ThinkPad USB keyboard.
Then I got a new work laptop. Unfortunately Dell has “wrong” order of keys, and it’s not even user customizable.
Keyboard | Corner | Next | Swappable |
---|---|---|---|
Dell laptop | Ctrl |
Fn |
❌ |
ThinkPad laptop | Fn |
Ctrl |
✅ |
ThinkPad USB keyboard | Fn |
Ctrl |
❌ |
This is a perfect opportunity to jump into custom key remapping, because I need identical layout in all keyboards.
Configuration 🔗
First I created following ~/.Xmodmap
file:
|
|
In iw3m
I have mode based “vim-grammar-like” setup to perform actions with key combinations.
Maybe later more about it.
However, my mode configuration in there:
bindsym k exec --no-startup-id "xmodmap ~/.Xmodmap", mode "default"
I.e., key remap (idempotent) happens by typing S-m
q
k
.
Result 🔗
It took only 1 day from muscle memory to learn the new place of Ctrl
.
I expected it to take longer because I’ve been hitting the “standard” Ctrl
position for almost 30 years.
I really recommend everyone to utilize CapsLock
for something else.
It’s really enjoyable to use it. 💖
Next steps 🔗
Keyboard modifications are device specific and without persistence.
I use USB switch with 3 computers and devices are often reconnected.
Next I have to figure out the least hacky way to implement automated xmodmap execution on keyboard connection.
Maybe with udev
rule, lets see.
Update on July 17, 2021: Automatic xmodmap on keyboard connection