From fcaf355723be9c334648894a8af5066bbc923f03 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 14 Mar 2019 09:06:52 +0100 Subject: [PATCH] do not lock on start if just booted (less than 2 minutes ago) --- src/xlock | 8 ++++++++ 1 file changed, 8 insertions(+) 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