diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index 91b14af558..dd2aeb038c 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -329,7 +329,7 @@ static void gtk_application_add_platform_data (GApplication *application, GVariantBuilder *builder) { - const gchar *startup_id; + GdkDisplay *display; /* This is slightly evil. * @@ -338,11 +338,16 @@ gtk_application_add_platform_data (GApplication *application, * * So we do all the things... which currently is just one thing. */ - startup_id = getenv ("DESKTOP_STARTUP_ID"); + display = gdk_display_get_default (); + if (display) + { + const gchar *startup_id; - if (startup_id && g_utf8_validate (startup_id, -1, NULL)) - g_variant_builder_add (builder, "{sv}", "desktop-startup-id", - g_variant_new_string (startup_id)); + startup_id = gdk_display_get_startup_notification_id (display); + if (startup_id && g_utf8_validate (startup_id, -1, NULL)) + g_variant_builder_add (builder, "{sv}", "desktop-startup-id", + g_variant_new_string (startup_id)); + } } static void