Skip to main content
Nordlys logo, simplified northern lights aurora visualization Matt Ellis

Back to all posts

Remapping keys on Linux

Published on by Skux4life · 2 min read

So… I use Arch btw. Though remapping keys is not a problem unique to Arch Linux, it is the first time I needed to think about it after using more user-friendly distros in the past.

I always like to have Capslock remapped to Ctrl. I use this all the time so it is very jarring when this isn’t configured!

On Arch Linux I had been using evremap as it was designed to be used with wayland. Overall it was pretty good. However, it would occasionally stop working and I would have to restart the service. This was bearable. What actually made me seek an alternative was the issues I had once I started using a KVM switch (to make switching between my work Macbook and my Linux PC smooth).

Whenever I’d use the switch then evremap would need to be restarted (systemctl restart) to work again. I’m not exactly sure what was going on. The KVM switch disconnects and reconnects the keyboard and evremap isn’t aware of this.

So I found a better solution for me. keyd

I haven’t had any of the issues that I had with evremap. I’ve not needed to restart it once since I’ve begun using it! I think due to keyd being built to always watch /dev/input. This means when the KVM switch is used it notices the disconnect and reconnect of the device and re-attaches automatically.

It was incredibly easy to install and configure. Whilst I wouldn’t say evremap was hard, it definitely took a bit more work to get it all working.

Terminal window
# install with yay
yay -S keyd
# enable with systemd
sudo systemctl enable --now keyd

My very basic config file

/etc/keyd/default.conf
[ids]
*
[main]
capslock = leftcontrol

You can also do much more elaborate remappings with keyd. It will now be one of the first things I install whenever I configure a new Linux desktop system.