#!/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