summaryrefslogtreecommitdiffstats
path: root/laptop/.bin/watch-kbd
diff options
context:
space:
mode:
Diffstat (limited to 'laptop/.bin/watch-kbd')
-rwxr-xr-xlaptop/.bin/watch-kbd14
1 files changed, 14 insertions, 0 deletions
diff --git a/laptop/.bin/watch-kbd b/laptop/.bin/watch-kbd
new file mode 100755
index 0000000..269213e
--- /dev/null
+++ b/laptop/.bin/watch-kbd
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -eu
+set -o pipefail
+
+trap 'kill $(jobs -p)' EXIT
+
+inotifywait -mq -e create -e delete -e moved_to --exclude '.*tmp.*' /dev/input/by-path/ |
+ while read -r event; do
+ echo "$event"
+ if echo "$event" | grep -q -- '-usb.*-kbd'; then
+ setup-inputs
+ fi
+ done &
+wait