Disable screensaver / screen blank via command line?

9

6

I am attempting to disable screensaver, screen blank and screen lock via the command line. This is because the settings will be applied in an unattended install.

From my own research this appears to be possible through xorg.conf.

I have tried setting:

Section "ServerFlags"
    Option          "BlankTime" "0"
    Option          "StandbyTime" "0"
    Option          "OffTime" "0"
    Option          "SuspendTime" "0"
EndSection

Also:

Option "DPMS" "false"

in the Monitor section.

But even with these settings, when the machine is inactive for a period of time, the screen blanks and shortly after locks (password is required to disable screen blank).

Can someone please point me in the right direction?

I am running the XFCE spin of Fedora 19

dooffas

Posted 2013-09-13T09:57:45.370

Reputation: 365

Answers

13

You can use the xset command to disable screen blanking and locking.

E.g.

xset s off (turns off the screen saver)

xset s noblank (turns off blanking)

You can also use it to disable the power management using dpms to power the monitor down

xset -dpms

I use these commands in a script set to run at login to stop the screen blanking on my MythTV machine.

EDIT:

Script I mentioned:

#!/bin/sh
export DISPLAY=:0.0
xset s off
xset s noblank
xset -dpms

hardillb

Posted 2013-09-13T09:57:45.370

Reputation: 390

which of these actually controls just the lock screen part? – Michael – 2019-09-21T23:57:19.103

I tried these commands, but unfortunetly, with no joy: xset -dpms
xset s 0 0
xset s off
xset s noblank
– dooffas – 2013-09-13T11:27:09.977

Ok, so it does appear that those commands do work, when run on the local machine not via SSH. I have these commands in a script that is loaded on boot, however again they do not seem to work. How do you have your script? – dooffas – 2013-09-13T13:42:59.340

Ahh, yeah, the trick will be to make sure the DISPLAY var is set to :0.0 (rather than the forwarded version that ssh will set up), I'll edit the answer to add the script so it should keep the formatting – hardillb – 2013-09-13T21:38:20.703

I have now managed to get this to work, however I had to add a sleep to the start of the script, otherwise it did not appear to have any affect. I presume this is due to the x session not being fully started before the script is run. – dooffas – 2013-09-16T09:38:22.840