diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-12-08 20:09:33 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-12-08 20:09:33 +0100 |
commit | 5a8064c2a5dd10fb1a6c6c2bf9fa560402f886ac (patch) | |
tree | 0f6d4e7b7c2b4ffd9bb94608b23d2c95e9ed9c5f /Plugins/Monitors/CpuFreq.hs | |
parent | 386c07f501d2522bd2e3aba8a4f81e52fcafe008 (diff) | |
download | xmobar-5a8064c2a5dd10fb1a6c6c2bf9fa560402f886ac.tar.gz xmobar-5a8064c2a5dd10fb1a6c6c2bf9fa560402f886ac.tar.bz2 |
CpuFreq: limit GHz values to one decimal digit
Thanks to Petr Rockai
Diffstat (limited to 'Plugins/Monitors/CpuFreq.hs')
-rw-r--r-- | Plugins/Monitors/CpuFreq.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Plugins/Monitors/CpuFreq.hs b/Plugins/Monitors/CpuFreq.hs index fd1da4c..4f01922 100644 --- a/Plugins/Monitors/CpuFreq.hs +++ b/Plugins/Monitors/CpuFreq.hs @@ -28,7 +28,8 @@ cpuFreqConfig = mkMConfig -- replacements -- | --- Function retrieves monitor string holding the cpu frequency (or frequencies) +-- Function retrieves monitor string holding the cpu frequency (or +-- frequencies) runCpuFreq :: [String] -> Monitor String runCpuFreq _ = do let dir = "/sys/devices/system/cpu" @@ -36,7 +37,7 @@ runCpuFreq _ = do pattern = "cpu" divisor = 1e6 :: Double failureMessage = "CpuFreq: N/A" - fmt x | x < 1 = (show (round (x * 1000) :: Integer)) ++ "MHz" - | otherwise = (show x) ++ "GHz" + fmt x | x < 1 = show (round (x * 1000) :: Integer) ++ "MHz" + | otherwise = showDigits 1 x ++ "GHz" checkedDataRetrieval failureMessage dir file pattern (/divisor) fmt |