Skip to content

Commit

Permalink
gnome3.gdm: fix session chooser
Browse files Browse the repository at this point in the history
We are patching GDM to respect GDM_SESSIONS_DIR environment
variable, which we are setting in the GDM module. Previously, we
only took care of a single code path, the one that handled session
start-up; missing the one obtaining the list of sessions.

This commit patches the second code path, and also whitelists the
GDM_SESSIONS_DIR so that it can be passed to the greeter.

Fixes #34101
  • Loading branch information
jtojnar committed May 6, 2018
1 parent 127de74 commit 300af66
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions pkgs/desktops/gnome-3/core/gdm/sessions_dir.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index ff3a1acb..b8705d8f 100644
--- a/daemon/gdm-launch-environment.c
+++ b/daemon/gdm-launch-environment.c
@@ -126,7 +126,7 @@
"LC_COLLATE", "LC_MONETARY", "LC_MESSAGES", "LC_PAPER",
"LC_NAME", "LC_ADDRESS", "LC_TELEPHONE", "LC_MEASUREMENT",
"LC_IDENTIFICATION", "LC_ALL", "WINDOWPATH", "XCURSOR_PATH",
- "XDG_CONFIG_DIRS", NULL
+ "XDG_CONFIG_DIRS", "GDM_SESSIONS_DIR", NULL

This comment has been minimized.

Copy link
@matthewbauer

matthewbauer Oct 15, 2018

Member

This only supports 1 directory, correct? I am struggling with getting sway & gdm to work without using any X11. Sway installs into /share/wayland-sessions. Can we add that directory as well? Honestly I think adding hardcoded paths of /run/current-system/sw/share/xsessions and /run/current-system/sw/share/wayland-session would be an easy fix. GDM_SESSIONS_DIRS would be a nice thing to get into GDM though.

This comment has been minimized.

Copy link
@jtojnar

jtojnar Oct 15, 2018

Author Member

I submitted a patch upstream, that allows loading session files from XDG_DATA_DIRS. It is part of GNOME 3.30 and this patch was modified accordingly in our upgrade branch: #45950

This comment has been minimized.

Copy link
@matthewbauer

matthewbauer Oct 15, 2018

Member

Awesome! If we can get that to be a standard in DMs, we can probably get rid of extraSessionFilePackages and the mkDesktop logic, right? But maybe we should still fix extraSessionFilePackages to work with wayland-sessions...

This comment has been minimized.

Copy link
@jtojnar

jtojnar Oct 15, 2018

Author Member

Yes, that is our goal, see #39871. For wayland support, see #44497.

However, we still would need a replacement for things like Xmonad on metacity: something like mkDesktop that would just generate custom session files.

};
char *system_data_dirs;
int i;
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -344,6 +344,7 @@ get_system_session_dirs (GdmSession *self)
@@ -345,12 +345,17 @@
char **search_dirs;

static const char *x_search_dirs[] = {
+ "/var/empty",
"/etc/X11/sessions/",
DMCONFDIR "/Sessions/",
DATADIR "/gdm/BuiltInSessions/",
@@ -351,6 +352,10 @@ get_system_session_dirs (GdmSession *self)
NULL
DATADIR "/xsessions/",
};

+ if (getenv("GDM_SESSIONS_DIR") != NULL) {
Expand All @@ -21,3 +29,24 @@ index ff3a1acb..b8705d8f 100644
static const char *wayland_search_dir = DATADIR "/wayland-sessions/";

search_array = g_array_new (TRUE, TRUE, sizeof (char *));
--- a/libgdm/gdm-sessions.c
+++ b/libgdm/gdm-sessions.c
@@ -217,6 +217,7 @@
{
int i;
const char *xorg_search_dirs[] = {
+ "/var/empty/",
"/etc/X11/sessions/",
DMCONFDIR "/Sessions/",
DATADIR "/gdm/BuiltInSessions/",
@@ -224,6 +225,10 @@
NULL
};

+ if (g_getenv("GDM_SESSIONS_DIR") != NULL) {
+ xorg_search_dirs[0] = g_getenv("GDM_SESSIONS_DIR");
+ };
+
#ifdef ENABLE_WAYLAND_SUPPORT
const char *wayland_search_dirs[] = {
DATADIR "/wayland-sessions/",

0 comments on commit 300af66

Please sign in to comment.