Display Power Management Signaling: Difference between revisions

From ArchWiki
(To clarify the option to set timeout value before the screen (s) go into standby mode.)
 
(44 intermediate revisions by 24 users not shown)
Line 1: Line 1:
[[Category:Display control]]
[[Category:X server]]
[[Category:X server]]
[[Category:Power management]]
[[de:DPMS]]
[[de:DPMS]]
[[ja:Display Power Management Signaling]]
[[ja:Display Power Management Signaling]]
[[ru:Display Power Management Signaling]]
[[ru:Display Power Management Signaling]]
[[zh-hans:Display Power Management Signaling]]
[[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.
[[zh-hant:Display Power Management Signaling]]
'''[[Wikipedia:VESA Display Power Management Signaling|Display Power Management Signaling]]''' (DPMS) enables power saving behaviour of monitors when the computer is not in use. The time of inactivity before the monitor enters into a given saving power level, standby, suspend or off, can be set as described in {{man|3|DPMSSetTimeouts}}.
Note that DPMS was developed for CRT monitors, and on LCD displays, there is normally no difference between the standby, suspend and off modes.


== 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/}}:
Option "DPMS" "true"


Add the following to the {{ic|ServerLayout}} section, change the times (in minutes) as necessary:
{{hc|/etc/X11/xorg.conf.d/dpms.conf|2=
Section "Monitor"
    Option "DPMS" "true"
EndSection
}}
 
Add the following to the {{ic|ServerFlags}} section, change the times (in minutes) as necessary:
  Option "StandbyTime" "10"
  Option "StandbyTime" "10"
  Option "SuspendTime" "20"
  Option "SuspendTime" "20"
Line 20: Line 27:
  Option        "BlankTime" "30"
  Option        "BlankTime" "30"


An example file {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}} could look like this.
}}
 
To disable DPMS, change {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}} as below:


  Section "Monitor"
  Section "Monitor"
     Identifier "LVDS0"
     Identifier "LVDS0"
     Option "DPMS" "false"
     Option "DPMS" "false"
EndSection
Section "ServerFlags"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime" "0"
    Option "BlankTime" "0"
  EndSection
  EndSection
   
   
  Section "ServerLayout"
  Section "ServerLayout"
     Identifier "ServerLayout0"
     Identifier "ServerLayout0"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime"    "0"
    Option "BlankTime"  "0"
  EndSection
  EndSection
}}


== Modifying DPMS and screensaver settings using xset ==
== Modify DPMS and screensaver settings with a command ==


It is possible to turn off your monitor using the ''xset'' tool which is provided by [[installing]] the {{Pkg|xorg-xset}} package.
It is possible to turn off your monitor with the ''xset'' command which is provided by the {{Pkg|xorg-xset}} package.


{{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}}
Examples:
}}
 
Example commands:


{| class="wikitable"
{| class="wikitable"
Line 49: Line 57:
! Description
! Description
|-
|-
| xset s off
| {{ic|xset s off}}
| Disable screen saver blanking
| Disable screen saver blanking
|-
|-
| xset s 3600 3600
| {{ic|xset s 3600 3600}}
| Change blank time to 1 hour
| Change blank time to 1 hour
|-
|-
| xset -dpms
| {{ic|xset -dpms}}
| Turn off DPMS
| Turn off DPMS
|-
|-
| xset s off -dpms
| {{ic|xset s off -dpms}}
| Disable DPMS and prevent screen from blanking
| Disable DPMS and prevent screen from blanking
|-
|-
| xset dpms force off
| {{ic|xset dpms force off}}
| Turn off screen immediately
| Turn off screen immediately
|-
|-
| xset dpms force standby
| {{ic|xset dpms force standby}}
| Standby screen
| Standby screen
|-
|-
| xset dpms force suspend
| {{ic|xset dpms force suspend}}
| Suspend screen
| 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}}.}}


