keyd is A key remapping daemon for linux.

Install

sudo pacman -S keyd

Enable and Start

sudo systemctl enable keyd
sudo systemctl start keyd

Config

Put the following in /etc/keyd/default.conf:

[ids]

*

[main]

# Maps capslock to escape when pressed and control when held.
capslock = overload(control, esc)