idle detection

Sean Egan seanegan at
Thu Jul 26 15:18:14 EDT 2007

On 7/26/07, Ethan Blanton <elb at> wrote:
> What are the screensavers doing
> these days?  Do they rely on display capture?

Comments in gtkidle.c led me to in which
Luke appears to foolishly argue with jwz about the best way to handle
this. jwz makes reference to

It looks like both of these techniques are dependent on xscreensaver
running; at least when I try xscreensaver-command -time I get
"xscreensaver-command: no screensaver is running on display :0.0"

In either case, it seems just like more polling; says:

Is there a way to perform actions when the screensaver activates or
deactivates? Or when the session becomes idle?

One way is to watch for the D-Bus signals from gnome-screensaver.
Here's an example of how to perform actions when the session becomes
idle or is no longer idle:

my $cmd = "dbus-monitor --session

open (IN, "$cmd |");

while (<IN>) {
    if (m/^\s+boolean true/) {
        print "*** Session is idle ***\n";
    } elsif (m/^\s+boolean false/) {
        print "*** Session is no longer idle ***\n";

which looks like a promising route, albeit specific to
'gnome-screensaver', which I didn't even realize existed.

Is it possible to, say, listen to events on the root window or something?

I think I'll do the above described for 2.1.0---poll with the
frequency set in preferences when not idle, and once every second or
two when idle (if people got by with polling for 7 years, they can
handle 3 more weeks), and then we can take care of this issue for real
in a subsequant release.

I suspect there's no good way to do this other than the special-case
hack for gnome-screensaver, though.


More information about the Devel mailing list