I have a slightly different way of using xautolock: After I lock the screen (using i3lock in my case), I want the display to turn off after some period of time of inactivity. AND I want it to re-turn off if it detects activity, turns on the screen, but the computer isn't unlocked.
Here is the script I have:
/bin/bash
function lockfunc {
if [[ "$1" = -sleep ]]; then
i3lock -t -i $backgroundimg && xautolock -time 1 -locker 'xset s activate' &
while [[ $(pgrep -x i3lock) ]]; do # loop while computer is locked
echo $(date) '| i3lock running'
if [[ $(pgrep -x xautolock) ]]; then echo $(date) '| xautolock running'; fi
# if $(pgrep -x xautolock); then echo $(date) '| i3lock running'; fi
sleep 5
done
echo $(date) '| exit i3lock while loop'
xautolock -exit # stop xautolock when unlocked
else
i3lock -t -i $backgroundimg
fi
return 0}
lockfunc -sleep
While the behavior mostly works, the huge issue right now is that after (exactly) one minute of the screen being off, it turns back on without any interaction.
Behavior timeline:
00:00 -> start the lockfunc
01:00 -> screen turns off
02:00 -> screen turns on
07:00 -> screen doesn't turn back off, stop test
The debug echo statements in the script above didn't really show anything changing during that time: both i3lock and xautolock were still running the whole time.
Any ideas why this is happening?