summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2016-05-05 06:24:46 +0200
committerjao <jao@gnu.org>2016-05-05 06:24:46 +0200
commit196a7bcd8145aece2a2c6cae5b76402c69c4fac0 (patch)
treeb39a9dd4e3fe7b9ead608dcb24317e060dd2ca16 /src/Plugins
parent1e9d5e4e99c9a737a8ffea602ea10d6e0f17b3de (diff)
downloadxmobar-196a7bcd8145aece2a2c6cae5b76402c69c4fac0.tar.gz
xmobar-196a7bcd8145aece2a2c6cae5b76402c69c4fac0.tar.bz2
Batt nits
Diffstat (limited to 'src/Plugins')
-rw-r--r--src/Plugins/Monitors/Batt.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs
index 7e83f13..2ceac09 100644
--- a/src/Plugins/Monitors/Batt.hs
+++ b/src/Plugins/Monitors/Batt.hs
@@ -189,12 +189,13 @@ runBatt' bfs args = do
c <- io $ readBatteries opts =<< mapM batteryFiles bfs
suffix <- getConfigValue useSuffix
d <- getConfigValue decDigits
+ nas <- getConfigValue naString
case c of
Result x w t s ->
do l <- fmtPercent x
ws <- fmtWatts w opts suffix d
si <- getIconPattern opts s x
- parseTemplate (l ++ [fmtStatus opts s, fmtTime $ floor t, ws, si])
+ parseTemplate (l ++ [fmtStatus opts s nas, fmtTime $ floor t, ws, si])
NA -> getConfigValue naString
where fmtPercent :: Float -> Monitor [String]
fmtPercent x = do
@@ -211,11 +212,11 @@ runBatt' bfs args = do
then minutes else '0' : minutes
where hours = show (x `div` 3600)
minutes = show ((x `mod` 3600) `div` 60)
- fmtStatus opts Idle = idleString opts
- fmtStatus opts Unknown = idleString opts
- fmtStatus opts Full = idleString opts
- fmtStatus opts Charging = onString opts
- fmtStatus opts Discharging = offString opts
+ fmtStatus opts Idle _ = idleString opts
+ fmtStatus _ Unknown na = na
+ fmtStatus opts Full _ = idleString opts
+ fmtStatus opts Charging _ = onString opts
+ fmtStatus opts Discharging _ = offString opts
maybeColor Nothing str = str
maybeColor (Just c) str = "<fc=" ++ c ++ ">" ++ str ++ "</fc>"
color x o | x >= 0 = maybeColor (posColor o)
@@ -225,8 +226,8 @@ runBatt' bfs args = do
getIconPattern opts st x = do
let x' = minimum [1, x]
case st of
+ Unknown -> showIconPattern (offIconPattern opts) x'
Idle -> showIconPattern (idleIconPattern opts) x'
- Unknown -> showIconPattern (idleIconPattern opts) x'
Full -> showIconPattern (idleIconPattern opts) x'
Charging -> showIconPattern (onIconPattern opts) x'
Discharging -> showIconPattern (offIconPattern opts) x'