summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-03-30 19:22:13 +0100
committerjao <jao@gnu.org>2022-03-30 19:22:13 +0100
commit88230bb0301aebc37c971d235f5a9735d9563f8d (patch)
treeb531024e4146358e16fca71fd8e614c5e5b87874
parent60b106ac0db19800667ee54b0d390d80e0873b52 (diff)
downloadxmobar-88230bb0301aebc37c971d235f5a9735d9563f8d.tar.gz
xmobar-88230bb0301aebc37c971d235f5a9735d9563f8d.tar.bz2
Load: honour the -d (decimal digits) monitor argument
-rw-r--r--doc/plugins.org12
-rw-r--r--src/Xmobar/Plugins/Monitors/Load.hs3
2 files changed, 13 insertions, 2 deletions
diff --git a/doc/plugins.org b/doc/plugins.org
index cc4169f..8ff75e4 100644
--- a/doc/plugins.org
+++ b/doc/plugins.org
@@ -676,8 +676,18 @@
- Default template: =Load: <load1>=.
- Displays load averages for the last 1, 5 or 15 minutes as
- reported by, e.g., ~uptime(1)~.
+ reported by, e.g., ~uptime(1)~. The displayed values are float,
+ so that the ~"-d"~ option will control how many decimal digits
+ are shown (zero by default).
+ - Example: to have 2 decimal digits displayed, with a low
+ threshold at 1.0 and a high one at 3, you'd write something
+ like:
+
+ #+begin_src haskell
+ Run Load ["-t" , "<load1> <load5> <load15>"
+ , "-L", "1", "-H", "3", "-d", "2"]) 300
+ #+end_src
***** =TopProc Args RefreshRate=
diff --git a/src/Xmobar/Plugins/Monitors/Load.hs b/src/Xmobar/Plugins/Monitors/Load.hs
index e41e897..4703e8a 100644
--- a/src/Xmobar/Plugins/Monitors/Load.hs
+++ b/src/Xmobar/Plugins/Monitors/Load.hs
@@ -41,7 +41,8 @@ runLoad _ = do
exists <- io $ fileExist file
if exists then
(do l <- io $ B.readFile file >>= return . parseLoadAvgs
- let s = showWithColors . const . showDigits 2
+ d <- getConfigValue decDigits
+ let s = showWithColors . const . showDigits d
parseTemplate =<< zipWithM s l l)
else
return "Load: N/A"