Difference between revisions of "Display Power Management Signaling"

From ArchWiki
Jump to: navigation, search
m (Pipe the escapes to any tty (with write/append perms) to modify that terminal: Substitute >> in place of > as it should be in th example)
m (rc.local removed. Style updates.)
Line 9: Line 9:
  
 
== Setting up DPMS in X ==
 
== Setting up DPMS in X ==
 +
 
{{Note|As of Xorg 1.8 DPMS is auto detected and enabled if ACPI is also enabled at kernel runtime.}}
 
{{Note|As of Xorg 1.8 DPMS is auto detected and enabled if ACPI is also enabled at kernel runtime.}}
 
Add the following to a file in {{ic|/etc/X11/xorg.conf.d/}} in the {{ic|Monitor}} section:
 
Add the following to a file in {{ic|/etc/X11/xorg.conf.d/}} in the {{ic|Monitor}} section:
Line 35: Line 36:
 
  EndSection
 
  EndSection
  
== Modifying DPMS and screensaver settings using xset==
+
== Modifying DPMS and screensaver settings using xset ==
It is possible to turn off your monitor using the {{ic|xset}} tool which is provided by the {{pkg|xorg-xset}} package in the [[Official Repositories]]. Note if using this command manually in a shell you may need to prefix it with {{ic|sleep 1;}} for it to work correctly. For example:
+
 
  sleep 1; xset dpms force off
+
It is possible to turn off your monitor using the ''xset'' tool which is provided by the {{Pkg|xorg-xset}} package in the [[official repositories]].
 +
{{Note|If using this command manually in a shell you may need to prefix it with {{ic|sleep 1;}} for it to work correctly. For example:
 +
  $ sleep 1; xset dpms force off
 +
}}
  
 
To control Energy Star (DPMS) features (a timeout value of zero disables the mode):
 
To control Energy Star (DPMS) features (a timeout value of zero disables the mode):
  xset -dpms Energy Star features off
+
  $ xset -dpms Energy Star features off
  xset +dpms Energy Star features on
+
  $ xset +dpms Energy Star features on
  xset dpms [standby [suspend [off]]]     
+
  $ xset dpms [standby [suspend [off]]]     
  xset dpms force standby  
+
  $ xset dpms force standby  
  xset dpms force suspend  
+
  $ xset dpms force suspend  
  xset dpms force off  
+
  $ xset dpms force off  
  xset dpms force on  (also implicitly enables DPMS features)
+
  $ xset dpms force on  (also implicitly enables DPMS features)
 +
 
 +
=== xset screen-saver control ===
  
===xset screen-saver control===
 
 
You can use xset to control your screensaver:
 
You can use xset to control your screensaver:
  xset s [timeout [cycle]]   
+
  $ xset s [timeout [cycle]]   
  xset s default     
+
  $ xset s default     
  xset s on
+
  $ xset s on
  xset s blank               
+
  $ xset s blank               
  xset s noblank     
+
  $ xset s noblank     
  xset s off
+
  $ xset s off
  xset s expose             
+
  $ xset s expose             
  xset s noexpose
+
  $ xset s noexpose
  xset s activate           
+
  $ xset s activate           
  xset s reset
+
  $ xset s reset
  
===To see your current settings===
+
=== To see your current settings ===
$ xset q
+
+
...
+
+
Screen Saver:
+
  prefer blanking:  yes    allow exposures:  yes
+
  timeout:  600    cycle:  600
+
DPMS (Energy Star):
+
  Standby: 600    Suspend: 600    Off: 600
+
  DPMS is Enabled
+
  Monitor is On
+
  
==Examples==
+
{{hc|$ xset q|
  
===Turn off DPMS===
+
...
xset -dpms
+
  
===Disable screen saver blanking===
+
Screen Saver:
  xset s off
+
  prefer blanking:  yes    allow exposures:  yes
 +
  timeout:  600    cycle:  600
 +
DPMS (Energy Star):
 +
  Standby: 600    Suspend: 600    Off: 600
 +
  DPMS is Enabled
 +
  Monitor is On
 +
}}
 +
 
 +
== Examples ==
 +
 
 +
=== Turn off DPMS ===
 +
 
 +
$ xset -dpms
 +
 
 +
=== Disable screen saver blanking ===
 +
 
 +
  $ xset s off
  
 
=== Disable DPMS and prevent screen from blanking ===
 
=== Disable DPMS and prevent screen from blanking ===
 +
 
Useful when watching movies or slideshows:
 
Useful when watching movies or slideshows:
  xset -dpms; xset s off
+
  $ xset -dpms; xset s off
 +
 
 +
=== Turn off screen immediately ===
  
===Turn off screen immediately===
 
 
If you leave your computer, you do not need to wait for the timeout you set that the display turns off. Simply enforce it by using the xset command.
 
If you leave your computer, you do not need to wait for the timeout you set that the display turns off. Simply enforce it by using the xset command.
  xset dpms force off
