Skip to content

styblope/caps-esc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caps-esc

Tiny background utility for mapping Esc key to CapsLock key. Just like xcape but for X11 and Wayland.

Usage

caps-esc /dev/input/event<x>

where x corresponds to the keyboard device event input.

Building and installation

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/caps-esc@.service

[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>

References

Credits

Inspired by osm and xcape

About

Map Esc to CapsLock key

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published