FIX dbus not closing callback connections
This commit is contained in:
parent
cc5670f2f1
commit
87eee7a2b9
|
@ -46,7 +46,7 @@ withDBusX
|
|||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
=> (DBusState -> m a)
|
||||
-> m a
|
||||
withDBusX = withDBus (Just xmonadSesBusName) (Just xmonadSysBusName)
|
||||
withDBusX = withDBus (Just xmonadSesBusName) Nothing
|
||||
|
||||
withDBus_
|
||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||
|
|
|
@ -54,11 +54,8 @@ data Bluetooth = Bluetooth Icons Colors deriving (Read, Show)
|
|||
instance Exec Bluetooth where
|
||||
alias (Bluetooth _ _) = T.unpack btAlias
|
||||
start (Bluetooth icons colors) cb =
|
||||
withDBusClientConnection
|
||||
cb
|
||||
(Just "org.xmonad.bluetooth")
|
||||
(Just "bluetooth.log")
|
||||
$ startAdapter icons colors cb
|
||||
withDBusClientConnection cb Nothing (Just "bluetooth.log") $
|
||||
startAdapter icons colors cb
|
||||
|
||||
startAdapter
|
||||
:: Icons
|
||||
|
|
|
@ -110,7 +110,9 @@ withDBusClientConnection cb n logfile f =
|
|||
logOpts <- setLogVerboseFormat True . setLogUseTime True <$> logOptionsHandle h False
|
||||
withLogFunc logOpts $ \lf -> do
|
||||
env <- mkSimpleApp lf Nothing
|
||||
runRIO env $ displayMaybe' cb f =<< getDBusClient n
|
||||
runRIO env $
|
||||
bracket (getDBusClient n) (mapM (liftIO . disconnect . ncClient)) $
|
||||
displayMaybe' cb f
|
||||
|
||||
-- | Run a plugin action with a new DBus client and logfile path.
|
||||
-- This is necessary for DBus callbacks which run in separate threads, which
|
||||
|
|
Loading…
Reference in New Issue