PowerDevil/qmlImport

From KDE Community Wiki
Revision as of 17:24, 27 April 2014 by Broulik (talk | contribs) (Initial draft for the PowerDevil QML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A QML import from PowerDevil/Solid PM should be provided which exposes access to brightness handling, inhibition, AC adapter and various other PM related things.

import org.kde.solid.powermanagement 1.0

Solid.Power {
  id: powermanagement
}

Screen and keyboard brightness handling

screenBrightnessAvailable (bool, readonly)

Whether the computer has screen brightness controls available, so the battery monitor can not show the brightness slider in this case.

maxScreenBrightness (int, readonly)

The maximum screen brightness value (such as 4200) the device reports

screenBrightness (int)

For getting and setting the desired screen brightness.

keyboardBrightnessAvailable (bool, readonly)

Whether the computer has keyboard brightness controls available. The heuristics are way less complicated as there is a standardized upower DBus interface for this. If it is not available, the computer doesn't have keyboard brightness.

maxKeyboardBrightness (int, readonly)

The maximum keyboard brightness value (such as 4 or 10) the device reports. Since keyboard lights are usually less fine-grained a fixed 0-100% (like in 10% steps) is not suitable

keyboardBrightness (int)

For getting and setting the desired keyboard brightness.

Inhibition handling

The way the FDO inhibition interface works is that you call inhibit with your application name and a reason and receive a "cookie" which is used if you want to remove inhibition again. Of course it would be super-cool if we could make this transparent to the user and just allow him to call inhibit(reason) and uninhibit without having to manually deal with the cookie thing.

var cookie = inhibit(application, reason)

Start inhibition. The value returned is needed for removing inhibition again later.

uninhibit(cookie)

Remove inhibition

inhibited (bool, readonly)

If there is currently any inhibition going on system-wide

AC Adapter

pluggedIn(bool, readonly)

If the AC adapter is currently plugged in. This is independent of the chargeState property of a battery.

acAdapterEnergyRate(float, readonly)

This is not directly available through upower but might be used from the energyRate of a battery that is being charged so we could warn the user if the AC adapter is broken (??)

Various other stuff

These are other convenience methods that are wildly implemented on the clientside (login manager, battery monitor, etc) and could/should be moved to the library

batteryRemainingTime (qulonglong, readlonly)

The overall battery remaining time for all batteries combined (read: how long will my computer last now?)

batteryCumulativePercent (float, readonly)

The average percentage of all power supply batteries combined

batteryCumulativePresent (bool, readonly)

(Used by the battery monitor and not that useful I guess?) Are all the battery slots available actually taken (there can be empty slots of removable batteries)

batteryCumulativeCharged (bool, readonly)

Are all the batteries available fully charged?