diff options
| author | Jose A. Ortega Ruiz <jao@gnu.org> | 2010-01-19 03:02:44 +0100 | 
|---|---|---|
| committer | Jose A. Ortega Ruiz <jao@gnu.org> | 2010-01-19 03:02:44 +0100 | 
| commit | 583e88ca4f36938942e982ed1d2f45dd1ea01446 (patch) | |
| tree | 67d50eef79db1825fac35167601291dd0dc540a1 /Plugins | |
| parent | c23b38c3c8841e948e521bec47264c1423678eff (diff) | |
| download | xmobar-583e88ca4f36938942e982ed1d2f45dd1ea01446.tar.gz xmobar-583e88ca4f36938942e982ed1d2f45dd1ea01446.tar.bz2  | |
MultiCpus: pad percentages
Ignore-this: 6b8133d37a7ed40ae8b3dbc4d31920fa
darcs-hash:20100119020244-40885-c5d0ea1ba9725b8696d254da5e91d1071e483035.gz
Diffstat (limited to 'Plugins')
| -rw-r--r-- | Plugins/Monitors/MultiCpu.hs | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs index 6bbcdd3..39e48c8 100644 --- a/Plugins/Monitors/MultiCpu.hs +++ b/Plugins/Monitors/MultiCpu.hs @@ -51,15 +51,16 @@ 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 [] = return $ take 15 (repeat "0%") +formatMultiCpus [] = return $ take 15 (repeat "  0%")  formatMultiCpus xs = fmap concat $ mapM formatCpu xs  formatCpu :: [Float] -> Monitor [String]  formatCpu x    | length x < 4 = return $ take 5 (repeat "")    | otherwise  = mapM (showWithColors f) . map (* 100) $ (t:x) -            where f s = floatToPercent (s / 100) +            where f s = pad $ floatToPercent (s / 100)                    t = foldr (+) 0 $ take 3 x +                  pad s = take (4 - length s) (repeat ' ') ++ s  runMultiCpu :: [String] -> Monitor String  runMultiCpu _ =  | 
