How to make "xset s off" survive a reboot (12.04)

On an almost fresh install of Ubuntu 12.04, after disabling screen turning off, screen lock, and suspension on inactivity from all the (two) places one can find under Ubuntu's System Settings, the screen still turns black after some minutes of inactivity. I can't tell for sure whether it only becomes blank/black or turns off.

I've uninstalled gnome-screensaver, which didn't change anything.

Of the several answers I found out there (most of which I didn't try because they were either unclear or reported to not work for everybody), I tried one that DID work:

sudo xset s off

After which I left the computer unattended for hours and the screen never turned black, so it definitely worked.

However, it does not survive a reboot. After reboot, screen starts turning black again after N minutes of inactivity.

Given that xset s off does work until reboot, how do I make that setting permanent?

I guess I could create a script that runs at startup issuing that command, but I think that would be a horrible hack and there should be a cleaner way to accomplish this.


Solution 1:

Just add it to your .xsessionrc or .xinitrc file.

Solution 2:

If you have admin rights, you can make the setting system-wide in the Xorg server configuration files with option BlankTime, for example by creating /etc/X11/xorg.conf.d/50-my-screensaver.conf:

Section "ServerFlags"
    Option "BlankTime"  "0"
EndSection

Note that the time unit here is minutes, not seconds as with xset, and that 0 means off.

More information about corresponding options between xset and the Xorg configuration (DPMS as well, for example) can be found in the manual page for xorg.conf.

Option "BlankTime"  "time"

sets the inactivity timeout for the blank phase of the screensaver. time is in minutes. This is equivalent to the Xorg server's -s flag, and the value can be changed at run-time with xset(1). Default: 10 minutes.

-- man xorg.conf (Xorg X server 1.20.4)