Clean up remapd

I found a much better way of doing this, without a potentially too short sleep. This script waits for an input to be added, and then waits for a usb device to be bound. The remaps script can be run as soon as the USB device is bound. These changes should improve the reliability of the script and maybe even decrease latency.
This commit is contained in:
snailed 2023-02-09 09:23:22 +00:00 committed by GitHub
parent 54c46c523b
commit cc53f7be1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,10 @@
# Rerun the remaps script whenever a new input device is added. # Rerun the remaps script whenever a new input device is added.
trap "rm -f /tmp/udev_pipe" HUP INT QUIT ILL TRAP BUS TERM
mkfifo -m 600 /tmp/udev_pipe
udevadm monitor -u -t seat -s input -s usb >>/tmp/udev_pipe &
while :; do while :; do
remaps grep -q "add" /tmp/udev_pipe && grep -q " bind" /tmp/udev_pipe
dmesg -W -f kern | grep "input:" -q remaps us:dvorak
sleep 1
done done