| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
System.Taffybar.Information.Battery
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.
- data BatteryContext
- data BatteryInfo = BatteryInfo {- batteryNativePath :: Text
- batteryVendor :: Text
- batteryModel :: Text
- batterySerial :: Text
- batteryType :: BatteryType
- batteryPowerSupply :: Bool
- batteryHasHistory :: Bool
- batteryHasStatistics :: Bool
- batteryOnline :: Bool
- batteryEnergy :: Double
- batteryEnergyEmpty :: Double
- batteryEnergyFull :: Double
- batteryEnergyFullDesign :: Double
- batteryEnergyRate :: Double
- batteryVoltage :: Double
- batteryTimeToEmpty :: Int64
- batteryTimeToFull :: Int64
- batteryPercentage :: Double
- batteryIsPresent :: Bool
- batteryState :: BatteryState
- batteryIsRechargable :: Bool
- batteryCapacity :: Double
- batteryTechnology :: BatteryTechnology
 
- data BatteryState
- data BatteryTechnology
- data BatteryType
- batteryContextsNew :: IO [BatteryContext]
- getBatteryInfo :: BatteryContext -> IO (Maybe BatteryInfo)
Types
data BatteryContext Source #
An opaque wrapper around some internal library state
data BatteryInfo Source #
There are a few fields supported by UPower that aren't exposed here.. could be easily.
Constructors
| BatteryInfo | |
| Fields 
 | |
data BatteryState Source #
Constructors
| BatteryStateUnknown | |
| BatteryStateCharging | |
| BatteryStateDischarging | |
| BatteryStateEmpty | |
| BatteryStateFullyCharged | |
| BatteryStatePendingCharge | |
| BatteryStatePendingDischarge | 
Instances
data BatteryTechnology Source #
data BatteryType Source #
Constructors
| BatteryTypeUnknown | |
| BatteryTypeLinePower | |
| BatteryTypeBatteryType | |
| BatteryTypeUps | |
| BatteryTypeMonitor | |
| BatteryTypeMouse | |
| BatteryTypeKeyboard | |
| BatteryTypePda | |
| BatteryTypePhone | 
Instances
Accessors
batteryContextsNew :: IO [BatteryContext] Source #
Construct a battery context for every battery in the system. This
 could fail if the UPower daemon is not running. The contexts can be
 used to get actual battery state with getBatteryInfo.
getBatteryInfo :: BatteryContext -> IO (Maybe BatteryInfo) Source #
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.