diff options
author | Eric Mrak <mail@ericmrak.info> | 2014-03-15 14:44:27 -0700 |
---|---|---|
committer | Eric Mrak <mail@ericmrak.info> | 2014-03-15 14:56:05 -0700 |
commit | 2992cab82cbc1a30c6cdf2195b67a418bf63f8e9 (patch) | |
tree | dae252bd15603122cf16677c23775d9467952219 /src/Plugins | |
parent | b1c1b938123b585ccdb66c69e1e7a2903a8e97ad (diff) | |
download | xmobar-2992cab82cbc1a30c6cdf2195b67a418bf63f8e9.tar.gz xmobar-2992cab82cbc1a30c6cdf2195b67a418bf63f8e9.tar.bz2 |
adding showLogVBar
Diffstat (limited to 'src/Plugins')
-rw-r--r-- | src/Plugins/Monitors/Common.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs index ecc9db4..70f1b5f 100644 --- a/src/Plugins/Monitors/Common.hs +++ b/src/Plugins/Monitors/Common.hs @@ -49,6 +49,7 @@ module Plugins.Monitors.Common ( , showPercentBar , showVerticalBar , showLogBar + , showLogVBar , showWithUnits , takeDigits , showDigits @@ -470,3 +471,14 @@ showLogBar f v = do | x <= ll = 1 / bw | otherwise = f + logBase 2 (x / hh) / bw showPercentBar v $ choose v + +showLogVBar :: Float -> Float -> Monitor String +showLogVBar f v = do + h <- fromIntegral `fmap` getConfigValue high + l <- fromIntegral `fmap` getConfigValue low + bw <- fromIntegral `fmap` getConfigValue barWidth + let [ll, hh] = sort [l, h] + choose x | x == 0.0 = 0 + | x <= ll = 1 / bw + | otherwise = f + logBase 2 (x / hh) / bw + showVerticalBar v $ choose v |