taffybar-3.2.5: 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 Source #

data BatteryTechnology Source #

Instances

Instances details
Enum BatteryTechnology Source # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

Eq BatteryTechnology Source # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

Ord BatteryTechnology Source # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

Show BatteryTechnology Source # 
Instance details

Defined in System.Taffybar.DBus.Client.Params

data BatteryType Source #

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

batteryPrefix :: String Source #

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

isBattery :: ObjectPath -> Bool Source #

Determine if a power source is a battery.

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

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

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

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

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

setupDisplayBatteryChanVar :: [String] -> TaffyIO DisplayBatteryChanVar Source #

Start the monitoring of the display battery, and setup the associated channel and mvar for the current state.

monitorDisplayBattery :: [String] -> TaffyIO (BroadcastChan In BatteryInfo, MVar BatteryInfo) Source #

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

refreshBatteriesOnPropChange :: TaffyIO () Source #

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 () Source #

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