diff options
author | jao <jao@gnu.org> | 2022-04-14 16:41:36 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-04-14 16:41:36 +0100 |
commit | 727478f5b8916d8d98ae4208d4f6a80abb4fafc7 (patch) | |
tree | 4fa4a57f31e5cc9cfd172edb31eae420809dbec5 /src/Xmobar/Plugins/Monitors/Mem | |
parent | c714967eb3cab550ed1387d43182ee3b498124e3 (diff) | |
download | xmobar-727478f5b8916d8d98ae4208d4f6a80abb4fafc7.tar.gz xmobar-727478f5b8916d8d98ae4208d4f6a80abb4fafc7.tar.bz2 |
Memory: new argument to scale usage units
Fixes #624
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Mem')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Mem/Linux.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Mem/Linux.hs b/src/Xmobar/Plugins/Monitors/Mem/Linux.hs index 9e48d22..79dcc9d 100644 --- a/src/Xmobar/Plugins/Monitors/Mem/Linux.hs +++ b/src/Xmobar/Plugins/Monitors/Mem/Linux.hs @@ -23,11 +23,14 @@ parseMEM :: IO [Float] parseMEM = do file <- fileMEM let content = map words $ take 8 $ lines file - info = M.fromList $ map (\line -> (head line, (read $ line !! 1 :: Float) / 1024)) content - [total, free, buffer, cache] = map (info M.!) ["MemTotal:", "MemFree:", "Buffers:", "Cached:"] + info = M.fromList $ map ( + \line -> (head line, (read $ line !! 1 :: Float) / 1024)) content + [total, free, buffer, cache] = + map (info M.!) ["MemTotal:", "MemFree:", "Buffers:", "Cached:"] available = M.findWithDefault (free + buffer + cache) "MemAvailable:" info used = total - available usedratio = used / total freeratio = free / total availableratio = available / total - return [usedratio, freeratio, availableratio, total, free, buffer, cache, available, used] + return [ usedratio, freeratio, availableratio + , total, free, buffer, cache, available, used] |