Monitors Won't Sleep in TwinView Mode (Ubuntu Jaunty / gnome-power-manager)

Tom Metro tmetro-blu-5a1Jt6qxUNc at public.gmane.org
Mon May 4 18:15:38 EDT 2009


BassKozz wrote:
> ...my assumption is that because I am running vbetool as sudo/root I
> can't get out of it by moving the mouse or keyboard because these are
> actions that are being performed as the user.

More likely it is because DPMS communications is broken in your X 
installation, so for the same reason it won't turn the monitors off, 
user activity won't turn them on. What you learned by directly invoking 
on/off commands pretty much confirms that.


> ...I've created two bash scripts (dpms-off.sh & dpms-on.sh) and I
> call them using custom keyboard shortcuts (ctrl+alt+0 & ctrl+alt+1).
> The scripts simply run "vbetool dpms off" & "vbetool dpms on"
> respectively.
> 
> Does anyone know how I can tie the dpms-off.sh script into my
> screensaver so that after 15mins it kicks this on?

The simplest hack would be to create a shell script that runs in the 
background and polls the screensaver state periodically. (The timing for 
going into off state is easy, but turning the monitors on quickly will 
require a trade off between polling interval and CPU cycles.)

There are probably dozens of hack and proper API ways to determine when 
the screensaver is active. Try googling for that. There may even be 
something under /proc or /sys that could easily be queries from a 
script. (On an N810, for example, there is a /sys file you can read to 
see what the display brightness is. I used that to create a "sleep timer.")

A simple man page search turns up:
gnome-screensaver-command (1)

For example:
~% gnome-screensaver-command --query
The screensaver is inactive
The screensaver is not inhibited

or
% gnome-screensaver-command --time
The screensaver is not currently active.


But the best approach would be to dig up the source for 
gnome-screensaver to see how it determines or is notified of an idle 
state. (freedesktop.org might be another resource for an API 
specification.) There is a DBus interface used by the screensaver 
(that's how gnome-screensaver-command communicates with the current 
screensaver process), which a (Perl/Python/etc.) script might be able to 
use to get event triggered notifications of the state change.

  -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/





More information about the Discuss mailing list