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.
#!/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.