summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/Batt.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugins/Monitors/Batt.hs')
-rw-r--r--src/Plugins/Monitors/Batt.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs
index 132b5a9..a593782 100644
--- a/src/Plugins/Monitors/Batt.hs
+++ b/src/Plugins/Monitors/Batt.hs
@@ -162,8 +162,9 @@ runBatt' bfs args = do
NA -> return "N/A"
where fmtPercent :: Float -> Monitor [String]
fmtPercent x = do
- p <- showPercentWithColors x
- b <- showPercentBar (100 * x) x
+ let x' = minimum [1, x]
+ 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 "")
fmtTime :: Integer -> String