diff options
author | Eric Mrak <mail@ericmrak.info> | 2014-03-11 23:14:23 -0700 |
---|---|---|
committer | Eric Mrak <mail@ericmrak.info> | 2014-03-13 20:07:54 -0700 |
commit | 3e5a0a6c8e231db39c4d2593abb035ee0d5149df (patch) | |
tree | 3a22d2119aa419757a5d89e582504bd5eab56486 /src/Plugins | |
parent | 04ffb1e36db9b49ffe393ec6bc099a3fe505e3b8 (diff) | |
download | xmobar-3e5a0a6c8e231db39c4d2593abb035ee0d5149df.tar.gz xmobar-3e5a0a6c8e231db39c4d2593abb035ee0d5149df.tar.bz2 |
adding showVerticalBar option for monitors to use
Diffstat (limited to 'src/Plugins')
-rw-r--r-- | src/Plugins/Monitors/Common.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs index 9ebe828..40545cc 100644 --- a/src/Plugins/Monitors/Common.hs +++ b/src/Plugins/Monitors/Common.hs @@ -47,6 +47,7 @@ module Plugins.Monitors.Common ( , showPercentWithColors , showPercentsWithColors , showPercentBar + , showVerticalBar , showLogBar , showWithUnits , takeDigits @@ -63,6 +64,7 @@ import qualified Data.ByteString.Lazy.Char8 as B import Data.IORef import qualified Data.Map as Map import Data.List +import Data.Char import Numeric import Text.ParserCombinators.Parsec import System.Console.GetOpt @@ -449,6 +451,15 @@ showPercentBar v x = do s <- colorizeString v (take len $ cycle bf) return $ s ++ take (bw - len) (cycle bb) +showVerticalBar :: Float -> Monitor String +showVerticalBar x = colorizeString x [convert x] + where convert :: Float -> Char + convert val + | t <= 9600 = ' ' + | t > 9608 = chr 9608 + | otherwise = chr t + where t = 9600 + ((round val) `div` 12) + showLogBar :: Float -> Float -> Monitor String showLogBar f v = do h <- fromIntegral `fmap` getConfigValue high |