Turning off dual monitors with "xset dpms force off" does not work - why?

11,330

Solution 1

What exactly are you trying to accomplish? For managing monitor usage you can/should use the randr extension where xrandr would be the weapon of choice in scripts.

xrandr -q shows all outputs of your computer and some info about connected monitors. To disable an output you would put something like xrandr --output=HDMI1 --off. In your case you have to replace "HDMI1" with whatever xrandr -q tells you your outputs are named. With your output disabled X does not use this monitor anymore (at all) and it will most likely enter a sleep state.

If you actually want the monitor to turn off, your problem is that xset does neither know nor care about how many monitors you have hooked up to your computer, because xset talks to Xservers, not their components and definetly not hardware. This means xset sends exactly one "dpms force off" request and that request is (processed and) sent to one of your monitors by the Xserver. I'd guess it sends it to your primary monitor, i.e. the one connected to the output that appears first in the list shown by xrandr -q. That's the same monitor your gnome panel lives on, if you're using gnome.

In effect I'd guess you have to issue your xset request twice. If that doesn't help immediately I'd assume you need to be explicit about the issue which of your attached monitors is primary and which is not.

xrandr allows you to set the primary output/monitor by the use of the --primary option. If your outputs are HDMI1 and HDMI2, I'd try:

xrandr --output HDMI2 --primary
xset dpms force off
xrandr --output HDMI1 --primary
xset dpms force off

Check the output of xrandr -q and write a script that turns off your monitors in the reverse order they are listet, that is bottom up. The reason for that is, that while (x)randr is supposed to be able to arbitrarily make outputs the default output I wouldn't/don't trust it to work that flawlessly, especially if there are closed source drivers involved. By working through your monitors in reverse order you turn off the "natural" primary monitor last and if things go wrong, having the "natural" primary monitor available is your best shot at having a fully functional Xserver.

Solution 2

Clarification of the question: I'm guessing Rox wants to turn off his monitors when he goes away (but leave the computer running). This normally happens after the screensaver has shown pretty patterns for a while. Using the "xset dpms force off" command is a way to be able to test if things are working without having to wait half an hour for the DPMS screensaver to kick in. (you can also set the timeout to DPMS off really short, but that's just another way of speeding up the testing).

I just tested this on my system. It has: 01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV620 LE [Radeon HD 3450] and when I type "xset dpms force off" both monitors show "no signal" for three seconds and then turn the led amber (i.e. sleep mode). "it works for me"!

So... To figure out what's wrong in your situation: Can you swap monitors to verify that your second monitor is DPMS capable? If that's the case, as I expect, this might be a bug. Probably quite specific to your chip/software. Are you running the latest software? (e.g. ubuntu 12.04).

Share:
11,330

Related videos on Youtube

Rox
Author by

Rox

Updated on September 18, 2022

Comments

  • Rox
    Rox over 1 year

    I would like to turn off my dual monitors by running: xset dpms force off but just the primary monitor is beeing turned off while the other just gets a "black screen" (like if it was turned off) but it is not off. The led is still gleaming green indicating the monitor is on.

    • clerksx
      clerksx almost 12 years
      Are you sure that the second monitor actually supports the power signalling in the DPMS standard?
    • Rox
      Rox almost 12 years
      Yes, the two monitors are equal.
  • Rox
    Rox almost 12 years
    Thanks for a good answer! I didn´t mention that I use "TwinView" in the xorg.conf so the both screens appear as one screen. Maybe it isn´t possible when using TwinView?
  • Bananguin
    Bananguin almost 12 years
    I don't know about NVidia. Is your hardware not supported by recent drivers anymore? Because apparently (phoronix.com/scan.php?page=news_item&px=MTA5NTY) you may now ditch TwinView and use RandR, even with closed source NVidia drivers.
  • Bananguin
    Bananguin almost 12 years
    You may always upvote good answers. :-)
  • Rox
    Rox almost 12 years
    I know, but I can't yet since I don't have 15 reputation. :-)