diff --git a/cinnamon-session/main.c b/cinnamon-session/main.c index 7730715..64bb0bf 100644 --- a/cinnamon-session/main.c +++ b/cinnamon-session/main.c @@ -162,11 +162,23 @@ require_dbus_session (int argc, GError **error) { char **new_argv; + char *address; int i; if (g_getenv ("DBUS_SESSION_BUS_ADDRESS")) return TRUE; + /* Use the bus the user session already has (GDBus looks for the + * well-known socket at $XDG_RUNTIME_DIR/bus), rather than starting a + * second one that activated services and portals would be split + * across. Exporting the address keeps all our children on it. */ + address = g_dbus_address_get_for_bus_sync (G_BUS_TYPE_SESSION, NULL, NULL); + if (address != NULL) { + g_setenv ("DBUS_SESSION_BUS_ADDRESS", address, TRUE); + g_free (address); + return TRUE; + } + /* Just a sanity check to prevent infinite recursion if * dbus-launch fails to set DBUS_SESSION_BUS_ADDRESS */ @@ -183,17 +195,15 @@ require_dbus_session (int argc, } new_argv[i + 2] = NULL; - if (!execvp ("dbus-launch", new_argv)) { - g_set_error (error, - G_SPAWN_ERROR, - G_SPAWN_ERROR_FAILED, - "No session bus and could not exec dbus-launch: %s", - g_strerror (errno)); - return FALSE; - } - - /* Should not be reached */ - return TRUE; + /* execvp() only returns on failure */ + execvp ("dbus-launch", new_argv); + + g_set_error (error, + G_SPAWN_ERROR, + G_SPAWN_ERROR_FAILED, + "No session bus and could not exec dbus-launch: %s", + g_strerror (errno)); + return FALSE; } /* Whether ~/.xinputrc (written by im-config / mintlocale-im) selects fcitx5. diff --git a/debian/control b/debian/control index d2ea80e..dd24323 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Build-Depends: libcanberra-dev, libcinnamon-desktop-dev (>= 6.0), libgl-dev, - libglib2.0-dev (>= 2.37.3), + libglib2.0-dev (>= 2.50.0), libgtk-3-dev (>= 3.0.0), libice-dev, libpango1.0-dev, diff --git a/meson.build b/meson.build index 0d2031c..1653efd 100644 --- a/meson.build +++ b/meson.build @@ -28,9 +28,9 @@ endif ################################################################################ # Dependencies -gio = dependency('gio-2.0') +gio = dependency('gio-2.0', version: '>=2.50.0') gtk3 = dependency('gtk+-3.0', version: '>=3.0.0') -glib = dependency('glib-2.0', version: '>=2.37.3') +glib = dependency('glib-2.0', version: '>=2.50.0') libcanberra = dependency('libcanberra') pango = dependency('pango') pangoxft = dependency('pangoxft', required: false)