diff options
-rw-r--r-- | news.md | 5 | ||||
-rw-r--r-- | src/Plugins/Monitors/Batt.hs | 8 |
2 files changed, 9 insertions, 4 deletions
@@ -16,7 +16,9 @@ _New features_ _Bug fixes_ - - Honour the "-d" option in `CoreTemp` ([github #115]) + - Honour the width options `-w`, `-m` and `-M` in battery monitors + watts display ([github #118]). + - Honour the `-d` option in `CoreTemp` ([github #115]) - Fix for systems not supporting PCRE regular expressions: we use now BCEs, so regex-compat should be enough everywhere (see [github #117]). @@ -28,6 +30,7 @@ _Bug fixes_ [github #117]: https://github.com/jaor/xmobar/issues/117 [github #125]: https://github.com/jaor/xmobar/issues/125 [issue #65]: http://code.google.com/p/xmobar/issues/detail?id=65 +[github #118]: https://github.com/jaor/xmobar/issues/118 ## Version 0.18 (June 5, 2013) 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 |