diff options
author | Ada Joule <ada.fulmina@gmail.com> | 2018-02-03 16:07:03 +0700 |
---|---|---|
committer | Ada Joule <ada.fulmina@gmail.com> | 2018-02-03 16:07:03 +0700 |
commit | 39866a88a60c68bc52765b88f973461b6a91f138 (patch) | |
tree | f5f98b0b85226a6980315eeebdf518195261a83a /src/Plugins/Monitors/CpuFreq.hs | |
parent | ae8a0e12d6c4e99ff56ed96dda180173e0966c0d (diff) | |
download | xmobar-39866a88a60c68bc52765b88f973461b6a91f138.tar.gz xmobar-39866a88a60c68bc52765b88f973461b6a91f138.tar.bz2 |
Make CpuFreq use MHz unit when suffix is false
Diffstat (limited to 'src/Plugins/Monitors/CpuFreq.hs')
-rw-r--r-- | src/Plugins/Monitors/CpuFreq.hs | 5 |
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 |