How to control LightDM power saving preferences?

Solution 1:

This is a confirmed bug:

  • https://bugs.launchpad.net/ubuntu-power-consumption/+bug/1245474
  • https://bugs.launchpad.net/ubuntu/+source/unity-greeter/+bug/1237372
  • and others

And bugs, generally, are off-topic here.

Anyway, I found the following workaround (comment #33 related to the bug #1245474) which works for me:

[...]I've added a script to handle turning off the X dpms timeouts when the user logs in. Here are the three files that I've created. First, the config file:

/etc/lightdm/lightdm.conf.d/50-dpms.conf

[SeatDefaults] 
display-setup-script=/etc/lightdm/dpms-enable
session-setup-script=/etc/lightdm/dpms-disable

Make sure the above is owned by root. Easiest is to create it with sudoedit.

Next are the two scripts. These need to be owned by root and made executable (chmod +x).

/etc/lightdm/dpms-enable

#!/bin/sh

(
    # This delay is required. Might be because the X server isn't
    # started yet.
    sleep 10

    # Set up a 5 minute timeout before powering off the display.
    xset dpms 0 0 300 
) &

/etc/lightdm/dpms-disable

#!/bin/sh

(
    # This delay is required. Might be because the X server isn't
    # started yet.
    sleep 10

    # Turn off X's handling of dpms timeout. Otherwise
    # gnome-settings-daemon and gnome-screensaver will fight over it.
    xset dpms 0 0 0 
) &

Given the above, I get monitor power-down at the login screen, and the dpms timeouts are set to zero for a user session, so the screensaver works properly.

Solution 2:

I created a file in /etc/lightdm/lightdm.conf.d/ named 50-dpms.conf.

[SeatDefaults]
display-setup-script=/usr/local/bin/dpms-start

The dpms-start file is a script that lets user lightdm enable dpms.

#!/bin/sh
sudo xhost +si:localuser:lightdm # creates a user 'lightdm'
sudo su lightdm -s /bin/bash <<HERE # lightdm starts dpms from HERE
/usr/bin/xset +dpms
exit
HERE # and stops at this HERE

Be sure to type sudo chmod +x /etc/lightdm/lightdm.conf.d/dpms-start to make it executable. In Ubuntu 14.04 I use this with both Unity and Cinnamon and Unity-Greeter for lock screen. I don't use Synergy for multiple displays in lightdm. Another way would be to add root to the lightdm group in /etc/group. That would eliminate the need to create the lightdm user in dpms-start.