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)
|
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||||
=> (DBusState -> m a)
|
=> (DBusState -> m a)
|
||||||
-> m a
|
-> m a
|
||||||
withDBusX = withDBus (Just xmonadSesBusName) (Just xmonadSysBusName)
|
withDBusX = withDBus (Just xmonadSesBusName) Nothing
|
||||||
|
|
||||||
withDBus_
|
withDBus_
|
||||||
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
:: (MonadReader env m, HasLogFunc env, MonadUnliftIO m)
|
||||||
|
|
|
@ -54,11 +54,8 @@ data Bluetooth = Bluetooth Icons Colors deriving (Read, Show)
|
||||||
instance Exec Bluetooth where
|
instance Exec Bluetooth where
|
||||||
alias (Bluetooth _ _) = T.unpack btAlias
|
alias (Bluetooth _ _) = T.unpack btAlias
|
||||||
start (Bluetooth icons colors) cb =
|
start (Bluetooth icons colors) cb =
|
||||||
withDBusClientConnection
|
withDBusClientConnection cb Nothing (Just "bluetooth.log") $
|
||||||
cb
|
startAdapter icons colors cb
|
||||||
(Just "org.xmonad.bluetooth")
|
|
||||||
(Just "bluetooth.log")
|
|
||||||
$ startAdapter icons colors cb
|
|
||||||
|
|
||||||
startAdapter
|
startAdapter
|
||||||
:: Icons
|
:: Icons
|
||||||
|
|
|
@ -110,7 +110,9 @@ withDBusClientConnection cb n logfile f =
|
||||||
logOpts <- setLogVerboseFormat True . setLogUseTime True <$> logOptionsHandle h False
|
logOpts <- setLogVerboseFormat True . setLogUseTime True <$> logOptionsHandle h False
|
||||||
withLogFunc logOpts $ \lf -> do
|
withLogFunc logOpts $ \lf -> do
|
||||||
env <- mkSimpleApp lf Nothing
|
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.
|
-- | Run a plugin action with a new DBus client and logfile path.
|
||||||
-- This is necessary for DBus callbacks which run in separate threads, which
|
-- This is necessary for DBus callbacks which run in separate threads, which
|
||||||
|
|
Loading…
Reference in New Issue