From 49ab20e6360456f8d8fbcdc931406b5cf7bd0cca Mon Sep 17 00:00:00 2001 From: Eric Mrak Date: Sat, 15 Mar 2014 14:56:13 -0700 Subject: Net plugin has txvbar and rxvbar --- readme.md | 12 ++++++------ src/Plugins/Monitors/Net.hs | 13 +++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index 8e0496a..47ccf9c 100644 --- a/readme.md +++ b/readme.md @@ -672,9 +672,9 @@ something like: `%eth0%` - Args: default monitor arguments - Variables that can be used with the `-t`/`--template` argument: - `dev`, `rx`, `tx`, `rxbar`, `txbar`. Reception and transmission - rates (`rx` and `tx`) are displayed in Kbytes per second, and you - can set the `-S` to "True" to make them displayed with units (the + `dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `txbar`, `txvbar`. Reception and + transmission rates (`rx` and `tx`) are displayed in Kbytes per second, + and you can set the `-S` to "True" to make them displayed with units (the string "Kb/s"). - Default template: `: KB|KB` @@ -684,9 +684,9 @@ something like: - Aliases to "dynnetwork" - Args: default monitor arguments - Variables that can be used with the `-t`/`--template` argument: - `dev`, `rx`, `tx`, `rxbar`, `txbar`. Reception and transmission - rates (`rx` and `tx`) are displayed in Kbytes per second, and you - can set the `-S` to "True" to make them displayed with units (the + `dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `txbar`, `txvbar`. Reception and + transmission rates (`rx` and `tx`) are displayed in Kbytes per second, + and you can set the `-S` to "True" to make them displayed with units (the string "Kb/s"). - Default template: `: KB|KB` diff --git a/src/Plugins/Monitors/Net.hs b/src/Plugins/Monitors/Net.hs index 2117a2d..c2e1cf2 100644 --- a/src/Plugins/Monitors/Net.hs +++ b/src/Plugins/Monitors/Net.hs @@ -53,7 +53,7 @@ instance Ord NetDev where netConfig :: IO MConfig netConfig = mkMConfig ": KB|KB" -- template - ["dev", "rx", "tx", "rxbar", "txbar"] -- available replacements + ["dev", "rx", "tx", "rxbar", "rxvbar", "txbar", "txvbar"] -- available replacements operstateDir :: String -> FilePath operstateDir d = "/sys/class/net" d "operstate" @@ -97,22 +97,23 @@ findNetDev dev = do isDev (NI d) = d == dev isDev NA = False -formatNet :: Float -> Monitor (String, String) +formatNet :: Float -> Monitor (String, String, String) formatNet d = do s <- getConfigValue useSuffix dd <- getConfigValue decDigits let str = if s then (++"Kb/s") . showDigits dd else showDigits dd b <- showLogBar 0.9 d + vb <- showLogVBar 0.9 d x <- showWithColors str d - return (x, b) + return (x, b, vb) printNet :: NetDev -> Monitor String printNet nd = case nd of ND d r t -> do - (rx, rb) <- formatNet r - (tx, tb) <- formatNet t - parseTemplate [d,rx,tx,rb,tb] + (rx, rb, rvb) <- formatNet r + (tx, tb, tvb) <- formatNet t + parseTemplate [d,rx,tx,rb,rvb,tb,tvb] NI _ -> return "" NA -> getConfigValue naString -- cgit v1.2.3