summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/CoreCommon.hs
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2014-05-03 13:30:37 +0200
committerTomas Janousek <tomi@nomi.cz>2014-05-03 13:30:37 +0200
commit4218ab4b76e81227364ed008d8d55a8c5f3ed1a0 (patch)
tree228c00389168df2557ddf1c8ca7665a0c2d41ce9 /src/Plugins/Monitors/CoreCommon.hs
parent899f797a129fe8f81c6fb23301f2cc88120fbdc0 (diff)
downloadxmobar-4218ab4b76e81227364ed008d8d55a8c5f3ed1a0.tar.gz
xmobar-4218ab4b76e81227364ed008d8d55a8c5f3ed1a0.tar.bz2
CoreCommon: Try several paths in checkedDataRetrieval
Diffstat (limited to 'src/Plugins/Monitors/CoreCommon.hs')
-rw-r--r--src/Plugins/Monitors/CoreCommon.hs7
1 files changed, 4 insertions, 3 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)