+
  $ xset dpms force off
 +
 
 +
=== Put screen into standby ===
 +
 
 +
$ xset dpms force standby
 +
 
 +
=== Put screen into suspend ===
 +
 
 +
$ xset dpms force suspend
  
===Put screen into standby===
+
=== Change Blank time from 5 min to 1 hour ===
xset dpms force standby
+
  
===Put screen into suspend===
+
  $ xset s 3600 3600
  xset dpms force suspend
+
  
===Change Blank time from 5 min to 1 hour===
+
=== xset display.sh ===
xset s 3600 3600
+
  
===xset display.sh===
 
 
You could also copy this script:
 
You could also copy this script:
 
{{hc|/usr/local/bin/display.sh|<nowiki>
 
{{hc|/usr/local/bin/display.sh|<nowiki>
Line 107: Line 122:
  
 
case $1 in
 
case $1 in
  standby|suspend|off)
+
    standby|suspend|off)
    xset dpms force $1
+
        xset dpms force $1
  ;;
+
    ;;
  *)
+
    *)
    echo "Usage: $0 standby|suspend|off"
+
        echo "Usage: $0 standby|suspend|off"
  ;;
+
    ;;
esac
+
  esac
 
</nowiki>}}
 
</nowiki>}}
  
Line 119: Line 134:
  
 
== DPMS interaction in a Linux console with setterm ==
 
== DPMS interaction in a Linux console with setterm ==
 +
 
The ''setterm'' utility issues terminal recognized escape codes to alter the terminal. Essentially it just writes/echos the terminal sequences to the current terminal device, whether that be in screen, a remote ssh terminal, console mode, serial consoles, etc.  
 
The ''setterm'' utility issues terminal recognized escape codes to alter the terminal. Essentially it just writes/echos the terminal sequences to the current terminal device, whether that be in screen, a remote ssh terminal, console mode, serial consoles, etc.  
  
Line 131: Line 147:
 
=== Prevent screen from turning off ===
 
=== Prevent screen from turning off ===
  
You can run this command, and add it to /etc/rc.local:
+
You can run this command:
 
+
 
  $ setterm -blank 0 -powerdown 0
 
  $ setterm -blank 0 -powerdown 0
  
 
Alternatively you can disable console blanking permanently using the following command:
 
Alternatively you can disable console blanking permanently using the following command:
  
  # echo -ne "\033[9;0]" >> /etc/issue
+
  # echo -ne "\033[9;0]" >> /etc/issue
  
 
=== Pipe the output to a cat to see the escapes ===
 
=== Pipe the output to a cat to see the escapes ===
 +
 
  $ setterm -powerdown 2>&1 | exec cat -v 2>&1 | sed "s/\\^\\[/\\\\033/g"
 
  $ setterm -powerdown 2>&1 | exec cat -v 2>&1 | sed "s/\\^\\[/\\\\033/g"
  
===Pipe the escapes to any tty (with write/append perms) to modify that terminal===
+
=== Pipe the escapes to any tty (with write/append perms) to modify that terminal ===
Note the use of '''>>''' instead of '''>'''.  For permission issues using sudo in a script or something, you can use the '''tee''' program to append the output of setterm to the tty device, which tty's let appending sometimes but not writing.
+
 
 
  $ setterm -powerdown 0 >> /dev/tty3
 
  $ setterm -powerdown 0 >> /dev/tty3
  
