gi-gio-2.0.35: Gio bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Gio.Interfaces.PowerProfileMonitor

Contents

- Exported types
- Methods
  - dupDefault
  - getPowerSaverEnabled
- Properties
  - powerSaverEnabled

Description

`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.

Constructors

PowerProfileMonitor (ManagedPtr PowerProfileMonitor) |

#### Instances

Instances details

Eq PowerProfileMonitor Source # |
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor Methods (==) :: PowerProfileMonitor -> PowerProfileMonitor -> Bool Source # (/=) :: PowerProfileMonitor -> PowerProfileMonitor -> Bool Source #
GObject PowerProfileMonitor Source # |
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor
ManagedPtrNewtype PowerProfileMonitor Source # |
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor Methods toManagedPtr :: PowerProfileMonitor -> ManagedPtr PowerProfileMonitor Source #
TypedObject PowerProfileMonitor Source # |
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor Methods glibType :: IO GType Source #
HasParentTypes PowerProfileMonitor Source # |
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor
IsGValue (Maybe PowerProfileMonitor) Source # | Convert `PowerProfileMonitor` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe PowerProfileMonitor -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe PowerProfileMonitor) Source #
type ParentTypes PowerProfileMonitor Source # |
Instance details Defined in GI.Gio.Interfaces.PowerProfileMonitor type ParentTypes PowerProfileMonitor = '[Initable, Object]

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

Instances details

(GObject o, IsDescendantOf PowerProfileMonitor o) => IsPowerProfileMonitor o Source # |
Instance details 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

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, init, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getPowerSaverEnabled, getProperty, getQdata.

#### Setters

setData, setDataFull, setProperty.

## dupDefault

powerProfileMonitorDupDefault Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m PowerProfileMonitor | Returns: a new reference to the default `PowerProfileMonitor`

Gets a reference to the default `PowerProfileMonitor` for the system.

Since: 2.70

## getPowerSaverEnabled

powerProfileMonitorGetPowerSaverEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsPowerProfileMonitor a) |
=> a | `monitor`: a `PowerProfileMonitor`
-> 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