123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/bin/sh
-
- echo "hello am facewaiter $$"
-
- keyboard="AT Translated Set 2 keyboard"
- battery="/sys/class/power_supply/BAT0"
- device=2
- faces="faces"
-
- matchpid=
- cleanup() {
- if [ -n "$matchpid" ]; then
- kill "$matchpid"
- fi
- exit 1
- }
- trap cleanup SIGTERM
-
- if [ -n "$battery" ]; then
- st="$(cat "$battery/status")"
- if [ "$st" != "Discharging" ] && [ "$st" != "Unknown" ]; then
- ./facematcher.py match --delay 500 --device "$device" $faces/$USER/*
- exit $?
- fi
- fi
-
- rm -f .testfifo
- mkfifo .testfifo
- xinput test "AT Translated Set 2 keyboard" \
- | grep --line-buffered "key press 36" > .testfifo &
- xpid=$!
-
- rm -f .matchfifo
- mkfifo .matchfifo
- ./facematcher.py match --delay 500 --device 2 --waitfor start $faces/$USER/* <.matchfifo &
- matchpid=$!
-
- read <.testfifo
- echo start > .matchfifo
-
- kill $xpid
- wait
-
- rm -f .testfifo
- rm -f .matchfifo
|