Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GPowerProfileMonitor
makes it possible for applications as well as OS
components to monitor system power profiles and act upon them. It currently
only exports whether the system is in “Power Saver” mode (known as
“Low Power” mode on some systems).
When in “Low Power” mode, it is recommended that applications:
- disable automatic downloads;
- reduce the rate of refresh from online sources such as calendar or email synchronisation;
- reduce the use of expensive visual effects.
It is also likely that OS components providing services to applications will lower their own background activity, for the sake of the system.
There are a variety of tools that exist for power consumption analysis, but those
usually depend on the OS and hardware used. On Linux, one could use upower
to
monitor the battery discharge rate, powertop
to check on the background activity
or activity at all), sysprof
to inspect CPU usage, and intel_gpu_time
to
profile GPU usage.
Don’t forget to disconnect the Object::notify signal for
PowerProfileMonitor
:power-saver-enabled
, and unref the
GPowerProfileMonitor
itself when exiting.
Since: 2.70
Synopsis
- newtype PowerProfileMonitor = PowerProfileMonitor (ManagedPtr PowerProfileMonitor)
- class (GObject o, IsDescendantOf PowerProfileMonitor o) => IsPowerProfileMonitor o
- toPowerProfileMonitor :: (MonadIO m, IsPowerProfileMonitor o) => o -> m PowerProfileMonitor
- powerProfileMonitorDupDefault :: (HasCallStack, MonadIO m) => m PowerProfileMonitor
- powerProfileMonitorGetPowerSaverEnabled :: (HasCallStack, MonadIO m, IsPowerProfileMonitor a) => a -> m Bool
- getPowerProfileMonitorPowerSaverEnabled :: (MonadIO m, IsPowerProfileMonitor o) => o -> m Bool
Exported types
newtype PowerProfileMonitor Source #
Memory-managed wrapper type.
Instances
Eq PowerProfileMonitor Source # | |
Defined in GI.Gio.Interfaces.PowerProfileMonitor (==) :: PowerProfileMonitor -> PowerProfileMonitor -> Bool # (/=) :: PowerProfileMonitor -> PowerProfileMonitor -> Bool # | |
GObject PowerProfileMonitor Source # | |
Defined in GI.Gio.Interfaces.PowerProfileMonitor | |
ManagedPtrNewtype PowerProfileMonitor Source # | |
TypedObject PowerProfileMonitor Source # | |
Defined in GI.Gio.Interfaces.PowerProfileMonitor | |
HasParentTypes PowerProfileMonitor Source # | |
Defined in GI.Gio.Interfaces.PowerProfileMonitor | |
IsGValue (Maybe PowerProfileMonitor) Source # | Convert |
Defined in GI.Gio.Interfaces.PowerProfileMonitor gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe PowerProfileMonitor -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe PowerProfileMonitor) # | |
type ParentTypes PowerProfileMonitor Source # | |
Defined in GI.Gio.Interfaces.PowerProfileMonitor |
class (GObject o, IsDescendantOf PowerProfileMonitor o) => IsPowerProfileMonitor o Source #
Type class for types which can be safely cast to PowerProfileMonitor
, for instance with toPowerProfileMonitor
.
Instances
(GObject o, IsDescendantOf PowerProfileMonitor o) => IsPowerProfileMonitor o Source # | |
Defined in GI.Gio.Interfaces.PowerProfileMonitor |
toPowerProfileMonitor :: (MonadIO m, IsPowerProfileMonitor o) => o -> m PowerProfileMonitor Source #
Cast to PowerProfileMonitor
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, init, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getPowerSaverEnabled, getProperty, getQdata.
Setters
dupDefault
powerProfileMonitorDupDefault Source #
:: (HasCallStack, MonadIO m) | |
=> m PowerProfileMonitor | Returns: a new reference to the default |
Gets a reference to the default PowerProfileMonitor
for the system.
Since: 2.70
getPowerSaverEnabled
powerProfileMonitorGetPowerSaverEnabled Source #
:: (HasCallStack, MonadIO m, IsPowerProfileMonitor a) | |
=> a |
|
-> m Bool | Returns: Whether the system is in “Power Saver” mode. |
Gets whether the system is in “Power Saver” mode.
You are expected to listen to the
PowerProfileMonitor
::notify
powerSaverEnabled signal to know when the profile has
changed.
Since: 2.70
Properties
powerSaverEnabled
Whether “Power Saver” mode is enabled on the system.
Since: 2.70
getPowerProfileMonitorPowerSaverEnabled :: (MonadIO m, IsPowerProfileMonitor o) => o -> m Bool Source #
Get the value of the “power-saver-enabled
” property.
When overloading is enabled, this is equivalent to
get
powerProfileMonitor #powerSaverEnabled