summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKrzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>2007-07-10 16:15:50 +0200
committerKrzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>2007-07-10 16:15:50 +0200
commit6db48566e47efcbe8e26f3077712cc08b41701d4 (patch)
tree1400916fb8cc0ede8cb5ef762e05e8716dbcb231
parent6eabba5d8f8912450b264e2fc345493791e0b2d8 (diff)
downloadxmobar-6db48566e47efcbe8e26f3077712cc08b41701d4.tar.gz
xmobar-6db48566e47efcbe8e26f3077712cc08b41701d4.tar.bz2
Formatting usedratio in Monitors.Swap
darcs-hash:20070710141550-ba08c-383d0d84c0d8b31fae5b35e6b16070ba4d2e41f3.gz
-rw-r--r--Monitors/Swap.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Monitors/Swap.hs b/Monitors/Swap.hs
index 9fb6cc0..6cfdbdd 100644
--- a/Monitors/Swap.hs
+++ b/Monitors/Swap.hs
@@ -35,12 +35,16 @@ parseMEM =
let p x y = flip (/) 1024 . read . stringParser x $ y
tot = p (1,11) file
free = p (1,12) file
- return [tot, (tot - free), free, (tot - free) / tot * 100]
+ return [tot, (tot - free), free, (tot - free) / tot]
formatSwap :: [Float] -> Monitor [String]
formatSwap x =
- do let f n = show (takeDigits 2 n)
- mapM (showWithColors f) x
+ do let f1 n = show (takeDigits 2 n)
+ f2 n = floatToPercent n
+ (hd, tl) = splitAt 3 x
+ firsts <- mapM (showWithColors f1) hd
+ lasts <- mapM (showWithColors f2) tl
+ return $ firsts ++ lasts
package :: String
package = "xmb-swap"