From 2d6d95e4e90fae014fc5615ab39fe64ba49d9a29 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 21 Jan 2016 10:27:58 -0500 Subject: [PATCH] session: make sure greeter is GNOME session even if gnome isn't installed We figure out the XDG_CURRENT_DESKTOP by looking at the session that's use for login. For the greeter, we don't use a session, at all, but instead a directly specified program. Still, we're determining the XDG_CURRENT_DESKTOP for the greeter based on what default session gets picked. On KDE only setups, the greeter will get marked as a KDE session which will prevent gnome-settings-daemon from starting properly. This commit changes the code so that greeter sessions, don't rely on the default session desktop file. https://bugzilla.gnome.org/show_bug.cgi?id=760943 --- daemon/gdm-session.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c index 647db86..ae94999 100644 --- a/daemon/gdm-session.c +++ b/daemon/gdm-session.c @@ -2502,60 +2502,64 @@ get_session_name (GdmSession *self) return get_default_session_name (self); } static char * get_session_command (GdmSession *self) { gboolean res; char *command; const char *session_name; session_name = get_session_name (self); command = NULL; res = get_session_command_for_name (session_name, &command); if (! res) { g_critical ("Cannot find a command for specified session: %s", session_name); exit (1); } return command; } static gchar * get_session_desktop_names (GdmSession *self) { gchar *filename; GKeyFile *keyfile; gchar *desktop_names = NULL; + if (self->priv->selected_program != NULL) { + return g_strdup ("GNOME-Greeter:GNOME"); + } + filename = g_strdup_printf ("%s.desktop", get_session_name (self)); keyfile = load_key_file_for_file (filename, NULL); if (keyfile != NULL) { gchar **names; names = g_key_file_get_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, "DesktopNames", NULL, NULL); if (names != NULL) { desktop_names = g_strjoinv (":", names); g_strfreev (names); } } g_key_file_free (keyfile); g_free (filename); return desktop_names; } void gdm_session_set_environment_variable (GdmSession *self, const char *key, const char *value) { g_return_if_fail (key != NULL); g_return_if_fail (value != NULL); g_hash_table_replace (self->priv->environment, g_strdup (key), g_strdup (value)); @@ -2565,69 +2569,71 @@ static void set_up_session_language (GdmSession *self) { char **environment; int i; const char *value; environment = g_listenv (); for (i = 0; environment[i] != NULL; i++) { if (strcmp (environment[i], "LANG") != 0 && strcmp (environment[i], "LANGUAGE") != 0 && !g_str_has_prefix (environment[i], "LC_")) { continue; } value = g_getenv (environment[i]); gdm_session_set_environment_variable (self, environment[i], value); } g_strfreev (environment); } static void set_up_session_environment (GdmSession *self) { GdmSessionDisplayMode display_mode; gchar *desktop_names; char *locale; - gdm_session_set_environment_variable (self, - "GDMSESSION", - get_session_name (self)); - gdm_session_set_environment_variable (self, - "DESKTOP_SESSION", - get_session_name (self)); - gdm_session_set_environment_variable (self, - "XDG_SESSION_DESKTOP", - get_session_name (self)); + if (self->priv->selected_program == NULL) { + gdm_session_set_environment_variable (self, + "GDMSESSION", + get_session_name (self)); + gdm_session_set_environment_variable (self, + "DESKTOP_SESSION", + get_session_name (self)); + gdm_session_set_environment_variable (self, + "XDG_SESSION_DESKTOP", + get_session_name (self)); + } desktop_names = get_session_desktop_names (self); if (desktop_names != NULL) { gdm_session_set_environment_variable (self, "XDG_CURRENT_DESKTOP", desktop_names); } set_up_session_language (self); locale = g_strdup (get_default_language_name (self)); if (locale != NULL && locale[0] != '\0') { gdm_session_set_environment_variable (self, "LANG", locale); gdm_session_set_environment_variable (self, "GDM_LANG", locale); } g_free (locale); display_mode = gdm_session_get_display_mode (self); if (display_mode == GDM_SESSION_DISPLAY_MODE_REUSE_VT) { gdm_session_set_environment_variable (self, "DISPLAY", self->priv->display_name); if (self->priv->user_x11_authority_file != NULL) { gdm_session_set_environment_variable (self, "XAUTHORITY", -- 2.8.1