summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-11-17 22:14:56 +0000
committerjao <jao@gnu.org>2018-11-17 22:15:17 +0000
commit7d89f491115c6323e7427780052d86905d8507de (patch)
tree5087e462f690127670ab735f82bba8483a7d6bf7
parent1976f9bf90ecef8da2fa3a738b54b7d74587c288 (diff)
downloadxmobar-7d89f491115c6323e7427780052d86905d8507de.tar.gz
xmobar-7d89f491115c6323e7427780052d86905d8507de.tar.bz2
TopProc: skipping kernel threads (fixes #369)
-rw-r--r--src/Plugins/Monitors/Top.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/Top.hs b/src/Plugins/Monitors/Top.hs
index d60897d..41a68b2 100644
--- a/src/Plugins/Monitors/Top.hs
+++ b/src/Plugins/Monitors/Top.hs
@@ -1,7 +1,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Plugins.Monitors.Top
--- Copyright : (c) 2010, 2011, 2012, 2013, 2014 Jose A Ortega Ruiz
+-- Copyright : (c) 2010, 2011, 2012, 2013, 2014, 2018 Jose A Ortega Ruiz
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Jose A Ortega Ruiz <jao@gnu.org>
@@ -68,9 +68,18 @@ getProcessData pidf =
where readWords = fmap (statWords . words) . hGetLine
ign = const (return []) :: SomeException -> IO [String]
+memPages :: [String] -> String
+memPages fs = fs!!23
+
+ppid :: [String] -> String
+ppid fs = fs!!3
+
+skip :: [String] -> Bool
+skip fs = length fs < 24 || memPages fs == "0" || ppid fs == "0"
+
handleProcesses :: ([String] -> a) -> IO [a]
handleProcesses f =
- fmap (foldl' (\a p -> if length p < 15 then a else f p : a) [])
+ fmap (foldl' (\a p -> if skip p then a else f p : a) [])
(processes >>= mapM getProcessData)
showInfo :: String -> String -> Float -> Monitor [String]