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)

My KDE Plasma System Settings -> Keyboard -> Advanced (Taken on Jan 17th, 2022)

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!

--

--

--

Developer, Amateur Musician, Self taught

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

MacPy3D — 3D Model As Code for Python

Set Default Version of Python : [SOLVED] update-alternatives: error: no alternatives for python3

Distributed Replication — Single Leader Replication (Part2)

Black Friday / Cyber Monday / Cyber 5 — is it a Big Deal for your DevOps team?

Roles in Pair-Programming Across Skill: Leader/Adopter Model

Agile Retrospective: The What, Why, and How (Quick Guide)

Best Practices in API Design

Third Phase — Midpoint Progress in the journey

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jonhnatha Trigueiro

Jonhnatha Trigueiro

Developer, Amateur Musician, Self taught

More from Medium

QR code reader for OS X via Terminal

EIGRP Static Neighbor

Configuring Basic DHCPv4 on a Router

Ansi-color.cmd: Is Windows Batch Scripting a Programming Language?

A grid of foreground and background colors showing the resulting combinations