summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-02-28 04:40:52 +0000
committerjao <jao@gnu.org>2020-03-05 17:55:12 +0000
commitbe9b21d52767e42de636716139b84285c29ff5ec (patch)
tree5646056a3b7c698920dc1531cca3c102e0694787 /src/Xmobar/Plugins/Monitors
parentae16735a74a711c0ed7adf6e1df18b75a5a26205 (diff)
downloadxmobar-be9b21d52767e42de636716139b84285c29ff5ec.tar.gz
xmobar-be9b21d52767e42de636716139b84285c29ff5ec.tar.bz2
Network: up indicator
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r--src/Xmobar/Plugins/Monitors/Net.hs9
1 files changed, 6 insertions, 3 deletions
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