diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-07-21 18:27:35 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-07-21 18:27:35 +0200 |
commit | 7c38acde5da92181b3f1da44fdd52bb732d145e9 (patch) | |
tree | 9878efa0270504816a9cfed18d6cc2ac443b7a6b /src/Plugins/Monitors/Common.hs | |
parent | f24d03d994c59dd9d91fd280272254eeb6a03b19 (diff) | |
parent | 0f8e3e7cf4afb28a9ed8c1922f8090c67d4714f1 (diff) | |
download | xmobar-7c38acde5da92181b3f1da44fdd52bb732d145e9.tar.gz xmobar-7c38acde5da92181b3f1da44fdd52bb732d145e9.tar.bz2 |
Merge remote-tracking branch 'math/dev/mpd-idle' into mpd
Conflicts:
xmobar.cabal
Diffstat (limited to 'src/Plugins/Monitors/Common.hs')
-rw-r--r-- | src/Plugins/Monitors/Common.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs index c9f0843..7fcab1f 100644 --- a/src/Plugins/Monitors/Common.hs +++ b/src/Plugins/Monitors/Common.hs @@ -23,6 +23,7 @@ module Plugins.Monitors.Common ( , getConfigValue , mkMConfig , runM + , runMB , io -- * Parsers -- $parsers @@ -207,9 +208,13 @@ doConfigOptions (o:oo) = runM :: [String] -> IO MConfig -> ([String] -> Monitor String) -> Int -> (String -> IO ()) -> IO () -runM args conf action r cb = handle (cb . showException) loop +runM args conf action r = runMB args conf action (tenthSeconds r) + +runMB :: [String] -> IO MConfig -> ([String] -> Monitor String) + -> IO () -> (String -> IO ()) -> IO () +runMB args conf action wait cb = handle (cb . showException) loop where ac = doArgs args action - loop = conf >>= runReaderT ac >>= cb >> tenthSeconds r >> loop + loop = conf >>= runReaderT ac >>= cb >> wait >> loop showException :: SomeException -> String showException = ("error: "++) . show . flip asTypeOf undefined |