summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-03-30 22:23:10 +0100
committerjao <jao@gnu.org>2022-03-30 22:23:10 +0100
commit7af1ddc5ebbe9d651ffbc057614be18637e69939 (patch)
tree1b754ad28c697ced892215c43378b39afa58bc2b /src/Xmobar/Plugins/Monitors
parent211af7d4cb5b29e71bcfbedae8f8c86009e99ad0 (diff)
downloadxmobar-7af1ddc5ebbe9d651ffbc057614be18637e69939.tar.gz
xmobar-7af1ddc5ebbe9d651ffbc057614be18637e69939.tar.bz2
Fix: consistent use of configured nastring instead of hardcoded N/A
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r--src/Xmobar/Plugins/Monitors/Load.hs6
-rw-r--r--src/Xmobar/Plugins/Monitors/MPD.hs3
-rw-r--r--src/Xmobar/Plugins/Monitors/Swap.hs7
-rw-r--r--src/Xmobar/Plugins/Monitors/Thermal.hs2
-rw-r--r--src/Xmobar/Plugins/Monitors/Top.hs5
5 files changed, 11 insertions, 12 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Load.hs b/src/Xmobar/Plugins/Monitors/Load.hs
index 616b673..bc0af09 100644
--- a/src/Xmobar/Plugins/Monitors/Load.hs
+++ b/src/Xmobar/Plugins/Monitors/Load.hs
@@ -22,9 +22,7 @@ import System.Posix.Files (fileExist)
-- | Default configuration.
loadConfig :: IO MConfig
-loadConfig = mkMConfig
- "Load: <load1>" -- template
- ["load1", "load5", "load15"] -- available replacements
+loadConfig = mkMConfig "Load: <load1>" ["load1", "load5", "load15"]
-- | Parses the contents of a loadavg proc file, returning
-- the list of load averages
@@ -43,4 +41,4 @@ runLoad _ = do
d <- getConfigValue decDigits
parseTemplate =<< mapM (showWithColors (showDigits d)) l)
else
- return "Load: N/A"
+ getConfigValue naString
diff --git a/src/Xmobar/Plugins/Monitors/MPD.hs b/src/Xmobar/Plugins/Monitors/MPD.hs
index c8c2dc9..7ecbc0c 100644
--- a/src/Xmobar/Plugins/Monitors/MPD.hs
+++ b/src/Xmobar/Plugins/Monitors/MPD.hs
@@ -95,7 +95,8 @@ mpdReady args = do
parseMPD :: M.Response M.Status -> M.Response (Maybe M.Song) -> MOpts
-> Monitor [String]
-parseMPD (Left _) _ _ = return $ "N/A": repeat ""
+parseMPD (Left _) _ _ =
+ getConfigValue naString >>= \na -> return $ na : repeat ""
parseMPD (Right st) song opts = do
songData <- parseSong song
bar <- showPercentBar (100 * b) b
diff --git a/src/Xmobar/Plugins/Monitors/Swap.hs b/src/Xmobar/Plugins/Monitors/Swap.hs
index e8b2f54..f10afad 100644
--- a/src/Xmobar/Plugins/Monitors/Swap.hs
+++ b/src/Xmobar/Plugins/Monitors/Swap.hs
@@ -24,9 +24,8 @@ import qualified Xmobar.Plugins.Monitors.Swap.Linux as MS
#endif
swapConfig :: IO MConfig
-swapConfig = mkMConfig
- "Swap: <usedratio>%" -- template
- ["usedratio", "total", "used", "free"] -- available replacements
+swapConfig = mkMConfig "Swap: <usedratio>%"
+ ["usedratio", "total", "used", "free"]
formatSwap :: [Float] -> Monitor [String]
formatSwap (r:xs) = do
@@ -34,7 +33,7 @@ formatSwap (r:xs) = do
other <- mapM (showWithColors (showDigits d)) xs
ratio <- showPercentWithColors r
return $ ratio:other
-formatSwap _ = return $ replicate 4 "N/A"
+formatSwap _ = replicate 4 `fmap` getConfigValue naString
runSwap :: [String] -> Monitor String
runSwap _ =
diff --git a/src/Xmobar/Plugins/Monitors/Thermal.hs b/src/Xmobar/Plugins/Monitors/Thermal.hs
index 320ae17..bfbbda0 100644
--- a/src/Xmobar/Plugins/Monitors/Thermal.hs
+++ b/src/Xmobar/Plugins/Monitors/Thermal.hs
@@ -36,4 +36,4 @@ runThermal args = do
then do number <- io $ fmap ((read :: String -> Int) . stringParser (1, 0)) (B.readFile file)
thermal <- showWithColors show number
parseTemplate [ thermal ]
- else return $ "Thermal (" ++ zone ++ "): N/A"
+ else getConfigValue naString
diff --git a/src/Xmobar/Plugins/Monitors/Top.hs b/src/Xmobar/Plugins/Monitors/Top.hs
index e99ec3b..3bfe6fd 100644
--- a/src/Xmobar/Plugins/Monitors/Top.hs
+++ b/src/Xmobar/Plugins/Monitors/Top.hs
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Plugins.Monitors.Top
--- Copyright : (c) 2010, 2011, 2012, 2013, 2014, 2018 Jose A Ortega Ruiz
+-- Copyright : (c) 2010, 2011, 2012, 2013, 2014, 2018, 2022 Jose A Ortega Ruiz
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Jose A Ortega Ruiz <jao@gnu.org>
@@ -127,7 +127,8 @@ runTop tref scale _ = do
(no, ps, ms) <- io $ topProcesses tref scale
pstr <- showTimeInfos ps
mstr <- showMemInfos ms
- parseTemplate $ show no : concat (zipWith (++) pstr mstr) ++ repeat "N/A"
+ na <- getConfigValue naString
+ parseTemplate $ show no : concat (zipWith (++) pstr mstr) ++ repeat na
startTop :: [String] -> Int -> (String -> IO ()) -> IO ()
startTop a r cb = do