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

Safe HaskellNone
LanguageHaskell2010

System.Taffybar.Information.Battery

Contents

Description

This is a simple library to query the Linux UPower daemon (via DBus) for battery information.

Synopsis

Types

data BatteryState #

data BatteryTechnology #

Instances
Enum BatteryTechnology # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

Eq BatteryTechnology # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

Ord BatteryTechnology # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

Show BatteryTechnology # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

batteryLog :: MonadIO m => Priority -> String -> m () #

batteryLogF :: (MonadIO m, Show t) => Priority -> String -> t -> m () #

batteryPrefix :: String #

The prefix of name of battery devices path. UPower generates the object path as "battery" + "_" + basename of the sysfs object.

isBattery :: ObjectPath -> Bool #

Determine if a power source is a battery.

readDict :: IsVariant a => Map Text Variant -> Text -> a -> a #

A helper to read the variant contents of a dict with a default value.

readDictIntegral :: Map Text Variant -> Text -> Int32 -> Int #

Read the variant contents of a dict which is of an unknown integral type.

getBatteryInfo :: ObjectPath -> TaffyIO (Either MethodError 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.

monitorDisplayBattery :: TaffyIO (Chan BatteryInfo, MVar BatteryInfo) #

Monitor the DisplayDevice for changes, writing a new BatteryInfo object to returned MVar and Chan objects

refreshBatteriesOnPropChange :: TaffyIO () #

Call "refreshAllBatteries" whenever the BatteryInfo for the DisplayDevice is updated. This handles cases where there is a race between the signal that something is updated and the update actually being visible. See https://github.com/taffybar/taffybar/issues/330 for more details.

refreshAllBatteries :: TaffyIO () #

Request a refresh of all UPower batteries. This is only needed if UPower's refresh mechanism is not working properly.