Difference between revisions of "Display Power Management Signaling"

From ArchWiki
Jump to: navigation, search
m (updated wiki syntax, updated headlines)
(Modifying DPMS and screensaver settings using xset: Mentioning an extra, possibly better, way of disabling DPMS with xset.)
(71 intermediate revisions by 31 users not shown)
Line 1: Line 1:
[[Category:X Server (English)]]
+
[[Category:X server]]
[[Category:HOWTOs (English)]]
+
[[Category:Power management]]
{{i18n_links_start}}
+
[[de:DPMS]]
{{i18n_entry|English|Display_Power_Management_Signaling}}
+
[[ja:Display Power Management Signaling]]
{{i18n_entry|Русский|DPMS_(Русский)}}
+
[[ru:Display Power Management Signaling]]
{{i18n_links_end}}
+
[[zh-hans:Display Power Management Signaling]]
 +
'''[[Wikipedia:VESA Display Power Management Signaling|DPMS]]''' (Display Power Management Signaling) enables power saving behaviour of monitors when the computer is not in use. For details on each timeout, see [http://linux.die.net/man/3/dpmssettimeouts]. Note that some monitors make no difference between various DPMS modes.
  
'''DPMS''' (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use.
+
== 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.}}
Add the following to your <code>/etc/X11/xorg.conf</code> in the <code>Monitor</code> section:
+
Add the following to a file in {{ic|/etc/X11/xorg.conf.d/}} in the {{ic|Monitor}} section:
 
  Option "DPMS" "true"
 
  Option "DPMS" "true"
Add the following to the <code>ServerLayout</code> section, change the times (in minutes) as necessary:
+
 
 +
Add the following to the {{ic|ServerLayout}} section, change the times (in minutes) as necessary:
 
  Option "StandbyTime" "10"
 
  Option "StandbyTime" "10"
 
  Option "SuspendTime" "20"
 
  Option "SuspendTime" "20"
 
  Option "OffTime" "30"
 
  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)
+
{{Note|If the {{ic|"OffTime"}} option does not work, use screen blanking instead, which will keep the monitor turned on with a black image. Alternatively, change {{ic|"blanktime"}} to {{ic|"0"}} to disable screen blanking
 
  Option        "BlankTime" "30"
 
  Option        "BlankTime" "30"
  
= DPMS Interaction using xset =
+
An example file {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}} could look like this.
It is possible to turn off your monitor using the <code>xset</code> tool.
 
xset dpms force standby
 
puts the screen(s) into standby,
 
xset dpms force suspend
 
makes them to suspend and
 
xset dpms force off
 
turns them off immediately. If you leave your computer, you don't need to wait for the timeout you set that the display turns off. Simply enfoce it by using the xset command.
 
  
Note that you may need to prefix the command with <code>sleep 1;</code> for it to work correctly. For example,
+
  Section "Monitor"
  sleep 1; xset dpms force off
+
    Identifier "LVDS0"
 +
    Option "DPMS" "false"
 +
EndSection
 +
 +
Section "ServerLayout"
 +
    Identifier "ServerLayout0"
 +
    Option "StandbyTime" "0"
 +
    Option "SuspendTime" "0"
 +
    Option "OffTime"    "0"
 +
    Option "BlankTime"  "0"
 +
  EndSection
 +
}}
  
You could also copy this script:
+
== Modifying DPMS and screensaver settings using xset ==
{{file|name=/usr/local/bin/display.sh|content=
 
<nowiki>
 
#!/bin/bash
 
# Small script to set display into standby, suspend or off mode
 
# 20060301-Joffer
 
  
case $1 in
+
It is possible to turn off your monitor using the ''xset'' tool which is provided by [[installing]] the {{Pkg|xorg-xset}} package.
  standby|suspend|off)
+
 
    xset dpms force $1
+
{{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 {{ic|sleep 1; xset dpms force off}}
  ;;
 
  *)
 
    echo "Usage: $0 standby|suspend|off"
 
  ;;
 
esac
 
</nowiki>
 
 
}}
 
}}
  
Make it executable (<tt>chmod u+x /usr/local/bin/display.sh</tt>) and just run <tt>display.sh off</tt>. For the latter to work you need to include /usr/local/bin into your path, otherwise you have to execute it with the whole path:
+
Example commands:
# With /usr/local/bin in your PATH
+
 