====Bash loop to set ttys 0-256====
+
{{Note|{{ic|>>}} is used instead of {{ic|>}}. For permission issues using ''sudo'' in a script or something, you can use the '''tee''' program to append the output of setterm to the tty device, which tty's let appending sometimes but not writing.}}
 +
 
 +
==== Bash loop to set ttys 0-256 ====
 +
 
 
  $ for i in {0..256}; do setterm -powerdown 0 >> /dev/tty$i; done; unset i;
 
  $ for i in {0..256}; do setterm -powerdown 0 >> /dev/tty$i; done; unset i;
  
Line 156: Line 175:
  
 
==== xscreensaver DPMS ====
 
==== xscreensaver DPMS ====
You can configure xscreensaver's DPMS settings manually by editing your {{ic|~/.xscreensaver}} file as below, or using the xscreensaver-demo gui.
+
 
 +
You can configure xscreensaver's DPMS settings manually by editing your {{ic|~/.xscreensaver}} file as below, or using the xscreensaver-demo GUI.
 
{{bc|
 
{{bc|
 
timeout: 1:00:00
 
timeout: 1:00:00
Line 173: Line 193:
 
}}
 
}}
  
==See also==
+
== See also ==
 +
 
 
* [http://webpages.charter.net/dperr/dpms.htm PC Monitor DPMS specification explanation]
 
* [http://webpages.charter.net/dperr/dpms.htm PC Monitor DPMS specification explanation]

Revision as of 10:15, 1 January 2014

DPMS (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use.

For details on each Timeout, see the Description section here.

Setting up DPMS in X

Note: As of Xorg 1.8 DPMS is auto detected and enabled if ACPI is also enabled at kernel runtime.

Add the following to a file in /etc/X11/xorg.conf.d/ in the Monitor section:

Option "DPMS" "true"

Add the following to the ServerLayout section, change the times (in minutes) as necessary:

Option "StandbyTime" "10"
Option "SuspendTime" "20"
Option "OffTime" "30"
Note: If the "OffTime" option does not work replace it with the following, (change the "blanktime" to "0" to disable screen blanking)
Option         "BlankTime" "30"

An example file /etc/X11/xorg.conf.d/10-monitor.conf could look like this.

Section "Monitor"
    Identifier "LVDS0"
    Option "DPMS" "false"
EndSection

Section "ServerLayout"
    Identifier "ServerLayout0"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime" "0"
EndSection

Modifying DPMS and screensaver settings using xset

It is possible to turn off your monitor using the xset tool which is provided by the xorg-xset package in the official repositories.

Note: If using this command manually in a shell you may need to prefix it with sleep 1; for it to work correctly. For example:
$ sleep 1; xset dpms force off

To control Energy Star (DPMS) features (a timeout value of zero disables the mode):

$ xset -dpms Energy Star features off
$ xset +dpms Energy Star features on
$ xset dpms [standby [suspend [off]]]     
$ xset dpms force standby 
$ xset dpms force suspend 
$ xset dpms force off 
$ xset dpms force on  (also implicitly enables DPMS features)

xset screen-saver control

You can use xset to control your screensaver:

$ xset s [timeout [cycle]]  
$ xset s default    
$ xset s on
$ xset s blank              
$ xset s noblank    
$ xset s off
$ xset s expose             
$ xset s noexpose
$ xset s activate           
$ xset s reset

To see your current settings

$ xset q

...

Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is On

Examples

Turn off DPMS

$ xset -dpms

Disable screen saver blanking

$ xset s off

Disable DPMS and prevent screen from blanking

Useful when watching movies or slideshows:

$ xset -dpms; xset s off

Turn off screen immediately

If you leave your computer, you do not need to wait for the timeout you set that the display turns off. Simply enforce it by using the xset command.

$ xset dpms force off

Put screen into standby

$ xset dpms force standby

Put screen into suspend

$ xset dpms force suspend

Change Blank time from 5 min to 1 hour

$ xset s 3600 3600

xset display.sh

You could also copy this script:

/usr/local/bin/display.sh
#!/bin/bash
# Small script to set display into standby, suspend or off mode
# 20060301-Joffer

case $1 in
    standby|suspend|off)
        xset dpms force $1
    ;;
    *)
        echo "Usage: $0 standby|suspend|off"
    ;;
  esac

Make it executable (chmod u+x /usr/local/bin/display.sh) and just run display.sh off. For the latter to work you need to include /usr/local/bin into your path.

DPMS interaction in a Linux console with setterm

The setterm utility issues terminal recognized escape codes to alter the terminal. Essentially it just writes/echos the terminal sequences to the current terminal device, whether that be in screen, a remote ssh terminal, console mode, serial consoles, etc.

setterm Syntax: (0 disables)

setterm -blank [0-60|force|poke]
setterm -powersave [on|vsync|hsync|powerdown|off]
setterm -powerdown [0-60]
Note: If you haven't already read the brief DPMS article linked to below, please skim it to understand how DPMS can be used in the console the same as in X.

Prevent screen from turning off

You can run this command:

$ setterm -blank 0 -powerdown 0

Alternatively you can disable console blanking permanently using the following command:

# echo -ne "\033[9;0]" >> /etc/issue

Pipe the output to a cat to see the escapes

$ setterm -powerdown 2>&1 | exec cat -v 2>&1 | sed "s/\\^\\[/\\\\033/g"

Pipe the escapes to any tty (with write/append perms) to modify that terminal

$ setterm -powerdown 0 >> /dev/tty3
Note: >> is used instead of >. For permission issues using sudo in a script or something, you can use the tee program to append the output of setterm to the tty device, which tty's let appending sometimes but not writing.

Bash loop to set ttys 0-256

$ for i in {0..256}; do setterm -powerdown 0 >> /dev/tty$i; done; unset i;

Troubleshooting

xset DPMS settings do not work with xscreensaver

xscreensaver uses its own DPMS settings. See the settings for xscreensaver for more information.

xscreensaver DPMS

You can configure xscreensaver's DPMS settings manually by editing your ~/.xscreensaver file as below, or using the xscreensaver-demo GUI.

timeout:	1:00:00
cycle:		0:05:00
lock:		False
lockTimeout:	0:00:00
passwdTimeout:	0:00:30
fade:		True
unfade:		False
fadeSeconds:	0:00:03
fadeTicks:	20
dpmsEnabled:	True
dpmsStandby:	2:00:00
dpmsSuspend:	2:00:00
dpmsOff:	4:00:00

See also