summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAda Joule <ada.fulmina@gmail.com>2018-02-03 16:07:03 +0700
committerAda Joule <ada.fulmina@gmail.com>2018-02-03 16:07:03 +0700
commit39866a88a60c68bc52765b88f973461b6a91f138 (patch)
treef5f98b0b85226a6980315eeebdf518195261a83a /src
parentae8a0e12d6c4e99ff56ed96dda180173e0966c0d (diff)
downloadxmobar-39866a88a60c68bc52765b88f973461b6a91f138.tar.gz
xmobar-39866a88a60c68bc52765b88f973461b6a91f138.tar.bz2
Make CpuFreq use MHz unit when suffix is false
Diffstat (limited to 'src')
-rw-r--r--src/Plugins/Monitors/CpuFreq.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs
index e6ce07d..b5ee461 100644
--- a/src/Plugins/Monitors/CpuFreq.hs
+++ b/src/Plugins/Monitors/CpuFreq.hs
@@ -35,8 +35,9 @@ runCpuFreq _ = do
ddigits <- getConfigValue decDigits
let path = ["/sys/devices/system/cpu/cpu", "/cpufreq/scaling_cur_freq"]
divisor = 1e6 :: Double
- fmt x | x < 1 = show (round (x * 1000) :: Integer) ++
+ fmt x | x < 1 = mhzFmt x ++
if suffix then "MHz" else ""
- | otherwise = showDigits ddigits x ++ if suffix then "GHz" else ""
+ | otherwise = if suffix then showDigits ddigits x ++ "GHz" else mhzFmt x
+ mhzFmt x = show (round (x * 1000) :: Integer)
failureMessage <- getConfigValue naString
checkedDataRetrieval failureMessage [path] Nothing (/divisor) fmt