do not lock on start if just booted (less than 2 minutes ago)

This commit is contained in:
Adrien Marquès 2019-03-14 09:06:52 +01:00
parent 725454828c
commit fcaf355723
1 changed files with 8 additions and 0 deletions

View File

@ -3,8 +3,16 @@ screenshot_f="/tmp/.lock.screenshot.png";
unlock_f="`mktemp --suffix=.xlock`"; unlock_f="`mktemp --suffix=.xlock`";
log_b="0"; log_b="0";
# lock by default
rm "$unlock_f"; 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 while true; do
# if lock file -> wait until it is deleted # if lock file -> wait until it is deleted