diff options
author | jao <jao@gnu.org> | 2016-08-10 23:31:49 +0200 |
---|---|---|
committer | jao <jao@gnu.org> | 2016-08-10 23:31:49 +0200 |
commit | 75b954d8556efc18a9b829bb1c3246c59f15eab7 (patch) | |
tree | a92ea87cc254b7c345d4e41898b1725ecbf7f1c6 /src/Plugins | |
parent | 37202c6552e1d3618d00e72ba033db8f51d6c4d1 (diff) | |
download | xmobar-75b954d8556efc18a9b829bb1c3246c59f15eab7.tar.gz xmobar-75b954d8556efc18a9b829bb1c3246c59f15eab7.tar.bz2 |
Battery: inferring status from watts/ac when Unknown
Diffstat (limited to 'src/Plugins')
-rw-r--r-- | src/Plugins/Monitors/Batt.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs index cc16ec8..38c325f 100644 --- a/src/Plugins/Monitors/Batt.hs +++ b/src/Plugins/Monitors/Batt.hs @@ -187,7 +187,11 @@ readBatteries opts bfs = statuses = map (fromMaybe Unknown . readMaybe) (sort (map status bats)) acst = mostCommonDef Unknown $ filter (Unknown/=) statuses - return $ if isNaN left then NA else Result left watts time acst + racst | acst /= Unknown = acst + | not ac = Discharging + | left == 0 = Idle + | otherwise = Charging + return $ if isNaN left then NA else Result left watts time racst runBatt :: [String] -> Monitor String runBatt = runBatt' ["BAT0","BAT1","BAT2"] |