summaryrefslogblamecommitdiffstats
path: root/sample_configuration/kb-unlock.sh
blob: 5f19c62ab2865836b44bca2261d3dac18ad65f1b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

           












                                                  


                               
                         
    

    
                
 
      
#!/bin/bash

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 enable "$id" &
done

wait
rm -rf -- "$TMP"

exit 0