Chapter 1. DBUS Interface

Table of Contents

Introduction
Compatibility
Methods
Suspend
Hibernate
Shutdown
Reboot
AllowedSuspend
AllowedHibernate
AllowedShutdown
AllowedReboot
SetDpmsMode
GetDpmsMode
Inhibit
UnInhibit
GetOnAc
GetLowPowerMode
Signals
DpmsModeChanged
OnAcChanged

This API is currently unstable and is likely to change in the future.

Introduction

Power Manager exposes a DBUS API for programs to obtain information about the DPMS state and to change it if required.

The following constants are used to uniquely refer to the PowerManager object when making DBUS method calls:

DBUS Service:org.gnome.PowerManager
DBUS Object Path:/org/gnome/PowerManager
DBUS Interface:org.gnome.PowerManager

Compatibility

Since gnome-power-manager version 2.14.x the API has changed in the following way:

2.14.x method name2.15.x method name
CanSuspendAllowedSuspend
CanHibernateAllowedHibernate
InhibitInactiveSleepInhibit
AllowInactiveSleepUnInhibit
getOnAcGetOnAc
getDpmsModeGetDpmsMode
setDpmsModeSetDpmsMode
(none)Reboot
(none)AllowedShutdown
(none)AllowedReboot
(none)GetLowPowerMode

Methods

These are the DBUS methods.

Suspend

This call will attempt to suspend the system.

DirectionTypeDescription
outbooleanSuccess value

Hibernate

This call will attempt to hibernate the system.

DirectionTypeDescription
outbooleanSuccess value

Shutdown

This call will attempt to shutdown the system.

DirectionTypeDescription
outbooleanSuccess value

Reboot

This call will attempt to reboot the system.

DirectionTypeDescription
outbooleanSuccess value

AllowedSuspend

If the current user in the session is able to suspend, and has permission to do so. This may fail if the admin has locked down the session.

DirectionTypeDescription
outbooleanIf we are able to suspend

AllowedHibernate

If the current user in the session is able to hibernate, and has permission to do so. This may fail if the admin has locked down the session.

DirectionTypeDescription
outbooleanIf we are able to hibernate

AllowedShutdown

If the current user in the session is able to shutdown, and has permission to do so. This may fail if the admin has locked down the session.

DirectionTypeDescription
outbooleanIf we are able to shutdown

AllowedReboot

If the current user in the session is able to reboot, and has permission to do so. This may fail if the admin has locked down the session.

DirectionTypeDescription
outbooleanIf we are able to reboot

SetDpmsMode

DPMS is a standard from the VESA consortium for managing the power supply of monitors. This call requests a change in the state of DPMS for the current screen.

DirectionTypeDescription
instring 
 on100% power usage
 standby<50% power usage
 suspend<20% power usage
 off<5% power usage

GetDpmsMode

Returns the DPMS mode state.

DirectionTypeDescription
outstring 
 on100% power usage
 standby<80% power usage
 suspend<30W power usage
 off<8W power usage

Inhibit

Inhibits the computer from performing the idle sleep action. Useful if you want to do an operation of long duration without the computer suspending.

DirectionTypeDescription
instringthe application name, e.g. "nautilus"
instringthe localised reason to inhibit, e.g. "indexing files"
outunsigned integerthe cookie

A cookie is a random UINT32 used to identify the inhibit.

UnInhibit

Allows the computer to perform the idle sleep action. Applications that quit without calling this method will be automatically unregistered, but this is not recommended as the user may be warned.

DirectionTypeDescription
inunsigned integerthe cookie

GetOnAc

Finds out if the computer is on AC power, i.e. is not running on primary battery or UPS power.

DirectionTypeDescription
outbooleanIf we are on AC power

GetLowPowerMode

Finds out if the applications should use a low power mode, i.e. when this is true, applications should not re-index or do non-essential activity.

DirectionTypeDescription
outbooleanIf we should use a low power mode

Signals

These are the DBUS signals.

DpmsModeChanged

Signals the value of the current DPMS state.

DirectionTypeDescription
outstring 
 on100% power usage
 standby<80% power usage
 suspend<30W power usage
 off<8W power usage

OnAcChanged

Signals the new AC power state.

DirectionTypeDescription
outboolThe new AC power state