summaryrefslogtreecommitdiffstats
path: root/laptop/.bin/watch-kbd
blob: 269213ee96e28e57bf3575b04dbf612104b4c136 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
set -eu
set -o pipefail

trap 'kill $(jobs -p)' EXIT

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.*-kbd'; then
            setup-inputs
        fi
    done &
wait