summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2013-12-30 04:36:19 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2013-12-30 04:36:19 +0100
commit9a9f660998857dba72a13a7376c32ae6c41c1a64 (patch)
tree5ea04d32620660b2261ab6a622c5659f830cac8b
parent5bbb923bf9e166640ac2c131f21d18623c28ffc9 (diff)
downloadxmobar-9a9f660998857dba72a13a7376c32ae6c41c1a64.tar.gz
xmobar-9a9f660998857dba72a13a7376c32ae6c41c1a64.tar.bz2
Fix for Top parsing of command lines containing blanks
-rw-r--r--news.md10
-rw-r--r--src/Plugins/Monitors/Top.hs7
2 files changed, 16 insertions, 1 deletions
diff --git a/news.md b/news.md
index e7007b8..4263151 100644
--- a/news.md
+++ b/news.md
@@ -1,5 +1,15 @@
% xmobar - Release notes
+## Version 0.20 ()
+
+_Bug fixes_
+
+ - Fix for `Top` monitor's readings for processes whose name contains
+ blanks.
+ - Fixes for geometry computation on multihead (Dmitry Malikov).
+ - Fixes for missing XDG configuration (Thiago Negri and James McCoy).
+ - Compatibility with latest `directory` (1.2.0.2).
+
## Version 0.19 (October 27, 2013)
As of this release, the old bug tracker at Google code is deprecated.
diff --git a/src/Plugins/Monitors/Top.hs b/src/Plugins/Monitors/Top.hs
index 6f16bdb..6be3c1c 100644
--- a/src/Plugins/Monitors/Top.hs
+++ b/src/Plugins/Monitors/Top.hs
@@ -57,10 +57,15 @@ processes :: IO [FilePath]
processes = fmap (filter isPid) (getDirectoryContents "/proc")
where isPid = (`elem` ['0'..'9']) . head
+statWords :: [String] -> [String]
+statWords line@(x:pn:ppn:xs) =
+ if last pn == ')' then line else statWords (x:(pn ++ " " ++ ppn):xs)
+statWords _ = replicate 52 "0"
+
getProcessData :: FilePath -> IO [String]
getProcessData pidf =
handle ign $ withFile ("/proc" </> pidf </> "stat") ReadMode readWords
- where readWords = fmap words . hGetLine
+ where readWords = fmap (statWords . words) . hGetLine
ign = const (return []) :: SomeException -> IO [String]
handleProcesses :: ([String] -> a) -> IO [a]