Commit 0c9f6629 authored by Olivier Tilloy's avatar Olivier Tilloy Committed by Iain Lane
Browse files

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.
parent 13e71c28
......@@ -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")) {
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);
g_free (fallback_path);
id = g_strndup (filename, strlen (filename) - strlen (".desktop"));
full_path = g_build_filename (dirname, filename, NULL);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment