Skip to content

Commit 03f2189

Browse files
worldofpeacerobert-ancell
authored andcommitted
Determine a session is wayland with a better heuristic
Using the compiled in string WAYLAND_SESSIONS_DIR had some problems. In environments like NixOS, which install packages under their own immutable prefix under /nix/store. this assumption that the package would be compiled with `datadir=/usr/share` will break down. Checking if the directory contains the appropriate string is much simpler and will work with platforms like NixOS (or others as this setup popularizes).
1 parent fa30fc6 commit 03f2189

4 files changed

Lines changed: 2 additions & 4 deletions

File tree

liblightdm-gobject/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ liblightdm_gobject_1_la_CFLAGS = $(LIBLIGHTDM_GOBJECT_CFLAGS) \
99
-I"$(top_srcdir)/common" \
1010
-DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
1111
-DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions:$(datadir)/wayland-sessions\" \
12-
-DWAYLAND_SESSIONS_DIR=\"$(datadir)/wayland-sessions\" \
1312
-DREMOTE_SESSIONS_DIR=\"$(pkgdatadir)/remote-sessions\"
1413

1514
mainheader_HEADERS = lightdm.h

liblightdm-gobject/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ load_sessions (const gchar *sessions_dir)
171171
{
172172
const gchar *default_type = "x";
173173

174-
if (strcmp (dirs[i], WAYLAND_SESSIONS_DIR) == 0)
174+
if (dirs[i] != NULL && g_str_has_suffix (dirs[i], "/wayland-sessions") == TRUE)
175175
default_type = "wayland";
176176

177177
sessions = load_sessions_dir (sessions, dirs[i], default_type);

src/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ lightdm_CFLAGS = \
8282
-DRUN_DIR=\"$(localstatedir)/run/lightdm\" \
8383
-DCACHE_DIR=\"$(localstatedir)/cache/lightdm\" \
8484
-DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions:$(datadir)/wayland-sessions\" \
85-
-DWAYLAND_SESSIONS_DIR=\"$(datadir)/wayland-sessions\" \
8685
-DREMOTE_SESSIONS_DIR=\"$(pkgdatadir)/remote-sessions\"
8786

8887
lightdm_LDADD = \

src/seat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ find_session_config (Seat *seat, const gchar *sessions_dir, const gchar *session
956956
for (int i = 0; dirs[i]; i++)
957957
{
958958
const gchar *default_session_type = "x";
959-
if (strcmp (dirs[i], WAYLAND_SESSIONS_DIR) == 0)
959+
if (dirs[i] != NULL && g_str_has_suffix (dirs[i], "/wayland-sessions") == TRUE)
960960
default_session_type = "wayland";
961961

962962
g_autofree gchar *filename = g_strdup_printf ("%s.desktop", session_name);

0 commit comments

Comments
 (0)