summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/Batt.hs
diff options
context:
space:
mode:
authorRJ Regenold <rjregenold@gmail.com>2013-04-06 09:49:49 -0500
committerRJ Regenold <rjregenold@gmail.com>2013-04-06 09:49:49 -0500
commit3ddada25d66d3254376c3bb2cba33925221da788 (patch)
treebf428bdc6b69bb5fe43fab7fb432092d0d1a332b /src/Plugins/Monitors/Batt.hs
parentf51f468a6d40e2c348c38b0e90c55b3cc60be140 (diff)
downloadxmobar-3ddada25d66d3254376c3bb2cba33925221da788.tar.gz
xmobar-3ddada25d66d3254376c3bb2cba33925221da788.tar.bz2
caps battery percentage at 100%.
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