Jump to content

PowerDevil/qmlImport: Difference between revisions

From KDE Community Wiki
Broulik (talk | contribs)
Initial draft for the PowerDevil QML import
 
Broulik (talk | contribs)
Add suspend and some other useful stuff
Line 8: Line 8:
}
}
</pre>
</pre>
Other things that might be useful but not directly inside the scope of PowerDevil is toggling (or at least querying the state of) Bluetooth, Wireless, Flight Mode.


== Screen and keyboard brightness handling ==
== Screen and keyboard brightness handling ==
Line 38: Line 40:
===acAdapterEnergyRate(float, readonly)===
===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 (??)
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 (??)
==Suspend==
===suspendToRam()===
===suspendToRamSupported (bool, readonly)===
Whether the device supports suspend to ram (and the app/user is allowed to?)
===suspendToDisk()===
===suspendToDiskSupported===
Whether the device supports suspend to disk (and the app/user is allowed to?)
===suspendHybrid()===
===suspendHybridSupported===
Whether the device supports hybrid suspend (and the app/user is allowed to?)


==Various other stuff==
==Various other stuff==
Line 49: Line 62:
===batteryCumulativeCharged (bool, readonly)===
===batteryCumulativeCharged (bool, readonly)===
Are all the batteries available fully charged?
Are all the batteries available fully charged?
===hasLid (bool, readonly)===
Whether the computer has a lid (is a notebook), so Kickoff can show the laptop icon for the "Computer" category again ;)

Revision as of 17:35, 27 April 2014

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
}

Other things that might be useful but not directly inside the scope of PowerDevil is toggling (or at least querying the state of) Bluetooth, Wireless, Flight Mode.

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 (??)

Suspend

suspendToRam()

suspendToRamSupported (bool, readonly)

Whether the device supports suspend to ram (and the app/user is allowed to?)

suspendToDisk()

suspendToDiskSupported

Whether the device supports suspend to disk (and the app/user is allowed to?)

suspendHybrid()

suspendHybridSupported

Whether the device supports hybrid suspend (and the app/user is allowed to?)

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?

hasLid (bool, readonly)

Whether the computer has a lid (is a notebook), so Kickoff can show the laptop icon for the "Computer" category again ;)