summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAda Joule <ada.fulmina@gmail.com>2018-02-03 14:59:02 +0700
committerAda Joule <ada.fulmina@gmail.com>2018-02-03 14:59:02 +0700
commitae8a0e12d6c4e99ff56ed96dda180173e0966c0d (patch)
treec52e0e6c7bc489e87a2aa38e93360d59316ac0ac
parent453d31ff13919e7272514a4d6b7c2689204d409e (diff)
downloadxmobar-ae8a0e12d6c4e99ff56ed96dda180173e0966c0d.tar.gz
xmobar-ae8a0e12d6c4e99ff56ed96dda180173e0966c0d.tar.bz2
Honour -d switch in CpuFreq
-rw-r--r--src/Plugins/Monitors/CpuFreq.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs
index 8301547..e6ce07d 100644
--- a/src/Plugins/Monitors/CpuFreq.hs
+++ b/src/Plugins/Monitors/CpuFreq.hs
@@ -32,10 +32,11 @@ cpuFreqConfig =
runCpuFreq :: [String] -> Monitor String
runCpuFreq _ = do
suffix <- getConfigValue useSuffix
+ 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) ++
if suffix then "MHz" else ""
- | otherwise = show x ++ if suffix then "GHz" else ""
+ | otherwise = showDigits ddigits x ++ if suffix then "GHz" else ""
failureMessage <- getConfigValue naString
checkedDataRetrieval failureMessage [path] Nothing (/divisor) fmt