diff options
Diffstat (limited to 'bin/xorg_autolock')
-rwxr-xr-x | bin/xorg_autolock | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/xorg_autolock b/bin/xorg_autolock new file mode 100755 index 0000000..5f7199a --- /dev/null +++ b/bin/xorg_autolock @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -euo pipefail + +lock=${XDG_RUNTIME_DIR}/xorg_autolock.lock +lock_block=${XDG_RUNTIME_DIR}/xorg_autolock_block +lockafter=600000 + +rm ${lock} ${lock_block} + +while [ 1 ]; do + if [ ! -f ${lock} -a ! -f ${lock_block} ];then + if [ -x "/usr/bin/xssstate" ]; then + if [ $(xssstate -i) -ge $lockafter ]; then + $HOME/bin/xorg_lock + fi + else + echo "xssstate is note installed!" + exit 1 + fi + fi + + sleep 1 +done |