diff --git a/src/xlock b/src/xlock index 58112f8..4f31d43 100644 --- a/src/xlock +++ b/src/xlock @@ -3,8 +3,16 @@ screenshot_f="/tmp/.lock.screenshot.png"; unlock_f="`mktemp --suffix=.xlock`"; log_b="0"; + +# lock by default rm "$unlock_f"; +# automatic unlock if booted less than 2mins ago +onboot=`echo "$(cat /proc/uptime | awk '{print $1}') > 1000;" | bc`; +if [ "$onboot" -gt 0 ]; then + touch "$unlock_f"; +fi; + while true; do # if lock file -> wait until it is deleted