Tiny background utility for mapping Esc key to CapsLock key. Just like xcape but for X11 and Wayland.
caps-esc /dev/input/event<x>
where x
corresponds to the keyboard device event input.
sudo dnf install -y libevdev-devel
cd caps-esc
zig build -Drelease
sudo install -s ./zig-out/bin/caps-esc /usr/local/bin
Create systemd unit file /etc/systemd/system/[email protected]
[Unit]
Description=Remap Esc key to CapsLock
#BindsTo=sys-devices-virtual-input-%i.device
#After=sys-devices-virtual-input-%i.device
StopWhenUnneeded=true
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/caps-esc /dev/input/%i
Create udev rules /etc/udev/rules.d/99-caps-esc.rules
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", ENV{ID_INPUT_KEYBOARD}=="1", \
ENV{DEVPATH}!="/devices/virtual/input/*", ENV{SYSTEMD_ALIAS}+="/sys/devices/virtual/input/%k", \
OWNER="root", TAG+="systemd", ENV{SYSTEMD_WANTS}="caps-esc@$kernel.service"
Initialize and run
$ sudo systemctl daemon-reload
$ sudo udevadm control --reload
$ sudo udevadm trigger --action=add
Check the status
$ systemctl status caps-esc@\*.service
Getting some device information
lsusb
udevadm info -a -n /dev/input/event<x>