diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-03-20 03:08:48 +0100 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-03-20 03:08:48 +0100 |
commit | 384659364b78a5b763aa07e29e767073d303c6e7 (patch) | |
tree | c79c9caa7dbe93603a4fd409adc7ae11103d50ee /Plugins | |
parent | 01931fdc886896e1700da4a37103e4df0d69e344 (diff) | |
download | xmobar-384659364b78a5b763aa07e29e767073d303c6e7.tar.gz xmobar-384659364b78a5b763aa07e29e767073d303c6e7.tar.bz2 |
Bars for DiskIO
Ignore-this: 50ae0b5d07377a8563acdede4dba31cf
darcs-hash:20100320020848-748be-4c1b8f64b056f026328348a3eb8ca6f367544285.gz
Diffstat (limited to 'Plugins')
-rw-r--r-- | Plugins/Monitors/Common.hs | 7 | ||||
-rw-r--r-- | Plugins/Monitors/Disk.hs | 6 | ||||
-rw-r--r-- | Plugins/Monitors/Net.hs | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs index 13f6323..9362fd8 100644 --- a/Plugins/Monitors/Common.hs +++ b/Plugins/Monitors/Common.hs @@ -41,6 +41,7 @@ module Plugins.Monitors.Common ( , showWithColors' , showPercentsWithColors , showPercentBar + , showLogBar , showWithUnits , takeDigits , showDigits @@ -394,6 +395,12 @@ showPercentBar v x = do s <- colorizeString v (take len $ cycle bf) return $ s ++ (take (bw - len) $ cycle bb) +showLogBar :: Float -> Float -> Monitor String +showLogBar f v = do + h <- fromIntegral `fmap` getConfigValue high + bw <- fromIntegral `fmap` getConfigValue barWidth + showPercentBar v $ f + (logBase 10 (v / h)) / bw + -- $threads doActionTwiceWithDelay :: Int -> IO [a] -> IO ([a], [a]) diff --git a/Plugins/Monitors/Disk.hs b/Plugins/Monitors/Disk.hs index f3c66a1..4cbe692 100644 --- a/Plugins/Monitors/Disk.hs +++ b/Plugins/Monitors/Disk.hs @@ -24,7 +24,8 @@ import qualified Data.ByteString.Lazy.Char8 as B import Data.List (isPrefixOf, find, intercalate) diskIOConfig :: IO MConfig -diskIOConfig = mkMConfig "" ["total", "read", "write"] +diskIOConfig = mkMConfig "" ["total", "read", "write", + "totalbar", "readbar", "writebar"] diskUConfig :: IO MConfig diskUConfig = mkMConfig "" @@ -105,8 +106,9 @@ devTemplates disks mounted dat = runDiskIO' :: (String, [Float]) -> Monitor String runDiskIO' (tmp, xs) = do s <- mapM (showWithColors speedToStr) xs + b <- mapM (showLogBar 0.8) xs setConfigValue tmp template - parseTemplate s + parseTemplate $ s ++ b runDiskIO :: [(String, String)] -> [String] -> Monitor String runDiskIO disks _ = do diff --git a/Plugins/Monitors/Net.hs b/Plugins/Monitors/Net.hs index 7fed311..d08f96e 100644 --- a/Plugins/Monitors/Net.hs +++ b/Plugins/Monitors/Net.hs @@ -64,9 +64,7 @@ netParser = formatNet :: Float -> Monitor (String, String) formatNet d = do - h <- getConfigValue high - let dx = 8 + logBase 10 (d / fromIntegral h) - b <- showPercentBar d $ max (dx / 10) 0 + b <- showLogBar 0.8 d x <- showWithColors f d return (x, b) where f s = showDigits 1 s ++ "Kb" |