summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--readme.md9
-rw-r--r--src/Xmobar/Plugins/Monitors/Net.hs9
2 files changed, 12 insertions, 6 deletions
diff --git a/readme.md b/readme.md
index 51c73cf..2a57860 100644
--- a/readme.md
+++ b/readme.md
@@ -798,11 +798,14 @@ specification, such as `("clear", "<icon=weather-clear.xbm/>")`.
- Args: default monitor arguments, plus:
- `--rx-icon-pattern`: dynamic string for reception rate in `rxipat`.
- `--tx-icon-pattern`: dynamic string for transmission rate in `txipat`.
+ - `--up`: string used for the `up` variable value when the
+ interface is up.
- Variables that can be used with the `-t`/`--template` argument:
`dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `rxipat`, `txbar`, `txvbar`,
- `txipat`. Reception and transmission rates (`rx` and `tx`) are displayed
- by default as Kb/s, without any suffixes, but you can set the `-S` to
- "True" to make them displayed with adaptive units (Kb/s, Mb/s, etc.).
+ `txipat`, `up`. Reception and transmission rates (`rx` and `tx`) are
+ displayed by default as Kb/s, without any suffixes, but you can set
+ the `-S` to "True" to make them displayed with adaptive units (Kb/s,
+ Mb/s, etc.).
- Default template: `<dev>: <rx>KB|<tx>KB`
### `DynNetwork Args RefreshRate`
diff --git a/src/Xmobar/Plugins/Monitors/Net.hs b/src/Xmobar/Plugins/Monitors/Net.hs
index db11724..97deacd 100644
--- a/src/Xmobar/Plugins/Monitors/Net.hs
+++ b/src/Xmobar/Plugins/Monitors/Net.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Plugins.Monitors.Net
--- Copyright : (c) 2011, 2012, 2013, 2014, 2017 Jose Antonio Ortega Ruiz
+-- Copyright : (c) 2011, 2012, 2013, 2014, 2017, 2020 Jose Antonio Ortega Ruiz
-- (c) 2007-2010 Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -49,6 +49,7 @@ data NetOpts = NetOpts
{ rxIconPattern :: Maybe IconPattern
, txIconPattern :: Maybe IconPattern
, onlyDevList :: Maybe DevList
+ , upIndicator :: String
}
defaultOpts :: NetOpts
@@ -56,6 +57,7 @@ defaultOpts = NetOpts
{ rxIconPattern = Nothing
, txIconPattern = Nothing
, onlyDevList = Nothing
+ , upIndicator = "+"
}
options :: [OptDescr (NetOpts -> NetOpts)]
@@ -64,6 +66,7 @@ options =
o { rxIconPattern = Just $ parseIconPattern x }) "") ""
, Option "" ["tx-icon-pattern"] (ReqArg (\x o ->
o { txIconPattern = Just $ parseIconPattern x }) "") ""
+ , Option "" ["up"] (ReqArg (\x o -> o { upIndicator = x }) "") ""
, Option "" ["devices"] (ReqArg (\x o ->
o { onlyDevList = Just $ parseDevList x }) "") ""
]
@@ -103,7 +106,7 @@ instance Ord num => Ord (NetDevInfo num) where
netConfig :: IO MConfig
netConfig = mkMConfig
"<dev>: <rx>KB|<tx>KB" -- template
- ["dev", "rx", "tx", "rxbar", "rxvbar", "rxipat", "txbar", "txvbar", "txipat"] -- available replacements
+ ["dev", "rx", "tx", "rxbar", "rxvbar", "rxipat", "txbar", "txvbar", "txipat", "up"] -- available replacements
operstateDir :: String -> FilePath
operstateDir d = "/sys/class/net" </> d </> "operstate"
@@ -160,7 +163,7 @@ printNet opts nd =
N d (ND r t) -> do
(rx, rb, rvb, ripat) <- formatNet (rxIconPattern opts) r
(tx, tb, tvb, tipat) <- formatNet (txIconPattern opts) t
- parseTemplate [d,rx,tx,rb,rvb,ripat,tb,tvb,tipat]
+ parseTemplate [d,rx,tx,rb,rvb,ripat,tb,tvb,tipat, upIndicator opts]
N _ NI -> return ""
NA -> getConfigValue naString