mirror of
https://github.com/moparisthebest/uinput-mapper
synced 2024-12-11 23:52:16 -05:00
Add example systemd jobs
This commit is contained in:
parent
1dcc695e63
commit
a92bf7ec6c
9
misc/dvorak.service
Normal file
9
misc/dvorak.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Dvorak Daemon
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/root/dvorak_systemd.sh
|
||||||
|
StartLimitInterval=0
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
12
misc/dvorak_systemd.sh
Executable file
12
misc/dvorak_systemd.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
kbs=''
|
||||||
|
for input in $(ls /dev/input/event*)
|
||||||
|
do
|
||||||
|
if udevadm info -q property $input | grep ID_INPUT_KEYBOARD
|
||||||
|
then
|
||||||
|
udevadm info -a $input | grep 'keymapper input device' || kbs="$kbs $input"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exec /usr/bin/env python2 /usr/lib/uinput-mapper/input-read -d -k /etc/uinput-mapper/keymap.py $kbs
|
9
misc/kbwait.service
Normal file
9
misc/kbwait.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=kbwait Dvorak Daemon
|
||||||
|
After=dvorak.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/root/kbwait_systemd.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
16
misc/kbwait_systemd.sh
Executable file
16
misc/kbwait_systemd.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
inotifywait -m -q -e create -e delete --include '.*event[0-9]+' --format '%e-%w%f' /dev/input/ | while read event
|
||||||
|
do
|
||||||
|
|
||||||
|
# CREATE-/dev/input/event16
|
||||||
|
if echo "$event" | grep '^CREATE-'
|
||||||
|
then
|
||||||
|
input="$(echo "$event" | sed 's/^CREATE-//')"
|
||||||
|
# if it's us, ignore
|
||||||
|
udevadm info -a "$input" | grep 'keymapper input device' && continue
|
||||||
|
# if it's not a keyboard, ignore
|
||||||
|
udevadm info -q property "$input" | grep ID_INPUT_KEYBOARD || continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl restart dvorak
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user