summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/CpuFreq.hs
diff options
context:
space:
mode:
authorNorbert Zeh <nzeh@cs.dal.ca>2010-06-04 16:41:53 +0200
committerNorbert Zeh <nzeh@cs.dal.ca>2010-06-04 16:41:53 +0200
commit59c17dbdb1ca05f690fc47dca77ac452b0efd721 (patch)
treef659a1a966dd15921fd0524de145844ff8b446ea /Plugins/Monitors/CpuFreq.hs
parent73a3ef7912ce9c9d43d04767f06a7928087f1c51 (diff)
downloadxmobar-59c17dbdb1ca05f690fc47dca77ac452b0efd721.tar.gz
xmobar-59c17dbdb1ca05f690fc47dca77ac452b0efd721.tar.bz2
Fix strange formatting of CPU frequencies
Ignore-this: 8c7108dbb071318135c54f0ff830c065 This patch displays frequencies under 1GHz as MHz and above 1GHz as GHz. Unfortunately, it was also necessary to touch CoreCommon.hs and CoreTemp.hs to implement this. darcs-hash:20100604144153-18a2b-cea493ec887c16a50bcef0db001ebbce3ccef74f.gz
Diffstat (limited to 'Plugins/Monitors/CpuFreq.hs')
-rw-r--r--Plugins/Monitors/CpuFreq.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Plugins/Monitors/CpuFreq.hs b/Plugins/Monitors/CpuFreq.hs
index 70482f5..fd1da4c 100644
--- a/Plugins/Monitors/CpuFreq.hs
+++ b/Plugins/Monitors/CpuFreq.hs
@@ -23,7 +23,7 @@ import Plugins.Monitors.CoreCommon
-- cpu frequencies.
cpuFreqConfig :: IO MConfig
cpuFreqConfig = mkMConfig
- "Freq: <cpu0>GHz" -- template
+ "Freq: <cpu0>" -- template
(zipWith (++) (repeat "cpu") (map show [0 :: Int ..])) -- available
-- replacements
@@ -36,5 +36,7 @@ runCpuFreq _ = do
pattern = "cpu"
divisor = 1e6 :: Double
failureMessage = "CpuFreq: N/A"
- checkedDataRetrieval failureMessage dir file pattern (/divisor)
+ fmt x | x < 1 = (show (round (x * 1000) :: Integer)) ++ "MHz"
+ | otherwise = (show x) ++ "GHz"
+ checkedDataRetrieval failureMessage dir file pattern (/divisor) fmt