From 69a552a786d05011e3bad23f38add8f99c62468c Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 27 Oct 2013 15:24:37 +0100 Subject: Using width options in wattage display (fixes #118) --- src/Plugins/Monitors/Batt.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3