diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-03-19 21:33:24 +0100 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-03-19 21:33:24 +0100 |
commit | dc171e4a07e597f9f5d7839c231b8b9c3ae19437 (patch) | |
tree | cae45f74db3ffd894b7fb593288ebc46538aede3 /Plugins/Monitors/MultiCpu.hs | |
parent | 4f8ba03c51570925fb59e90e65747da37a2a4b65 (diff) | |
download | xmobar-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/MultiCpu.hs')
-rw-r--r-- | Plugins/Monitors/MultiCpu.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs index 360671b..223ff24 100644 --- a/Plugins/Monitors/MultiCpu.hs +++ b/Plugins/Monitors/MultiCpu.hs @@ -19,10 +19,10 @@ import qualified Data.ByteString.Lazy.Char8 as B import Data.List (isPrefixOf) multiCpuConfig :: IO MConfig -multiCpuConfig = mkMConfig - "Cpu: <total>" - [ k ++ n | n <- "" : map show [0 :: Int ..] - , k <- ["total","user","nice","system","idle"]] +multiCpuConfig = + mkMConfig "Cpu: <total>" + [ k ++ n | n <- "" : map show [0 :: Int ..] + , k <- ["bar","total","user","nice","system","idle"]] cpuData :: IO [[Float]] @@ -53,8 +53,11 @@ formatMultiCpus xs = fmap concat $ mapM formatCpu xs formatCpu :: [Float] -> Monitor [String] formatCpu xs - | length xs < 4 = showPercentsWithColors $ replicate 5 0.0 - | otherwise = showPercentsWithColors $ (foldr (+) 0 $ take 3 xs) : xs + | length xs < 4 = showPercentsWithColors $ replicate 6 0.0 + | otherwise = let t = foldr (+) 0 $ take 3 xs + in do b <- showPercentBar (100 * t) t + ps <- showPercentsWithColors (t:xs) + return (b:ps) runMultiCpu :: [String] -> Monitor String runMultiCpu _ = |