diff options
author | Olivier Tilloy <olivier.tilloy@canonical.com> | 2017-10-17 18:15:12 +0200 |
---|---|---|
committer | Iain Lane <iain@orangesquash.org.uk> | 2017-10-17 17:33:30 +0100 |
commit | 0c9f6629bf2b25898375d020603efd3326f8824d (patch) | |
tree | 843fd0476b5c43a8e40fd7cd6a170a077cb54b6c | |
parent | 13e71c2825ecc83f841a14153ea4cf5e330c9fef (diff) | |
download | gdm-0c9f6629bf2b25898375d020603efd3326f8824d.tar.gz |
Ignore session IDs ending with "-xorg" under X11
This is done under the assumption that they are meant for Wayland only.
It is expected that a session called "foo" would have a "foo.desktop" file
under wayland-sessions/, a fallback "foo.desktop" under xsessions/, and
another "foo-xorg.desktop" under xsessions (that may simply be a symlink
to "foo.desktop") specifically for Wayland.
https://bugzilla.gnome.org/show_bug.cgi?id=788552
-rw-r--r-- | libgdm/gdm-sessions.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c index 4a5434ed..ee981350 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c @@ -157,6 +157,9 @@ collect_sessions_from_directory (const char *dirname) GDir *dir; const char *filename; + gboolean is_x11 = g_getenv ("WAYLAND_DISPLAY") == NULL && + g_getenv ("RUNNING_UNDER_GDM") != NULL; + /* FIXME: add file monitor to directory */ dir = g_dir_open (dirname, 0, NULL); @@ -171,6 +174,21 @@ collect_sessions_from_directory (const char *dirname) if (! g_str_has_suffix (filename, ".desktop")) { continue; } + + if (is_x11 && g_str_has_suffix (filename, "-xorg.desktop")) { + char *base_name = g_strndup (filename, strlen (filename) - strlen ("-xorg.desktop")); + char *fallback_name = g_strconcat (base_name, ".desktop", NULL); + g_free (base_name); + char *fallback_path = g_build_filename (dirname, fallback_name, NULL); + g_free (fallback_name); + if (g_file_test (fallback_path, G_FILE_TEST_EXISTS)) { + g_free (fallback_path); + g_debug ("Running under X11, ignoring %s", filename); + continue; + } + g_free (fallback_path); + } + id = g_strndup (filename, strlen (filename) - strlen (".desktop")); full_path = g_build_filename (dirname, filename, NULL); |