From ad9f509871af878e7fae50de7c9b441d9272c2b6 Mon Sep 17 00:00:00 2001 From: snailed Date: Wed, 13 Dec 2023 14:27:38 +0100 Subject: [PATCH 1/3] 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. --- .local/bin/remapd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index ee4cf396..948fe662 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -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 From d9a66e1c1dd60b29514c36bf57d580ab2e21953c Mon Sep 17 00:00:00 2001 From: snailed Date: Wed, 13 Dec 2023 14:32:33 +0100 Subject: [PATCH 2/3] Update remapd --- .local/bin/remapd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index 948fe662..85c07390 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -4,5 +4,5 @@ while :; do remaps - watch -n1 -g xinput --list + watch -gn1 sh -c 'xinput --list | grep keyboard' done From 1e35ff5c7d1f4f14f23fcbd667a7117b7b70b852 Mon Sep 17 00:00:00 2001 From: snailed Date: Thu, 14 Dec 2023 09:43:23 +0100 Subject: [PATCH 3/3] Fix remapd causing hang at start --- .local/bin/remapd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/remapd b/.local/bin/remapd index 85c07390..8b1eaba9 100755 --- a/.local/bin/remapd +++ b/.local/bin/remapd @@ -4,5 +4,5 @@ while :; do remaps - watch -gn1 sh -c 'xinput --list | grep keyboard' + watch -gn1 sh -c 'xinput --list | grep keyboard' >/dev/null 2>&1 done