summaryrefslogtreecommitdiff
path: root/ar/.local/bin
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-06-11 11:56:26 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-06-11 11:56:26 +0900
commit1c23ba286200371418a4fa56d76b0889cc325f16 (patch)
treed88c321f9c2fdb7b1a867262acfe5e20cb547674 /ar/.local/bin
parentd5290a021b8fc91ed6d128e906b95ae0c1fdcc0b (diff)
modified bin/remapd
Diffstat (limited to 'ar/.local/bin')
-rwxr-xr-xar/.local/bin/remapd18
1 files changed, 16 insertions, 2 deletions
diff --git a/ar/.local/bin/remapd b/ar/.local/bin/remapd
index f669b0c..10c07b2 100755
--- a/ar/.local/bin/remapd
+++ b/ar/.local/bin/remapd
@@ -1,8 +1,22 @@
#!/bin/bash
-# Rerun the remaps script whenever a new input device is added.
+device_ids() { xinput list --id-only 2>/dev/null | sort; }
-while :; do
+run_remaps_settled() {
+ before=$1
+ i=0
+ while [ "$i" -lt 15 ]; do
+ [ "$(device_ids)" != "$before" ] && break
+ sleep 0.1
+ i=$((i + 1))
+ done
+ sleep 0.3
remaps
+}
+
+remaps
+while :; do
+ before=$(device_ids)
grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb)
+ run_remaps_settled "$before"
done