summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-03-30 06:17:42 +0100
committerjao <jao@gnu.org>2022-03-30 06:17:42 +0100
commit60b106ac0db19800667ee54b0d390d80e0873b52 (patch)
treeb9f62b8ccb8e7c7525e0b70ce7c4c5a3383e1dbd
parent4f4e8de1d8b4d33e02057d085399d25e05d87a17 (diff)
downloadxmobar-60b106ac0db19800667ee54b0d390d80e0873b52.tar.gz
xmobar-60b106ac0db19800667ee54b0d390d80e0873b52.tar.bz2
Load monitor: correctly colorize according to -L/-H
-rw-r--r--doc/plugins.org4
-rw-r--r--src/Xmobar/Plugins/Monitors/Load.hs4
2 files changed, 6 insertions, 2 deletions
diff --git a/doc/plugins.org b/doc/plugins.org
index 81f50f9..cc4169f 100644
--- a/doc/plugins.org
+++ b/doc/plugins.org
@@ -675,7 +675,9 @@
- Default template: =Load: <load1>=.
- - Displays load averages for the last 1, 5 or 15 hours.
+ - Displays load averages for the last 1, 5 or 15 minutes as
+ reported by, e.g., ~uptime(1)~.
+
***** =TopProc Args RefreshRate=
diff --git a/src/Xmobar/Plugins/Monitors/Load.hs b/src/Xmobar/Plugins/Monitors/Load.hs
index 238d374..e41e897 100644
--- a/src/Xmobar/Plugins/Monitors/Load.hs
+++ b/src/Xmobar/Plugins/Monitors/Load.hs
@@ -19,6 +19,7 @@ module Xmobar.Plugins.Monitors.Load (loadConfig, runLoad) where
import Xmobar.Plugins.Monitors.Common
import qualified Data.ByteString.Lazy.Char8 as B
import System.Posix.Files (fileExist)
+import Control.Monad (zipWithM)
-- | Default configuration.
loadConfig :: IO MConfig
@@ -40,6 +41,7 @@ runLoad _ = do
exists <- io $ fileExist file
if exists then
(do l <- io $ B.readFile file >>= return . parseLoadAvgs
- parseTemplate =<< mapM (showWithColors $ showDigits 2) l)
+ let s = showWithColors . const . showDigits 2
+ parseTemplate =<< zipWithM s l l)
else
return "Load: N/A"