summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2013-10-27 15:24:37 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2013-10-27 15:24:37 +0100
commit69a552a786d05011e3bad23f38add8f99c62468c (patch)
tree5e189b1c34b872481788d1d4a728bab058f08557 /src/Plugins
parentd7a3df4de84acf1a7a8cd714feb4a2cdd42a127d (diff)
downloadxmobar-69a552a786d05011e3bad23f38add8f99c62468c.tar.gz
xmobar-69a552a786d05011e3bad23f38add8f99c62468c.tar.bz2
Using width options in wattage display (fixes #118)
Diffstat (limited to 'src/Plugins')
-rw-r--r--src/Plugins/Monitors/Batt.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs
index 4c0232f..410aec6 100644
--- a/src/Plugins/Monitors/Batt.hs
+++ b/src/Plugins/Monitors/Batt.hs
@@ -163,8 +163,8 @@ runBatt' bfs args = do
case c of
Result x w t s ->
do l <- fmtPercent x
- let ts = [fmtTime $ floor t, fmtWatts w opts suffix d]
- parseTemplate (l ++ s:ts)
+ ws <- fmtWatts w opts suffix d
+ parseTemplate (l ++ [s, fmtTime $ floor t, ws])
NA -> return "N/A"
where fmtPercent :: Float -> Monitor [String]
fmtPercent x = do
@@ -172,7 +172,9 @@ runBatt' bfs args = do
p <- showPercentWithColors x'
b <- showPercentBar (100 * x') x'
return [b, p]
- fmtWatts x o s d = color x o $ showDigits d x ++ (if s then "W" else "")
+ fmtWatts x o s d = do
+ ws <- showWithPadding $ showDigits d x ++ (if s then "W" else "")
+ return $ color x o ws
fmtTime :: Integer -> String
fmtTime x = hours ++ ":" ++ if length minutes == 2
then minutes else '0' : minutes