diff --git a/exo/exo-execute.c b/exo/exo-execute.c index 1fabf57..3295b05 100644 --- a/exo/exo-execute.c +++ b/exo/exo-execute.c @@ -125,6 +125,7 @@ exo_execute_preferred_application_on_screen (const gchar *category, { gchar *argv[5]; gchar *display; + gchar *xauth; gchar **envp = g_strdupv (envp_in); gint argc = 0; gboolean success; @@ -148,11 +149,17 @@ exo_execute_preferred_application_on_screen (const gchar *category, /* set the display environment variable */ display = gdk_screen_make_display_name (screen); envp = g_environ_setenv (envp, "DISPLAY", display, TRUE); + + /* set the xauthority environment variable */ + xauth = g_strdup (g_getenv ("XAUTHORITY")); + if (G_LIKELY (xauth != NULL)) + envp = g_environ_setenv (envp, "XAUTHORITY", xauth, TRUE); /* launch the command */ success = g_spawn_async (working_directory, argv, envp, 0, NULL, NULL, NULL, error); g_free (display); + g_free (xauth); g_strfreev (envp); return success; }