From 3e5a0a6c8e231db39c4d2593abb035ee0d5149df Mon Sep 17 00:00:00 2001 From: Eric Mrak Date: Tue, 11 Mar 2014 23:14:23 -0700 Subject: adding showVerticalBar option for monitors to use --- src/Plugins/Monitors/Common.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- cgit v1.2.3