summaryrefslogtreecommitdiffhomepage
path: root/Monitors
diff options
context:
space:
mode:
Diffstat (limited to 'Monitors')
-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"