summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEric Mrak <mail@ericmrak.info>2014-03-13 20:23:34 -0700
committerEric Mrak <mail@ericmrak.info>2014-03-13 20:23:34 -0700
commit4e734b02da0eeffa14bf5960e92f4e7dcdac23dd (patch)
tree24b426392076a51f3b64f8afe0d7f486b638ba6b
parent7457cf578a283264e0c1297eb5a672601aca9a38 (diff)
downloadxmobar-4e734b02da0eeffa14bf5960e92f4e7dcdac23dd.tar.gz
xmobar-4e734b02da0eeffa14bf5960e92f4e7dcdac23dd.tar.bz2
Cpu now has vbar
-rw-r--r--readme.md2
-rw-r--r--src/Plugins/Monitors/Cpu.hs7
-rw-r--r--src/Plugins/Monitors/MultiCpu.hs2
3 files changed, 7 insertions, 4 deletions
diff --git a/readme.md b/readme.md
index ceb3e9d..ac8f08b 100644
--- a/readme.md
+++ b/readme.md
@@ -724,7 +724,7 @@ something like:
- Aliases to `cpu`
- Args: default monitor arguments
- Variables that can be used with the `-t`/`--template` argument:
- `total`, `bar`, `user`, `nice`, `system`, `idle`, `iowait`
+ `total`, `bar`, `vbar`, `user`, `nice`, `system`, `idle`, `iowait`
- Default template: `Cpu: <total>%`
### `MultiCpu Args RefreshRate`
diff --git a/src/Plugins/Monitors/Cpu.hs b/src/Plugins/Monitors/Cpu.hs
index 6627f53..7116f5e 100644
--- a/src/Plugins/Monitors/Cpu.hs
+++ b/src/Plugins/Monitors/Cpu.hs
@@ -22,7 +22,7 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
cpuConfig :: IO MConfig
cpuConfig = mkMConfig
"Cpu: <total>%"
- ["bar","total","user","nice","system","idle","iowait"]
+ ["bar","vbar","total","user","nice","system","idle","iowait"]
type CpuDataRef = IORef [Float]
@@ -43,12 +43,13 @@ parseCpu cref =
return percent
formatCpu :: [Float] -> Monitor [String]
-formatCpu [] = return $ replicate 6 ""
+formatCpu [] = return $ replicate 8 ""
formatCpu xs = do
let t = sum $ take 3 xs
b <- showPercentBar (100 * t) t
+ v <- showVerticalBar (100 * t)
ps <- showPercentsWithColors (t:xs)
- return (b:ps)
+ return (b:v:ps)
runCpu :: CpuDataRef -> [String] -> Monitor String
runCpu cref _ =
diff --git a/src/Plugins/Monitors/MultiCpu.hs b/src/Plugins/Monitors/MultiCpu.hs
index 48c0bc1..2089fca 100644
--- a/src/Plugins/Monitors/MultiCpu.hs
+++ b/src/Plugins/Monitors/MultiCpu.hs
@@ -19,7 +19,9 @@ import qualified Data.ByteString.Lazy.Char8 as B
import Data.List (isPrefixOf, transpose, unfoldr)
import Data.IORef (IORef, newIORef, readIORef, writeIORef)
+variables :: [String]
variables = ["bar", "vbar","total","user","nice","system","idle"]
+vNum :: Int
vNum = length variables
multiCpuConfig :: IO MConfig