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.
Turning off dual monitors with “xset dpms force off” does not work – why
dpmsmulti-monitorxorgxset
Best Answer
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 likexrandr --output=HDMI1 --off
. In your case you have to replace "HDMI1" with whateverxrandr -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, becausexset
talks to Xservers, not their components and definetly not hardware. This meansxset
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 byxrandr -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 areHDMI1
andHDMI2
, I'd try: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.