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 | |
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')
-rw-r--r-- | src/Plugins/Monitors/Common.hs | 9 | ||||
-rw-r--r-- | src/Plugins/Monitors/MPD.hs | 6 |
2 files changed, 12 insertions, 3 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 diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs index e56260d..450ad8f 100644 --- a/src/Plugins/Monitors/MPD.hs +++ b/src/Plugins/Monitors/MPD.hs @@ -12,7 +12,7 @@ -- ----------------------------------------------------------------------------- -module Plugins.Monitors.MPD ( mpdConfig, runMPD ) where +module Plugins.Monitors.MPD ( mpdConfig, runMPD, mpdWait ) where import Plugins.Monitors.Common import System.Console.GetOpt @@ -55,6 +55,10 @@ runMPD args = do s <- parseMPD status song opts parseTemplate s +mpdWait :: IO () +mpdWait = M.withMPD idle >> return () + where idle = M.idle [M.PlayerS, M.MixerS] + mopts :: [String] -> IO MOpts mopts argv = case getOpt Permute options argv of |