summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/Common.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-07 16:26:09 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-07 16:26:09 +0100
commit4768d84d13a015c76200010e32ae1515264fd1bb (patch)
treee78d47d15b5cc9e86f3db72b89a072a7dd22bc08 /Plugins/Monitors/Common.hs
parent70d92eae0a496b995607c111cc31d7a55099fbc1 (diff)
downloadxmobar-4768d84d13a015c76200010e32ae1515264fd1bb.tar.gz
xmobar-4768d84d13a015c76200010e32ae1515264fd1bb.tar.bz2
Fix for swap used ratio (issue 24)
Thanks to Dan Brown for pointing this out. I've applied a modified version of his patch (inclusion of % will be treated separately).
Diffstat (limited to 'Plugins/Monitors/Common.hs')
-rw-r--r--Plugins/Monitors/Common.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index 9362fd8..c90c616 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -39,6 +39,7 @@ module Plugins.Monitors.Common (
, showWithPadding
, showWithColors
, showWithColors'
+ , showPercentWithColors
, showPercentsWithColors
, showPercentBar
, showLogBar
@@ -386,6 +387,9 @@ showPercentsWithColors fs =
do fstrs <- mapM floatToPercent fs
zipWithM (showWithColors . const) fstrs (map (*100) fs)
+showPercentWithColors :: Float -> Monitor String
+showPercentWithColors f = liftM head $ showPercentsWithColors [f]
+
showPercentBar :: Float -> Float -> Monitor String
showPercentBar v x = do
bb <- getConfigValue barBack