summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors
diff options
context:
space:
mode:
authorFelix Springer <felixspringer149@gmail.com>2019-07-10 18:51:38 +0200
committerFelix Springer <felixspringer149@gmail.com>2019-07-10 18:51:38 +0200
commitaa657511d97356fdd6339da7a199d2a425c8c13b (patch)
tree6212b3df984ce60925a63aa4edfc55af4413e71c /src/Xmobar/Plugins/Monitors
parent8e6b88a68acf40b2402d03a5a2564b6ebea63585 (diff)
downloadxmobar-aa657511d97356fdd6339da7a199d2a425c8c13b.tar.gz
xmobar-aa657511d97356fdd6339da7a199d2a425c8c13b.tar.bz2
cleared everything up
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r--src/Xmobar/Plugins/Monitors/CoreTemp.hs22
1 files 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: <total>°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