summaryrefslogtreecommitdiffstats
path: root/sample_configuration/kb-unlock.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sample_configuration/kb-unlock.sh')
-rwxr-xr-xsample_configuration/kb-unlock.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/sample_configuration/kb-unlock.sh b/sample_configuration/kb-unlock.sh
index c123414..5f19c62 100755
--- a/sample_configuration/kb-unlock.sh
+++ b/sample_configuration/kb-unlock.sh
@@ -1,12 +1,25 @@
#!/bin/bash
-# use xinput to get all keyboards and pointers (mouse)
-keyboards=$(xinput --list | grep -E "slave.*(keyboard|pointer)" | cut -f2 | cut -d'=' -f2)
+TMP="${XDG_RUNTIME_DIR:-"/run/user/$UID"}/pvslock"
+for i in 10 20 40 80 160 320 0; do
+ if unlink "$TMP/done"; then
+ keyboards=$( cat "$TMP/locked" )
+ break
+ fi
+ [ -d "$TMP" ] || exit 0
+ usleep ${i}000
+done
+if [ "$i" = 0 ]; then
+ echo "locked, raced"
+ exit 0
+fi
for id in $keyboards; do
echo "enabling device #$id"
- xinput --set-prop $id "Device Enabled" 1 &
+ xinput enable "$id" &
done
wait
+rm -rf -- "$TMP"
+exit 0