]> git.sthu.org Git - shutils.git/commitdiff
udev: Add xprofile-udevinput-monitor
authorStefan Huber <shuber@sthu.org>
Sun, 17 Dec 2023 19:25:55 +0000 (20:25 +0100)
committerStefan Huber <shuber@sthu.org>
Sun, 17 Dec 2023 19:25:55 +0000 (20:25 +0100)
udev/input/install.sh [new file with mode: 0644]
udev/input/xprofile-udevinput [new file with mode: 0755]
udev/input/xprofile-udevinput-monitor [new file with mode: 0755]
udev/input/xprofile-udevinput-monitor.service [new file with mode: 0644]

diff --git a/udev/input/install.sh b/udev/input/install.sh
new file mode 100644 (file)
index 0000000..59b4c22
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cp ./xprofile-udevinput ~/.xprofile-udevinput
+echo "You may source ~/.xprofile-udevinput in your ~/.xinitrc or so"
+
+cp ./xprofile-udevinput-monitor ~/.local/bin/
+cp ./xprofile-udevinput-monitor.service ~/.config/systemd/user/
+systemctl --user daemon-reload
+
+echo "You may call systemctl --user enable xprofile-udevinput-monitor.service"
diff --git a/udev/input/xprofile-udevinput b/udev/input/xprofile-udevinput
new file mode 100755 (executable)
index 0000000..9664326
--- /dev/null
@@ -0,0 +1,7 @@
+#!bin/sh
+# Load this script whenever a USB keyboard is attached
+
+xset r rate 200 60
+
+# Barrier needs this on client and server side
+setxkbmap -device `xinput list --id-only "Virtual core XTEST keyboard"` de
diff --git a/udev/input/xprofile-udevinput-monitor b/udev/input/xprofile-udevinput-monitor
new file mode 100755 (executable)
index 0000000..e48d1ac
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+# For each add-event of input subsystem by udev call ~/.xprofile-keyboard
+udevadm monitor -u -s input | grep --line-buffered add | while read line; do
+       echo ">> $line";
+       sh ~/.xprofile-udevinput
+done
+
diff --git a/udev/input/xprofile-udevinput-monitor.service b/udev/input/xprofile-udevinput-monitor.service
new file mode 100644 (file)
index 0000000..09725fb
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=xprofile-udevinput-monitor daemon
+After=multi-user.target
+
+[Service]
+Environment=DISPLAY=:0
+ExecStart=%h/.local/bin/xprofile-udevinput-monitor
+Restart=always
+RestartSec=10min
+
+[Install]
+WantedBy=default.target