diff options
author | jao <jao@gnu.org> | 2024-03-30 18:26:01 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2024-03-30 18:26:01 +0000 |
commit | 30d226ba5eca8847775d03403367dee1f1e3dcfc (patch) | |
tree | b62d0f7f176f9f2b58d66866c3c6afb581334bd6 /src/Xmobar/Plugins/Monitors/Mem | |
parent | 3f4ae1034fe7575df05c59dd0c357fd448198594 (diff) | |
download | xmobar-30d226ba5eca8847775d03403367dee1f1e3dcfc.tar.gz xmobar-30d226ba5eca8847775d03403367dee1f1e3dcfc.tar.bz2 |
fix for unmet pattern matches warnings (clean build)
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Mem')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Mem/Linux.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Mem/Linux.hs b/src/Xmobar/Plugins/Monitors/Mem/Linux.hs index 79dcc9d..7a81c6d 100644 --- a/src/Xmobar/Plugins/Monitors/Mem/Linux.hs +++ b/src/Xmobar/Plugins/Monitors/Mem/Linux.hs @@ -25,9 +25,13 @@ parseMEM = 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:"] - available = M.findWithDefault (free + buffer + cache) "MemAvailable:" info + info' x = info M.! (x ++ ":") + total = info' "MemTotal" + free = info' "MemFree" + buffer = info' "Buffers" + cache = info' "Cached" + available = + M.findWithDefault (free + buffer + cache) "MemAvailable:" info used = total - available usedratio = used / total freeratio = free / total |