diff options
| -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" | 
