summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/Cpu.hs
diff options
context:
space:
mode:
authorJose A Ortega Ruiz <jao@gnu.org>2010-03-19 21:33:24 +0100
committerJose A Ortega Ruiz <jao@gnu.org>2010-03-19 21:33:24 +0100
commitdc171e4a07e597f9f5d7839c231b8b9c3ae19437 (patch)
treecae45f74db3ffd894b7fb593288ebc46538aede3 /Plugins/Monitors/Cpu.hs
parent4f8ba03c51570925fb59e90e65747da37a2a4b65 (diff)
downloadxmobar-dc171e4a07e597f9f5d7839c231b8b9c3ae19437.tar.gz
xmobar-dc171e4a07e597f9f5d7839c231b8b9c3ae19437.tar.bz2
Usage bars
Ignore-this: 63fd21a117029674e33a9c4419dbc4de ASCII art bars for a bunch of monitors. darcs-hash:20100319203324-748be-2f927aa0e16d8874e10a04f0245427d32e0e53ce.gz
Diffstat (limited to 'Plugins/Monitors/Cpu.hs')
-rw-r--r--Plugins/Monitors/Cpu.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Plugins/Monitors/Cpu.hs b/Plugins/Monitors/Cpu.hs
index e813713..d94bd0f 100644
--- a/Plugins/Monitors/Cpu.hs
+++ b/Plugins/Monitors/Cpu.hs
@@ -20,7 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B
cpuConfig :: IO MConfig
cpuConfig = mkMConfig
"Cpu: <total>" -- template
- ["total","user","nice","system","idle"] -- available replacements
+ ["bar","total","user","nice","system","idle"] -- available replacements
cpuData :: IO [Float]
cpuData = do s <- B.readFile "/proc/stat"
@@ -40,7 +40,11 @@ parseCPU =
formatCpu :: [Float] -> Monitor [String]
formatCpu [] = return [""]
-formatCpu xs = showPercentsWithColors $ (foldr (+) 0 $ take 3 xs) : xs
+formatCpu xs = do
+ let t = foldr (+) 0 $ take 3 xs
+ b <- showPercentBar (100 * t) t
+ ps <- showPercentsWithColors (t:xs)
+ return (b:ps)
runCpu :: [String] -> Monitor String
runCpu _ =