fix no auto-lock on boot

This commit is contained in:
xdrm-brackets 2019-03-24 16:54:54 +01:00
parent fcaf355723
commit cba3ba4b3b
1 changed files with 10 additions and 6 deletions

View File

@ -4,13 +4,17 @@ 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";
# returns whether the computer has just booted a few minutes ago
booted(){
# onboot=`echo "$(cut -d' ' -f1 /proc/uptime) > 1000;" | bc`;
return echo "$(cut -d' ' -f1 /proc/uptime) > 1000;" | bc;
}
# lock by default (if not just booted)
if [ "$(booted)" -ne 1 ]; then
rm "$unlock_f";
fi;
while true; do