9

People have asked how to disable the screen from going blank or to sleep, but I have a slightly different question. I would like to be able to remotely wake a sleeping or blank display, but then allow it to go blank again. So far this isn't working.

I've set export DISPLAY=:0 in my .bashrc file and, when the screen goes blank, I run xset s reset over SSH. What I've noticed is that the screen "wakes up", but that it will never go blank again. I'd like to re-enable the default behavior after calling the reset command. Should I just set up the timeout again or is there a different way I should be waking the display? I'm just curious why reset changes the behavior.

3
  • Can't you just simulate a key press?
    – avra
    Commented Aug 29, 2013 at 9:21
  • Any advice on how I would do that? Commented Aug 29, 2013 at 13:03
  • Default raspbian that I have doesn't seem to have xset any other options, or do I need to apt-get it?
    – dlamblin
    Commented Nov 17, 2013 at 20:59

4 Answers 4

9

You have to define which display to use first :

export DISPLAY=:0
xset s reset

Hope this helps

2
  • Is there a reason I can't use those two lines in a shell script? When running only those two lines, I get: ["set: unable to open display ":0]
    – Bort
    Commented Sep 24, 2016 at 11:30
  • 1
    The bash one liner: DISPLAY=:0 xset s reset
    – estani
    Commented Apr 19, 2017 at 11:26
4

That's happening because your monitor turns off after 10 minutes as well by default. And even if you reset by xset s reset, screensaver won't be effective as it assumes that your monitor is already off. You can confirm this behaviour by xset q

So solution ? : here : xset s reset && xset dpms force on

This should work effectively.

For more information (and detailed), read xset man entry. man xset and this.

This is probably a very old question (2 years old), but I was trying to achieve the same and stumbled across this. I thought of contributing what I found.

Hope it helps.

1
  • @GrandAdmiral - I just confirmed this on my Pi 3 today. This is the best answer. Keep in mind too what Steven Luong C said: use "export DISPLAY=:0"
    – Bort
    Commented Sep 25, 2016 at 11:57
3

From the man page:

The 'on/off' flags simply turn the screen saver functions on or off. The 'activate' flag forces activation of screen saver even if the screen saver had been turned off. The 'reset' flag forces deactivation of screen saver if it is active.

So reset means deactivate, not reset to default.

3
  • Right, I understand that 'reset' deactivates the screen saver. The problem is that the screen saver never re-activates again. For example: 1. Startx 2. Wait ten minutes and screen saver activates 3. Run 'xset s reset' and screen saver deactivates 4. Wait ten minutes or more 5. Screen saver does not re-activate. I would like to get back to the default behavior of activating the screen saver after running 'xset s reset'. Commented Aug 28, 2013 at 14:17
  • xset s reset && xset s activate?
    – M Noit
    Commented Aug 29, 2013 at 8:38
  • 1
    xset s activate immediately activates the screen saver without any delay. Commented Aug 29, 2013 at 13:05
2

The solution of dhruvvyas90 works:

xset s reset && xset dpms force on

but this shorter version also seems to work fine:

xset dpms force on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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