org.freedesktop.UPower

org.freedesktop.UPower — UPower interface

Methods

EnumerateDevices  (out 'ao' devices)
GetDisplayDevice  (out 'o'  device)
GetCriticalAction (out 's'  action)

Signals

DeviceAdded   ('o' device)
DeviceRemoved ('o' device)

Implemented Interfaces

Objects implementing org.freedesktop.UPower also implements org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties

Properties

'DaemonVersion' read      's'
'OnBattery'     read      'b'
'LidIsClosed'   read      'b'
'LidIsPresent'  read      'b'

Description

The UPower service is available via the system message bus. To access the service, use the org.freedesktop.UPower interface on the /org/freedesktop/UPower object on the D-Bus system bus service with the well-known name org.freedesktop.UPower.

1
2
3
4
5
6
7
8
9
10
11
$ dbus-send --print-reply \
            --system \
            --dest=org.freedesktop.UPower \
            /org/freedesktop/UPower \
            org.freedesktop.UPower.EnumerateDevices

method return sender=:1.386 -> dest=:1.451 reply_serial=2
   array [
      object path "/org/freedesktop/UPower/devices/line_power_AC"
      object path "/org/freedesktop/UPower/devices/battery_BAT0"
   ]

Details

EnumerateDevices ()

EnumerateDevices (out 'ao' devices)

Enumerate all power objects on the system.

devices:

An array of object paths for devices.

GetDisplayDevice ()

GetDisplayDevice (out 'o' device)

Get the object to the "display device", a composite device that represents the status icon to show in desktop environments. You can also access the object directly as its path is guaranteed to be /org/freedesktop/UPower/devices/DisplayDevice. The following standard org.freedesktop.UPower.Device properties will be defined (only IsPresent takes a special meaning):

  • Type: the type of the display device, UPS or Battery. Note that this value can change, as opposed to real devices.
  • State: the power state of the display device, such as Charging or Discharging.
  • Percentage: the amount of energy left on the device.
  • Energy: Amount of energy (measured in Wh) currently available in the power source.
  • EnergyFull: Amount of energy (measured in Wh) in the power source when it's considered full.
  • EnergyRate: Discharging/charging rate of the source, measured in Watt.
  • TimeToEmpty: Number of seconds until the power source is considered empty.
  • TimeToFull: Number of seconds until the power source is considered full.
  • IsPresent: Whether a status icon using this information should be presented.
  • IconName: An icon name representing the device state.
  • WarningLevel: The same as the overall WarningLevel

device:

An object path for the "display device.

GetCriticalAction ()

GetCriticalAction (out 's' action)

When the system's power supply is critical (critically low batteries or UPS), the system will take this action. Possible values are:

  • HybridSleep:
  • Hibernate:
  • PowerOff:

action:

A string representing the critical action configured and available.

Signal Details

The DeviceAdded signal

DeviceAdded ('o' device)

Emitted when a device is added.

device:

Object path of device that was added.

The DeviceRemoved signal

DeviceRemoved ('o' device)

Emitted when a device is removed.

device:

Object path of device that was removed.

Property Details

The "DaemonVersion" property

'DaemonVersion'  read      's'

Version of the running daemon, e.g. 002.


The "OnBattery" property

'OnBattery'  read      'b'

Indicates whether the system is running on battery power. This property is provided for convenience.


The "LidIsClosed" property

'LidIsClosed'  read      'b'

Indicates if the laptop lid is closed where the display cannot be seen.


The "LidIsPresent" property

'LidIsPresent'  read      'b'

If the system has a lid device.