TIP: how to change CAPS as an additional ESC on any GNU Linux with Xorg
Time to time I install a new GNU Linux distro. One of the things I used to do the most is to setup my keyboard layout. Why? Because I'm a VIM user. Any vim user knows that ESC key is the most used one on this editor, since it's the gateway between the vim command prompt and other modes on the tool. (like "Insert" or "Visual" for instance)
Since it's widely used, we used to gain some speed if this key was reachable more easily. My pink finger is pretty close to Caps, so why not to map to it as an ESC? Try to tap on original ESC with your pinky finger. Now try to do the same with Caps. Isn´t more comfy? If you think so, go ahead. 🙃
Could you change ESC key from VIM directly, couldn't you?
Yes, but the point here is to map globally to every application that needs ESC, so you can create a muscle memory, turning things easier.
Also some well known Desktop Environment, like GNOME or KDE Plasma already have GUI for that, which is pretty neat. The focus here is to aim to less known (or even that ones that don´t have a GUI for configuration like this below)
Ok. How?
In order to achieve this, simply edit a file on your environment at /etc/X11/xorg.conf.d/00-keyboard.conf adding the following content:
Restart your Xorg (or your GNU Linux machine, if you want, and voilà: ESC will be changed with Caps Lock.
REMARK ⚠️: The key that makes the magic is only the line number 5: XkbOptions. Probably you will have this file on your operating system. So you just need to append this particular XkbOption on yours.
Conclusion and extra reading
It's pretty simple to perform a small change on your keyboard behavior on GNU Linux with graphical interface. Also if you with to append more than one XkbOptions you just need to append it splitted with commas (e.g. "lv3:ralt_switch,compose:caps"
Link Here )
Reference
https://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.html
https://wiki.archlinux.org/title/Xorg/Keyboard_configuration#Frequently_used_XKB_options
If you have any questions on this, let me know on comments. Have a good one!