The Inhibit() method

Okay, my last post talked about the lowest layer of power-management. To keep people interested, I'll today talk about the highest layer of gnome-power-manager i.e. the DBUS interface.

GNOME Power Manager has a complete API, that has recently been changed to be more in line with DBUS specifications and to better please the XDG guys with the more general method names. Please review and give me feedback.

If you are a developer reading this, then the most important methods to know are Inhibit() and UnInhibit(), which also exist in gnome-screensaver.

Why two identical methods on different service names?

The reason is; If you Inhibit() on org.gnome.ScreenSaver, then the screensaver will not come on (i.e. the session will not become idle) when you are doing an activity. This is obviously most suitable for visual stuff that requires the screen like playing a DVD in totem or doing a presentation in OpenOffice.

If you do an Inhibit() on org.gnome.PowerManager then the session is marked as idle, so the screensaver can go on, but the computer does not auto-suspend or power down when the mouse has not been moved for the timeout period. This is suitable for applications like bittorrent, epiphany (when downloading a big file), and nautilus (when copying a big file from a network share).

Although this seems potentially like modifying lots of programs for little gain, this all makes the software “just work” without having to manually set power profiles (which is bad) or move the mouse to special hot-spots to prevent things happening. This also removes the need for a “blacklist” of applications that inhibit suspend, as this is inherently broken.

It also lets us inform the user if they try to do silly things, like if the user clicks hibernate, and k3b is about to finish writing a DVD, we can ask the user “are you really sure, as K3B is writing a DVD…”

Aaron Whitehouse has been compiling a list of applications that need bugs filed, or should use the Inhibit() interface which I hope you guys can add to.

If you read the spec files for gnome-power-manager and gnome-screensaver you can see that they are designed to be easy to use.

Comments, as usual, appreciated.

One response to “The Inhibit() method”

  1. Anonymous

    Nautilus won't depend on D-Bus until it's guaranteed to be API stable (i.e. until 1.0 is out).

Bad Behavior has blocked 2769 access attempts in the last 7 days.