diff options
Diffstat (limited to 'Plugins')
-rw-r--r-- | Plugins/Monitors/Cpu.hs | 4 | ||||
-rw-r--r-- | Plugins/Monitors/MultiCpu.hs | 2 |
2 files changed, 3 insertions, 3 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 diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs index 17620d5..492ad96 100644 --- a/Plugins/Monitors/MultiCpu.hs +++ b/Plugins/Monitors/MultiCpu.hs @@ -50,7 +50,7 @@ percent b a = if tot > 0 then map (/ tot) $ take 4 dif else [0, 0, 0, 0] tot = foldr (+) 0 dif formatMultiCpus :: [[Float]] -> Monitor [String] -formatMultiCpus [] = showPercentsWithColors $ replicate 15 0.0 +formatMultiCpus [] = return $ repeat "" formatMultiCpus xs = fmap concat $ mapM formatCpu xs formatCpu :: [Float] -> Monitor [String] |