0

Every now and then, xscreensaver dies. When it does, my session unlocks and won't lock until I restart it. Is there a way to automatically detect that xscreensaver has died, restart it, and lock the session?

1

Instead of starting xscreensaver directly, use a wrapper script.

#!/bin/sh

prog=xscreensaver

while :
do
   $prog &
   wait
done

Run this script as you would xscreensaver, i.e. in the background, launched from .xinitrc or equivalent. If xscreensaver dies, this script will notice and immediately restart it.

  • To make this work properly, I had to add xscreensaver-command -activate after launching the program. Otherwise, if xscreensaver dies in the middle of the night, it will restart, but it won't activate. – kainaw Sep 8 '14 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.