From aa657511d97356fdd6339da7a199d2a425c8c13b Mon Sep 17 00:00:00 2001 From: Felix Springer Date: Wed, 10 Jul 2019 18:51:38 +0200 Subject: cleared everything up --- src/Xmobar/Plugins/Monitors/CoreTemp.hs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Xmobar/Plugins/Monitors/CoreTemp.hs b/src/Xmobar/Plugins/Monitors/CoreTemp.hs index 3b9bd53..35378eb 100644 --- a/src/Xmobar/Plugins/Monitors/CoreTemp.hs +++ b/src/Xmobar/Plugins/Monitors/CoreTemp.hs @@ -16,13 +16,13 @@ module Xmobar.Plugins.Monitors.CoreTemp (startCoreTemp) where import Xmobar.Plugins.Monitors.Common -import Data.Char (isDigit) -- | Generate Config with a default template and options. coreTempConfig :: IO MConfig coreTempConfig = mkMConfig coreTempTemplate coreTempOptions where coreTempTemplate = "Temp: °C" - coreTempOptions = map ((++) "core" . show) [0 :: Int ..] + coreTempOptions = map (("core" ++) . show) [0 :: Int ..] ++ + ["total"] -- | FilePaths to read temperature from. Strings are seperated, where to -- insert numbers. @@ -31,15 +31,21 @@ coreTempFilePaths = [ ["/sys/bus/platform/devices/coretemp." , "/temp" , "_input , ["/sys/bus/platform/devices/coretemp.", "/hwmon/hwmon", "/temp", "_input"] ] +coreTempNormalize :: Double -> Double +coreTempNormalize = (/ 1000) + -- | Retrieves Monitor String holding the core temperatures. runCoreTemp :: [String] -> Monitor String runCoreTemp _ = do - dn <- getConfigValue decDigits - failureMessage <- getConfigValue naString - let lbl = Just ("_label", read . dropWhile (not . isDigit)) - divisor = 1e3 :: Double - show' = showDigits (max 0 dn) - checkedDataRetrieval failureMessage coreTempFilePaths lbl (/divisor) show' + confDecDigits <- getConfigValue decDigits + confNaString <- getConfigValue naString + let coreLabel = Nothing + coreTempShow = showDigits (max 0 confDecDigits) + checkedDataRetrieval confNaString + coreTempFilePaths + coreLabel + coreTempNormalize + coreTempShow startCoreTemp :: [String] -> Int -> (String -> IO ()) -> IO () startCoreTemp a r cb = runM a coreTempConfig runCoreTemp r cb -- cgit v1.2.3