diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-02-11 01:38:57 +0100 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-02-11 01:38:57 +0100 |
commit | 5d719b4cde41e27c28b8c6342ccc40d97af04370 (patch) | |
tree | 3e85896c249c350025cd8e608a7f7068eb45a5df /Plugins/Monitors/Common.hs | |
parent | 720c9ecadb0302f43769f743b706ffedfbd6b44c (diff) | |
download | xmobar-5d719b4cde41e27c28b8c6342ccc40d97af04370.tar.gz xmobar-5d719b4cde41e27c28b8c6342ccc40d97af04370.tar.bz2 |
First stab at top monitors
Ignore-this: c89a13a99236d416cba2ba285099a2d7
darcs-hash:20100211003857-748be-76b55377cc1c2793711bc4003619dd366af0aa5c.gz
Diffstat (limited to 'Plugins/Monitors/Common.hs')
-rw-r--r-- | Plugins/Monitors/Common.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs index a102036..6729397 100644 --- a/Plugins/Monitors/Common.hs +++ b/Plugins/Monitors/Common.hs @@ -35,6 +35,7 @@ module Plugins.Monitors.Common ( , parseTemplate -- ** String Manipulation -- $strings + , padString , showWithColors , showWithColors' , showPercentsWithColors @@ -296,7 +297,7 @@ showDigits d n = showWithUnits :: Int -> Int -> Float -> String showWithUnits d n x | x < 0 = "-" ++ showWithUnits d n (-x) - | n > 3 || x < 10^d = show (round x :: Int) ++ units n + | n > 3 || x < 10^(d + 1) = show (round x :: Int) ++ units n | x <= 1024 = showDigits d (x/1024) ++ units (n+1) | otherwise = showWithUnits d (n+1) (x/1024) where units = (!!) ["B", "K", "M", "G", "T"] |