Why does desktop locking stop working after some time?

For me, the xautolock process was still running in the background, but it wasn't listening to any xautolock -locknow commands. As mentioned by @jrm, an application must be suppressing the "screensaver". For both of us, this was due to mpv (video player) disabling the screensaver.

For mpv, the fix is to add the following to ~/.config/mpv/config or ~/.mpv/config:

stop-screensaver=no

If you do not use mpv, it might be another application disabling the screensaver. Try some commonly used ones out to see which one it is.


If you want to prevent automatic screen locking during video playback, one common way is to use xautolock's "corners" feature:

xautolock -corners 000- -cornersize 30

With the above command, if you put your mouse cursor in the bottom right corner of the screen (within a 30px radius), auto-locking will be temporarily disabled.


One more thing to try is the -resetsaver option:

xautolock -resetsaver

Or the -detectsleep option:

xautolock -detectsleep