taffybar-0.1.2: A desktop bar similar to xmobar, but with more GUI

System.Information.Battery

Contents

Description

This is a simple library to query the Linux UPower daemon (via DBus) for battery information. Currently, it only retrieves information for the first battery it finds.

Synopsis

Types

data BatteryContext

An opaque wrapper around some internal library state

Accessors

batteryContextNew :: IO (Maybe BatteryContext)

Construct a battery context if possible. This could fail if the UPower daemon is not running. The context can be used to get actual battery state with getBatteryInfo.

getBatteryInfo :: BatteryContext -> IO BatteryInfo

Query the UPower daemon about information on a specific battery. If some fields are not actually present, they may have bogus values here. Don't bet anything critical on it.