summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/CoreTemp.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugins/Monitors/CoreTemp.hs')
-rw-r--r--src/Plugins/Monitors/CoreTemp.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Plugins/Monitors/CoreTemp.hs b/src/Plugins/Monitors/CoreTemp.hs
index 2880751..e19baf0 100644
--- a/src/Plugins/Monitors/CoreTemp.hs
+++ b/src/Plugins/Monitors/CoreTemp.hs
@@ -27,17 +27,19 @@ import Data.Char (isDigit)
coreTempConfig :: IO MConfig
coreTempConfig = mkMConfig
"Temp: <core0>C" -- template
- (zipWith (++) (repeat "core") (map show [0 :: Int ..])) -- available
- -- replacements
+ (map ((++) "core" . show) [0 :: Int ..]) -- available
+ -- replacements
-- |
-- Function retrieves monitor string holding the core temperature
-- (or temperatures)
runCoreTemp :: [String] -> Monitor String
-runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.",
- "/temp",
- "_input"]
- lbl = Just ("_label", read . (dropWhile (not . isDigit)))
- divisor = 1e3 :: Double
- failureMessage = "CoreTemp: N/A"
- in checkedDataRetrieval failureMessage path lbl (/divisor) show
+runCoreTemp _ = do
+ dn <- getConfigValue decDigits
+ failureMessage <- getConfigValue naString
+ let path = ["/sys/bus/platform/devices/coretemp.", "/temp", "_input"]
+ path' = ["/sys/bus/platform/devices/coretemp.", "/hwmon/hwmon", "/temp", "_input"]
+ lbl = Just ("_label", read . dropWhile (not . isDigit))
+ divisor = 1e3 :: Double
+ show' = showDigits (max 0 dn)
+ checkedDataRetrieval failureMessage [path, path'] lbl (/divisor) show'