From 8a101b9fddfa5f1ddaa34aa66c05155a46669f36 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 23 Feb 2024 02:12:28 -0500 Subject: convert watch-kbd to systemd --- local/.bin/hornet/setup-inputs | 4 ++-- local/.bin/hornet/watch-kbd | 4 ++-- local/.config/systemd/user/watch-kbd.service | 5 +++++ local/.services/available/watch-kbd/log/run | 4 ---- local/.services/available/watch-kbd/run | 3 --- local/Makefile | 9 +++++++-- 6 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 local/.config/systemd/user/watch-kbd.service delete mode 100755 local/.services/available/watch-kbd/log/run delete mode 100755 local/.services/available/watch-kbd/run diff --git a/local/.bin/hornet/setup-inputs b/local/.bin/hornet/setup-inputs index 572feb1..cd1b4cf 100755 --- a/local/.bin/hornet/setup-inputs +++ b/local/.bin/hornet/setup-inputs @@ -14,5 +14,5 @@ xinput set-prop "$touchpad" "libinput Accel Speed" 0.4 xinput set-prop "$touchpad" "libinput Tapping Enabled" 1 # needs to happen after xmodmap stuff -svre xcape -svre xbindkeys +systemctl --user restart xcape +systemctl --user restart xbindkeys diff --git a/local/.bin/hornet/watch-kbd b/local/.bin/hornet/watch-kbd index a4d504e..269213e 100755 --- a/local/.bin/hornet/watch-kbd +++ b/local/.bin/hornet/watch-kbd @@ -4,10 +4,10 @@ set -o pipefail trap 'kill $(jobs -p)' EXIT -inotifywait -mq -e create -e delete -e moved_to --exclude '.*tmp.*' /dev/input/by-id/ | +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_Keyboard; then + if echo "$event" | grep -q -- '-usb.*-kbd'; then setup-inputs fi done & diff --git a/local/.config/systemd/user/watch-kbd.service b/local/.config/systemd/user/watch-kbd.service new file mode 100644 index 0000000..aa9dc8e --- /dev/null +++ b/local/.config/systemd/user/watch-kbd.service @@ -0,0 +1,5 @@ +[Service] +ExecStart=%h/.bin/%H/watch-kbd + +[Install] +WantedBy=default.target diff --git a/local/.services/available/watch-kbd/log/run b/local/.services/available/watch-kbd/log/run deleted file mode 100755 index 8b56264..0000000 --- a/local/.services/available/watch-kbd/log/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -eu - -exec multilog t s16777215 "$HOME/.log/watch-kbd" diff --git a/local/.services/available/watch-kbd/run b/local/.services/available/watch-kbd/run deleted file mode 100755 index f964c1a..0000000 --- a/local/.services/available/watch-kbd/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec watch-kbd 2>&1 diff --git a/local/Makefile b/local/Makefile index 6684014..a16e3bc 100644 --- a/local/Makefile +++ b/local/Makefile @@ -1,4 +1,9 @@ include ../Makefile.include -install: $(HOME)/.services/enabled/watch-kbd - @mkdir -p $(HOME)/.log/watch-kbd +install: + @systemctl --user enable watch-kbd + @systemctl --user start watch-kbd + +uninstall: + @systemctl --user stop watch-kbd + @systemctl --user disable watch-kbd -- cgit v1.2.3-54-g00ecf