summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/Cpu.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-11 20:33:48 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-11 20:33:48 +0100
commit699033f96984b23855257566477f211cd49b1182 (patch)
tree2f35c6f472afed0e8174576e4b1c36178022b889 /Plugins/Monitors/Cpu.hs
parentf03a4f2ee1cdb117413d6e968d711439b96c7e37 (diff)
parent096aee3a1667e056fe906967cc2b078e8122e2b4 (diff)
downloadxmobar-699033f96984b23855257566477f211cd49b1182.tar.gz
xmobar-699033f96984b23855257566477f211cd49b1182.tar.bz2
Merge branch 'dev/code-cleanups' of https://github.com/mathstuf/xmobar into mathstuf-dev/code-cleanups
Diffstat (limited to 'Plugins/Monitors/Cpu.hs')
-rw-r--r--Plugins/Monitors/Cpu.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Plugins/Monitors/Cpu.hs b/Plugins/Monitors/Cpu.hs
index 71e8ac3..ab89246 100644
--- a/Plugins/Monitors/Cpu.hs
+++ b/Plugins/Monitors/Cpu.hs
@@ -28,7 +28,7 @@ cpuData = do s <- B.readFile "/proc/stat"
cpuParser :: B.ByteString -> [Float]
cpuParser =
- map (read . B.unpack) . tail . B.words . flip (!!) 0 . B.lines
+ map (read . B.unpack) . tail . B.words . head . B.lines
parseCPU :: IO [Float]
parseCPU =
@@ -39,7 +39,7 @@ parseCPU =
return percent
formatCpu :: [Float] -> Monitor [String]
-formatCpu [] = return [""]
+formatCpu [] = return $ repeat ""
formatCpu xs = do
let t = foldr (+) 0 $ take 3 xs
b <- showPercentBar (100 * t) t