diff --git a/lib/XMonad/Internal/DBus/Control.hs b/lib/XMonad/Internal/DBus/Control.hs index 363357c..1e2dd2b 100644 --- a/lib/XMonad/Internal/DBus/Control.hs +++ b/lib/XMonad/Internal/DBus/Control.hs @@ -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) diff --git a/lib/Xmobar/Plugins/Bluetooth.hs b/lib/Xmobar/Plugins/Bluetooth.hs index c94eaae..cb47b51 100644 --- a/lib/Xmobar/Plugins/Bluetooth.hs +++ b/lib/Xmobar/Plugins/Bluetooth.hs @@ -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 diff --git a/lib/Xmobar/Plugins/Common.hs b/lib/Xmobar/Plugins/Common.hs index bd36224..af657de 100644 --- a/lib/Xmobar/Plugins/Common.hs +++ b/lib/Xmobar/Plugins/Common.hs @@ -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