FIX client disconnets for signal matching

This commit is contained in:
Nathan Dwarshuis 2021-06-20 22:27:16 -04:00
parent d7e5668d21
commit d5d01308c2
1 changed files with 2 additions and 3 deletions

View File

@ -20,6 +20,7 @@ callMethod mc = do
-- TODO handle clienterrors here -- TODO handle clienterrors here
reply <- call client mc { methodCallDestination = Just "org.xmonad" } reply <- call client mc { methodCallDestination = Just "org.xmonad" }
-- TODO not all methods warrent that we wait for a reply? -- TODO not all methods warrent that we wait for a reply?
disconnect client
return $ case reply of return $ case reply of
Left _ -> Nothing Left _ -> Nothing
Right ret -> Just $ methodReturnBody ret Right ret -> Just $ methodReturnBody ret
@ -28,6 +29,4 @@ callMethod mc = do
addMatchCallback :: MatchRule -> ([Variant] -> IO ()) -> IO SignalHandler addMatchCallback :: MatchRule -> ([Variant] -> IO ()) -> IO SignalHandler
addMatchCallback rule cb = do addMatchCallback rule cb = do
client <- connectSession client <- connectSession
s <- addMatch client rule $ cb . signalBody addMatch client rule $ cb . signalBody
disconnect client
return s