2

I'm looking for a way to easily suspend the monitor in Ubuntu 9.10. I have xscreensaver set up, and it properly turns the monitor off after showing screensavers for a while. Most of the time that's the right thing, but when I leave my computer I'd like to be able to immediately suspend it via a panel button.

I tried using xset, as suggested in ubuntuforms. This works briefly, but after a moment the screen turns back on. Debian bug #552506 states that xset doesn't play well with gnome-power-manager, and as in that bug report, xset works when gnome-power-manager is not running. There is supposedly a dbus interface to get gnome-power-manager to switch modes itself.

Some searching led to the g-p-m FAQ, which suggests the following command:

dbus-send --session --dest=org.gnome.PowerManager \
  --type=method_call --print-reply \
  --reply-timeout=2000 /org/gnome/PowerManager \
  org.gnome.PowerManager.SetDpmsMode string:suspend

However, when I try that, I get the error

Error org.freedesktop.DBus.Error.UnknownMethod:
Method "SetDpmsMode" with signature "s" on interface
"org.gnome.PowerManager" doesn't exist

There's a way to view the methods an interface supports:

dbus-send --session --dest=org.gnome.PowerManager \
  --type=method_call --print-reply \
  --reply-timeout=2000 /org/gnome/PowerManager \
  org.freedesktop.DBus.Introspectable.Introspect

But the only method specific to org.gnome.PowerManager is GetPreferencesOptions:

<interface name="org.gnome.PowerManager">
  <method name="GetPreferencesOptions">
    <arg name="capability" type="i" direction="out"/>
  </method>
</interface>

I looked in /usr/share/dbus-1/services and /usr/share/dbus-1/system-services, and nothing obvious presented itself.

I'm using Ubuntu 9.10 with a mostly default setup. Gnome-power-manager is version 2.28.1. Any suggestions?

EDIT:

As I said in the comments, I have tried to use xset force dpms {standby|suspend|off}. On my particular hardware, all three DPMS modes appear to do the same thing. From Screen Blanking Under X, these modes are:

  • Standby Time
    • In a CRT, this turns off the electron gun, but leaves everything else powered on so that the screen can recover quickly. The timeout defaults to 20 minutes.
  • Suspend Time
    • This turns off the monitor power supply in addition to the electron gun. By default this timeout is set to 30 minutes.
  • Off Time
    • This turns off all power to the monitor and is the most power conservative state. By default this happens after 40 minutes.

Your hardware may treat these modes differently, and accordingly gnome-power-manager might not monitor each of the different modes. This means that a proposed xset-based solution needs to work for all three modes on your hardware, not just for only one or two modes.

Given that, I believe that xset will not work, and I either need a way to tell gnome-power-manager to suspend the display or something entirely different.

1
  • Having the same problem. I want to lock and suspend my monitors from command line. But something like: #!/bin/bash; gnome-screensaver-command --lock; xset dpms force suspend; will result in the monitors going in suspend, but they will return after a few seconds. There is also a gnome bug: bugzilla.gnome.org/show_bug.cgi?id=631625 Also I am not on ubuntu, so I think that this is not a ubuntu nor ubuntu-9.10 related bug.
    – Flow
    May 28, 2011 at 8:25

1 Answer 1

1

The command

# xset dpms force standby

works for me. Is that the one that comes back on a few seconds later for you?

Edit: It looks like if I use suspend instead then it behaves like you described and comes back on after a few moments.

4
  • Same behavior for all three modes (standby, suspend, off). This is on a laptop, and afaict the three modes all have the same effect.
    – Jason Owen
    Nov 7, 2009 at 0:16
  • Standby works on my Thinkpad, suspend does not. I'll play around with dbus.
    – djhowell
    Nov 7, 2009 at 0:26
  • Both 'xset dpms force standby' and 'xset dpms force suspend' work for me on a Dell Latitude E6500 notebook. Jason, maybe you have 'wake on network' turned on, or something similar?
    – pbr
    Dec 2, 2009 at 22:58
  • pbr: As I understand it, Wake on LAN applies when the system is suspended or off, not the display. Besides that, the fact that xset works as expected when gnome-power-manager is not running (as in the Debian bug report I linked in the second paragraph) seems to discount that theory.
    – Jason Owen
    Dec 10, 2009 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .