diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2010-12-11 14:18:49 -0500 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2010-12-11 14:18:49 -0500 |
commit | 6ac13d70d701bc6f0e8a24ef4fa67e501403fe81 (patch) | |
tree | 9e2a39720a849ef9b049ac330332765dba4deff1 /Plugins/Monitors/MultiCpu.hs | |
parent | 533d459b70774b3bbdab5dde1fcb442a579b36cc (diff) | |
download | xmobar-6ac13d70d701bc6f0e8a24ef4fa67e501403fe81.tar.gz xmobar-6ac13d70d701bc6f0e8a24ef4fa67e501403fe81.tar.bz2 |
Don't hard code the number of values
Make an infinite list of empty strings so that if something is asked for
and cannot be provided, index errors don't occur.
Diffstat (limited to 'Plugins/Monitors/MultiCpu.hs')
-rw-r--r-- | Plugins/Monitors/MultiCpu.hs | 2 |
1 files changed, 1 insertions, 1 deletions
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] |