display.sh suspend
+
{| class="wikitable"
+
! Command
# Without /usr/local/bin in your PATH
+
! Description
/usr/local/bin/display.sh standby
+
|-
 +
| xset s off
 +
| Disable screen saver blanking
 +
|-
 +
| xset s 3600 3600
 +
| Change blank time to 1 hour
 +
|-
 +
| xset -dpms
 +
| Turn off DPMS
 +
|-
 +
| xset s off -dpms
 +
| Disable DPMS and prevent screen from blanking
 +
|-
 +
| xset dpms force off
 +
| Turn off screen immediately
 +
|-
 +
| xset dpms force standby
 +
| Standby screen
 +
|-
 +
| xset dpms force suspend
 +
| Suspend screen
 +
|}
 +
 
 +
{{Note|{{ic|dpms 0 0 0}}, which sets all the DPMS timeouts to zero, could be a better way to "disable" DPMS, since the effect of {{ic|-dpms}} would be reverted when, for example, turning off the screen with {{ic|xset dpms force off}}.}}
  
== Disable DPMS and prevent screen from turning off (thanks damir) ==
+
To query the current settings:
Useful when watching movies or slideshows:
 
  
The first command turns off DPMS
+
{{hc|$ xset q|
 +
...
  
  xset -dpms
+
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
 +
}}
  
This one disables screen saver blanking:
+
See {{ic|xset}} for all available commands.
  
xset s off
+
{{Note|If using {{ic|xset}} in [[xinitrc]] does not work, specify settings within a file in {{ic|/etc/X11/xorg.conf.d/}}. See [[#Setting up DPMS in X]] for details.}}
  
 +
{{Warning|[[XScreenSaver]] and {{Pkg|xfce4-power-manager}} use their own DPMS settings and override ''xset'' configuration. See [[XScreenSaver#DPMS and blanking settings]] and [[Xfce#Display blanking]] for more information.}}
  
 +
== DPMS interaction in a Linux console with setterm ==
  
= DPMS Interaction in a 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.  
 +
 +
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.}}
 
{{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 (in console) ==
+
=== Prevent screen from turning off ===
{{cli|setterm -blank 0 -powerdown 0}}
+
 
 +
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|{{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.}}
  
==Pipe the output to a cat to see the escapes ==
+
==== Bash loop to set ttys 0-256 ====
{{cli|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==
+
  $ for i in {0..256}; do setterm -powerdown 0 >> /dev/tty$i; done; unset i;
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.
 
{{cli|setterm -powerdown 0 > /dev/tty3}}
 
  
===Bash loop to set ttys 0-256===
+
== See also ==
{{cli|for i in {0..256}; do setterm -powerdown 0 >> /dev/tty$i; done; unset i;}}
 
  
= External Resources =
 
 
* [http://webpages.charter.net/dperr/dpms.htm PC Monitor DPMS specification explanation]
 
* [http://webpages.charter.net/dperr/dpms.htm PC Monitor DPMS specification explanation]
 +
* [http://ptspts.blogspot.be/2009/10/screen-blanking-dpms-screen-saver.html DPMS control in X]

Revision as of 15:58, 10 July 2017

DPMS (Display Power Management Signaling) enables power saving behaviour of monitors when the computer is not in use. For details on each timeout, see [1]. Note that some monitors make no difference between various DPMS modes.

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, use screen blanking instead, which will keep the monitor turned on with a black image. Alternatively, change "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"
    Option "BlankTime"   "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 installing the xorg-xset package.

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

Example commands:

Command Description
xset s off Disable screen saver blanking
xset s 3600 3600 Change blank time to 1 hour
xset -dpms Turn off DPMS
xset s off -dpms Disable DPMS and prevent screen from blanking
xset dpms force off Turn off screen immediately
xset dpms force standby Standby screen
xset dpms force suspend Suspend screen
Note: dpms 0 0 0, which sets all the DPMS timeouts to zero, could be a better way to "disable" DPMS, since the effect of -dpms would be reverted when, for example, turning off the screen with xset dpms force off.

To query the 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

See xset for all available commands.

Note: If using xset in xinitrc does not work, specify settings within a file in /etc/X11/xorg.conf.d/. See #Setting up DPMS in X for details.
Warning: XScreenSaver and xfce4-power-manager use their own DPMS settings and override xset configuration. See XScreenSaver#DPMS and blanking settings and Xfce#Display blanking for more information.

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;

See also