From 7094d070e9c23ba7955aa71fa288fcb3c6d8d549 Mon Sep 17 00:00:00 2001
From: Luca Bilke <luca@bil.ke>
Date: Wed, 25 Dec 2024 11:07:56 +0100
Subject: [PATCH] remapd: fix script when running without tty

---
 common/.local/libexec/daemons/remapd | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/.local/libexec/daemons/remapd b/common/.local/libexec/daemons/remapd
index 6ea3542d..40cae1e5 100755
--- a/common/.local/libexec/daemons/remapd
+++ b/common/.local/libexec/daemons/remapd
@@ -1,5 +1,10 @@
 #!/bin/sh
+# shellcheck disable=SC2210
+
+DEBOUNCE=1
+
 while :; do
-    watch -gn1 eval 'xinput --list | grep keyboard' >/dev/null 2>&1
-    remaps -qd >/dev/null 2>&1
+    udevadm monitor -us input | timeout "$DEBOUNCE" cat
+    sleep .1
+    remaps -qd
 done