3

This has been asked many times, but never answered.

14.04

Currently there is a function to automatically switch off the screen after the computer has been idle for x minutes.

This setting will apply equally whether the computer is running on battery or is plugged in.

A lot of people will want to have this setting only apply when the computer is running on battery.

Is there any way to set this setting separately depending on whether the computer is on battery power or plugged in?

Fiksdal
  • 2,121

2 Answers2

1

According to this answer in How to stop automatic brightness change while on battery?, there are two settings available through dconf-editor (accessible by installing dconf-tools):

  • idle-dim-ac
  • idle-dim-battery

Separately setting these values should allow the idle to only occur when on battery, rather than on AC.

Note: From comments on the answer, these options were not available in 14.04 at the time, but this may have been fixed.

Alternatively (from Terminal command for checking/unchecking “Dim screen to save power”?), you could write a script to enable/disable the option automatically if your computer changes from battery to AC or vice-versa (script copied ad verbatim from original answer):

#!/bin/bash
while true
do
    if on_ac_power; then
        gsettings set org.gnome.settings-daemon.plugins.power idle-dim true
    else
        gsettings set org.gnome.settings-daemon.plugins.power idle-dim false
    fi
    sleep 60   # check the state in each 60 seconds
done

Save the script.ex: dimscreen.sh and run it by typing sh /path/to/dimscreen.sh in Terminal.

1

As of GNOME 3.22, you can set two keys in dconf-editor:

org.gnome.settings-daemon.plugins.power.sleep-inactive-ac-type
org.gnome.settings-daemon.plugins.power.sleep-inactive-battery-type

You can set the first one to 'nothing' and the second one to 'blank'.

pomsky
  • 68,507