I run Openbox/LXDE on a somewhat special platform (a Banana Pi Pro) which doesn't have DPMS support. I have to run specific commands to put my HDMI screen to standby and switch it back on. My scripts work nicely when called directly, and now I want to call them the same way a screensaver is called: one script (let's call it screen_save) is to be called after X minutes of inactivity and another script (screen_restore) is to be called on an input event, provided screen_save was called in between this input event and the previous one.

Do I have to write a daemon similar to xscreensaver which monitors the input and calls my scripts when necessary, or is there an existing screensaver daemon which could be configured to call my scripts? Or maybe there's a hook to xorg, openbox or lxde which I could use?

1 Answer 1


There is xautolock which can start a script after some idle time.

It is used like this

xautolock -time "$MINUTES" -locker "$SCRIPT"

It is supposed to be used with xlock which can lock the screen and starts a screensaver.

Since you need to deactivate the screen when the timeout is reached and reactivate it when you move the mouse or press any key. You could do something like this

xlock -nolock -mode blank -mousemotion

The xlock process runs with a blank screen until the mouse is moved or a key is pressed and then it should reactivate your screen.

To start it for Openbox you can add

xautolock -time 10 -locker "screen_lock"&

to your ~/.config/openbox/autostart. Don't forget the &.

  • This answer looks very promising, I will try it out this evening. The only thing I worry about is whether running mplayer will be considered as activity or not. Sep 14, 2015 at 7:49
  • 1
    @DmitryGrigoryev Why mplayer? You mean when you run mplayer if it stops xautolock from locking the screen? Good question I have not tried it. I only use it to lock my screen when I'm gone from my work computers. Sep 14, 2015 at 9:11
  • 1
    FYI, your solution works fine, and playing a video with mplayer is considered as activity, so screen blanking doesn't get in the way. Note that I had to add -noclose option, otherwise my screensaver script doesn't get any stdout and fails to run some command-line utilities which output info on stdout. Sep 16, 2015 at 22:39

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.