From fa3723ff77f9c85f17f70d13ac4bd8bf7725fa5e Mon Sep 17 00:00:00 2001 From: Michal Tvrznik Date: Tue, 11 Jun 2024 08:36:10 +0200 Subject: [PATCH] Fixed #112, config `ALWAYS_DBUS_LAUNCH` respects configuration now. If `DBUS_SESSION_BUS_ADDRESS` is already set, skip start of `dbus-launch`. --- src/session.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/session.go b/src/session.go index df9d503..dfc3421 100644 --- a/src/session.go +++ b/src/session.go @@ -79,10 +79,6 @@ func (s *commonSession) start() { s.auth.usr().setenv(envXdgSessionType, s.d.env.sessionType()) } - if s.conf.AlwaysDbusLaunch { - s.dbus = &dbus{} - } - session, strExec := s.prepareGuiCommand() s.cmd = session @@ -93,8 +89,12 @@ func (s *commonSession) start() { logPrint(sessionErrLogErr) } - if s.dbus != nil { - s.dbus.launch(s.auth.usr()) + if s.conf.AlwaysDbusLaunch { + if s.auth.usr().getenv(dbusSessionBusAddress) == "" { + s.dbus.launch(s.auth.usr()) + } else { + logPrint("DBUS_SESSION_BUS_ADDRESS is already set, skipping start of DBUS_LAUNCH") + } } logPrint("Starting " + strExec) @@ -115,7 +115,7 @@ func (s *commonSession) start() { err := session.Wait() - if s.dbus != nil { + if s.dbus.pid > 0 { s.dbus.interrupt() }