Improve remapd detection

Previously remapd would trigger whenever a USB device was attached. This patch changes that to only trigger the script when the output of `xinput --list` changes. This has the added bonus of making the script posix compliant.
This commit is contained in:
snailed 2023-12-13 14:27:38 +01:00 committed by GitHub
parent 0795202675
commit ad9f509871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,8 @@
#!/bin/bash
#!/bin/sh
# Rerun the remaps script whenever a new input device is added.
while :; do
remaps
grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb)
watch -n1 -g xinput --list
done