taffybar-2.1.1: 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
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 #

batteryLog :: MonadIO m => Priority -> String -> m () 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.

dummyMethodError :: MethodError Source #

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.

getBatteryPaths :: TaffyIO (Either MethodError [ObjectPath]) Source #

registerForAnyUPowerPropertiesChanged :: (Signal -> String -> Map String Variant -> [String] -> IO ()) -> ReaderT Context IO SignalHandler Source #

monitorDisplayBattery :: TaffyIO (Chan 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.