GNOME Bugzilla – Bug 320223
DBus method getIdleTime not working
Last modified: 2005-12-19 01:16:55 UTC
Version details: 0.0.15 Distribution/Version: Ubuntu Breezy It seems that the idle time reported by gnome-screensaver, for instance using "sleep 10 && dbus-send --session --print-reply --dest=org.gnome.screensaver --type=method_call /org/gnome/screensaver org.gnome.screensaver.getIdleTime" doesn't work. It always returns zero, even though the session is idle. And yes, I don't touch the computer during the 10 seconds sleep until the command returns. I have also written a c-program that connects to the bus, and runs the dbus method call with the same result. This is on Ubuntu Breezy, using the pre-packaged 0.0.15 release. If you think that it has been fixed in later versions, let me know and I will try to compile from source.
The way it works right now is that it returns zero until the screensaver detects idleness (the length of the period of inactivity is set by the user). When the session goes idle a dbus message is sent (ActiveChanged with argument TRUE) over the session bus. After that the getIdleTime method will return non-zero values. This is partly to discourage polling of getIdleTime and to encourage watching for the ActiveChanged signal. Would this work for your use?
Maybe, I'm still waiting for input from the xchat-gnome maintainer (see bug #313016 ), if he decides that idle-time tracking is uneccessary, then I won't need it I guess. However, you may want to consider either removing or renaming this method since it gives a false impression of what is possible to do[1]. In either case, could you put a short note about this in the DBUS-API.txt-file to avoid this kind of confusion? [1] At least if one defines "idle" as "not doing anything with the computer" which I do.
After some thought and patch iterations on bug #313016, I won't be needing idle-time from gnome-screensaver. Feel free to close this as WONTFIX...
I've renamed getIdleTime to getActiveTime now since it really tells how long the screensaver has been active. There was also a bug that made getIdleTime return bogus times. This should be fixed now.