summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins
diff options
context:
space:
mode:
authorAda Joule <ada.fulmina@gmail.com>2018-02-03 23:28:02 +0700
committerAda Joule <ada.fulmina@gmail.com>2018-02-03 23:28:02 +0700
commitc2a493e8b26f39d0d7022b3caacdd6808a975419 (patch)
tree48f8d5918d06408e7db4c0f09f5c73bbf550b618 /src/Plugins
parent39866a88a60c68bc52765b88f973461b6a91f138 (diff)
downloadxmobar-c2a493e8b26f39d0d7022b3caacdd6808a975419.tar.gz
xmobar-c2a493e8b26f39d0d7022b3caacdd6808a975419.tar.bz2
Change default unit to GHz
Diffstat (limited to 'src/Plugins')
-rw-r--r--src/Plugins/Monitors/CpuFreq.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs
index b5ee461..7e615a6 100644
--- a/src/Plugins/Monitors/CpuFreq.hs
+++ b/src/Plugins/Monitors/CpuFreq.hs
@@ -35,9 +35,10 @@ runCpuFreq _ = do
ddigits <- getConfigValue decDigits
let path = ["/sys/devices/system/cpu/cpu", "/cpufreq/scaling_cur_freq"]
divisor = 1e6 :: Double
- fmt x | x < 1 = mhzFmt x ++
- if suffix then "MHz" else ""
- | otherwise = if suffix then showDigits ddigits x ++ "GHz" else mhzFmt x
+ fmt x | x < 1 = if suffix then mhzFmt x ++ "MHz"
+ else ghzFmt x
+ | otherwise = ghzFmt x ++ if suffix then "GHz" else ""
mhzFmt x = show (round (x * 1000) :: Integer)
+ ghzFmt x = showDigits ddigits x
failureMessage <- getConfigValue naString
checkedDataRetrieval failureMessage [path] Nothing (/divisor) fmt