summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors/MPD.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/MPD.hs')
-rw-r--r--src/Xmobar/Plugins/Monitors/MPD.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/Xmobar/Plugins/Monitors/MPD.hs b/src/Xmobar/Plugins/Monitors/MPD.hs
index cd08cda..3274c42 100644
--- a/src/Xmobar/Plugins/Monitors/MPD.hs
+++ b/src/Xmobar/Plugins/Monitors/MPD.hs
@@ -64,7 +64,7 @@ withMPD opts = M.withMPD_ (mHost opts) (mPort opts)
runMPD :: [String] -> Monitor String
runMPD args = do
- opts <- io $ mopts args
+ opts <- io $ parseOptsWith options defaultOpts args
status <- io $ withMPD opts M.status
song <- io $ withMPD opts M.currentSong
s <- parseMPD status song opts
@@ -79,7 +79,7 @@ mpdWait = do
mpdReady :: [String] -> Monitor Bool
mpdReady args = do
- opts <- io $ mopts args
+ opts <- io $ parseOptsWith options defaultOpts args
response <- io $ withMPD opts M.ping
case response of
Right _ -> return True
@@ -89,12 +89,6 @@ mpdReady args = do
Left (M.ConnectionError _) -> return False
Left _ -> return True
-mopts :: [String] -> IO MOpts
-mopts argv =
- case getOpt Permute options argv of
- (o, _, []) -> return $ foldr id defaultOpts o
- (_, _, errs) -> ioError . userError $ concat errs
-
parseMPD :: M.Response M.Status -> M.Response (Maybe M.Song) -> MOpts
-> Monitor [String]
parseMPD (Left e) _ _ = return $ show e:replicate 19 ""