summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugins/Monitors/Common.hs')
-rw-r--r--src/Plugins/Monitors/Common.hs11
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