To query the current settings:
To query the current settings:
Line 77: Line 83:
{{hc|$ xset q|
{{hc|$ xset q|
...
...
Screen Saver:
Screen Saver:
   prefer blanking:  yes    allow exposures:  yes
   prefer blanking:  yes    allow exposures:  yes
Line 87: Line 92:
}}
}}


See {{ic|xset}} for all available commands.
See {{man|1|xset}} for all available commands.


{{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.}}
{{Note|
 
* [[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.
{{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.}}
* If using the 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}}
* {{ic|xset 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}}.
* 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.
}}


== DPMS interaction in a Linux console with setterm ==
== DPMS interaction in a Linux console with setterm ==
Line 99: Line 107:
setterm Syntax: (0 disables)
setterm Syntax: (0 disables)


  setterm -blank [0-60|force|poke]
  $ setterm --blank [0-60|force|poke]
  setterm -powersave [on|vsync|hsync|powerdown|off]
  $ setterm --powersave [on|vsync|hsync|powerdown|off]
  setterm -powerdown [0-60]
  $ 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|
 
* Console blanking alone does not enable DPMS power saving. Console blanking is disabled by default. [https://github.com/torvalds/linux/commit/a4199f5eb8096d63828f7333fa45650a7b0a99ed]
=== Prevent screen from turning off ===
* {{ic|setterm --powerdown}} does not seem to have any effect when the {{ic|APM_DISPLAY_BLANK}} kernel configuration option is not enabled. [https://superuser.com/a/154388]
 
* Console blanking can also be enabled by the {{ic|consoleblank}} [[kernel parameter]]. See the [https://docs.kernel.org/admin-guide/kernel-parameters.html kernel documentation] for details.
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
 
Changing 0 (after the semicolon) to e.g. 3, will keep the screen on for 3 minutes, before entering standby mode.


=== 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 ===


  $ setterm -powerdown 0 >> /dev/tty3
  $ 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.}}
{{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.}}
Line 128: Line 129:
==== Bash loop to set ttys 0-256 ====
==== 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;


== See also ==
== See also ==


* [http://webpages.charter.net/dperr/dpms.htm PC Monitor DPMS specification explanation]
* [[Backlight#Switch off the backlight]]
* [http://ptspts.blogspot.be/2009/10/screen-blanking-dpms-screen-saver.html DPMS control in X]
* [https://web.archive.org/web/20180129095655/http://webpages.charter.net/dperr/dpms.htm PC Monitor DPMS specification explanation]
* [https://ptspts.blogspot.be/2009/10/screen-blanking-dpms-screen-saver.html DPMS control in X]

Latest revision as of 13:16, 28 January 2024

Display Power Management Signaling (DPMS) enables power saving behaviour of monitors when the computer is not in use. The time of inactivity before the monitor enters into a given saving power level, standby, suspend or off, can be set as described in DPMSSetTimeouts(3). Note that DPMS was developed for CRT monitors, and on LCD displays, there is normally no difference between the standby, suspend and off 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/:

/etc/X11/xorg.conf.d/dpms.conf
Section "Monitor"
    Option "DPMS" "true"
EndSection

Add the following to the ServerFlags 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"

To disable DPMS, change /etc/X11/xorg.conf.d/10-monitor.conf as below:

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

Section "ServerFlags"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime" "0"
    Option "BlankTime" "0"
EndSection

Section "ServerLayout"
    Identifier "ServerLayout0"
EndSection

Modify DPMS and screensaver settings with a command

It is possible to turn off your monitor with the xset command which is provided by the xorg-xset package.

Examples:

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

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(1) for all available commands.

Note:
  • 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.
  • If using the 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
  • xset 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.
  • 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.

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:
  • Console blanking alone does not enable DPMS power saving. Console blanking is disabled by default. [1]
  • setterm --powerdown does not seem to have any effect when the APM_DISPLAY_BLANK kernel configuration option is not enabled. [2]
  • Console blanking can also be enabled by the consoleblank kernel parameter. See the kernel documentation for details.

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