summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugins/Monitors')
-rw-r--r--src/Plugins/Monitors/CoreCommon.hs7
-rw-r--r--src/Plugins/Monitors/CoreTemp.hs2
-rw-r--r--src/Plugins/Monitors/CpuFreq.hs2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/Plugins/Monitors/CoreCommon.hs b/src/Plugins/Monitors/CoreCommon.hs
index 5d6efd4..943f491 100644
--- a/src/Plugins/Monitors/CoreCommon.hs
+++ b/src/Plugins/Monitors/CoreCommon.hs
@@ -26,10 +26,11 @@ import Plugins.Monitors.Common
import System.Directory
checkedDataRetrieval :: (Ord a, Num a)
- => String -> [String] -> Maybe (String, String -> Int)
+ => String -> [[String]] -> Maybe (String, String -> Int)
-> (Double -> a) -> (a -> String) -> Monitor String
-checkedDataRetrieval msg path lbl trans fmt = liftM (fromMaybe msg) $
- retrieveData path lbl trans fmt
+checkedDataRetrieval msg paths lbl trans fmt =
+ liftM (fromMaybe msg . listToMaybe . catMaybes) $
+ mapM (\p -> retrieveData p lbl trans fmt) paths
retrieveData :: (Ord a, Num a)
=> [String] -> Maybe (String, String -> Int)
diff --git a/src/Plugins/Monitors/CoreTemp.hs b/src/Plugins/Monitors/CoreTemp.hs
index 5109070..eebdc95 100644
--- a/src/Plugins/Monitors/CoreTemp.hs
+++ b/src/Plugins/Monitors/CoreTemp.hs
@@ -41,4 +41,4 @@ runCoreTemp _ = do
lbl = Just ("_label", read . (dropWhile (not . isDigit)))
divisor = 1e3 :: Double
show' = showDigits (max 0 dn)
- checkedDataRetrieval failureMessage path lbl (/divisor) show'
+ checkedDataRetrieval failureMessage [path] lbl (/divisor) show'
diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs
index 8334d1a..3fe2577 100644
--- a/src/Plugins/Monitors/CpuFreq.hs
+++ b/src/Plugins/Monitors/CpuFreq.hs
@@ -36,4 +36,4 @@ runCpuFreq _ = do
fmt x | x < 1 = (show (round (x * 1000) :: Integer)) ++ "MHz"
| otherwise = (show x) ++ "GHz"
failureMessage <- getConfigValue naString
- checkedDataRetrieval failureMessage path Nothing (/divisor) fmt
+ checkedDataRetrieval failureMessage [path] Nothing (/divisor) fmt