Gnome Power Manager Inhibit and UnInhibit

Gnome Power Manager has a preference allowing the user to have their machine suspend or hibernate after the machine has been idle for a certain time. This allows the machine to conserve power when it is not in use.

The difficulty is that a lack of mouse or keyboard activity does not necessarily equate to "session not in use" and the machine may suspend when it is undertaking a long task (e.g. copying large files) or performing an activity requiring no input from the user (e.g. playing music).

From version 2.15, Gnome Power Manager allows applications to call Inhibit and UnInhibit DBUS methods. This allows the applications to tell GPM that the system is busy even if there is no user input. This will not prevent the machine suspending when power is low but will prevent the system suspending for the reason that it is not being used.

Information on these methods can be found at

There is an example which shows how to add Inhibit and UnInhibit DBUS methods into your existing program.

More info:

This page aims to be a central place for information on, and implementation of, this feature. It may be useful to include a link to this page when requesting the feature.

Inhibiting Gnome Screensaver vs. Inhibiting Gnome-Power-Manager

It is possible to inhibit both Gnome Screensaver and Gnome-Power-Manager. The occasions on which each should be used are different.

Inhibiting Gnome Screensaver indirectly inhibits GPM as well. It should be used when the user will be using the screen without the mouse or keyboard (e.g. a video call or playing a movie). This method tells the screensaver that, even though there is no mouse movement or keyboard presses, the user is actively using the screen. That is the subject of InhibitingGnomeScreensaver.

Inhibiting GPM is for situations when the screensaver coming on (or the screen turning off) will not affect the operation of the application. It is targeted at longer tasks that the user is likely to leave the computer working at for a while. Ideal situations are things that could run for longer than 5 minutes unattended and do not need the screen to remain on. Some examples are copying files or downloading, as the user is not using the screen but does not want the machine to suspend in the middle of the task. This is the subject of this page.

Concerns about adding DBUS as a dependency

Some people are concerned about adding DBUS as a dependency. As a general rule, dependencies are undesirable and, the more simple the program, the less desirable it is to have it depend on a list of other packages. That said, DBUS is the new standard in inter-process communication and it will become increasingly rare to find machines without it. All major distributions have DBUS installed by default.

This, however, does not change that inhibiting GPM does add DBUS as a dependency. What one can do is to add the DBUS code as an optional dependency.

Add a little few lines of code in;

 dbus_version=`pkg-config --modversion dbus-1` 

Then we can check the value of dbus_version and, if it is high enough, we can define the config.h variable USE_DBUS.

In this way we can surround the #include <dbus/foo.h> and dbus_bar in pre-processor ifdef tags, for example:

#include "config.h"
#include <string.h>
#ifdef USE_DBUS
#include <dbus/foo.h>

int main
#ifdef USE_DBUS
 dbus_g_proxy_set_interface (foo, bar);
 g_print ("DBUS support not present");

This means that you can compile the package without DBUS installed and the DBUS feature just isn't available. If you have it installed, then it enables the feature automatically. It would allow those compiling the code themselves to avoid the dependency if they did not have DBUS installed. Packagers would make the decision on the behalf of the distribution and, for Ubuntu (where it is installed on machines by default), would likely require DBUS.

Occasions in Ubuntu when Inhibit should be used

This is a list to track the implementation of this feature in Ubuntu. Please add the situations in which you believe the feature should be invoked. Please try to keep this list in alphabetical order.

When Inhibit should be used




Bug # (Launchpad)


When downloading

Emailed maintainer of GUI



When playing music

Fix Released



When in a voice call

Needs Info



When downloading




When downloading




When downloading




When moving or copying files



Nautilus CD Burner

When burning a CD or DVD




When playing music

In Progress



When burning a CD




When ripping files from a CD

Done and tested



When ripping a DVD

Code Committed Upstream



When downloading / installing packages

Fix Released



Oggenc: When encoding (often used in scripts)




When wiping files



Example Bug Report / Feature Request

Title: Inhibit Gnome Power Manager from suspending while []


"All [application] has to do is call a simple dbus method when [] starts and a simple dbus method when it's finished. This way Gnome-Power-Manager doesn't auto-suspend or power-down while [].

See for more information."

GnomePowerManagerInactiveSleep (last edited 2008-08-06 16:13:58 by localhost)