Commit 7c15e3e7 authored by Marco Trevisan's avatar Marco Trevisan 🎺

session: add use -debug.desktop files in debug mode

If debug is enabled try to load the ${session}-debug.desktop file to launch
the session, and provide defaults for gnome-greeter and gnome-initial-setup.
parent 2e9836f5
Pipeline #25964 passed with stage
in 4 minutes and 57 seconds
......@@ -182,6 +182,7 @@ enum {
static gboolean gdm_session_is_wayland_session (GdmSession *self);
#endif
static void update_session_type (GdmSession *self);
static char *get_session_filename (GdmSession *self);
static void set_session_type (GdmSession *self,
const char *session_type);
static guint signals [LAST_SIGNAL] = { 0, };
......@@ -514,6 +515,26 @@ out:
return ret;
}
static char *
get_session_filename_for_session (GdmSession *self,
const char *session_name)
{
gboolean debug = FALSE;
gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
if (debug) {
g_autofree char *filename = NULL;
filename = g_strconcat (session_name, "-debug.desktop", NULL);
if (get_session_command_for_file (self, filename, NULL)) {
return g_steal_pointer (&filename);
}
}
return g_strconcat (session_name, ".desktop", NULL);
}
static gboolean
get_session_command_for_name (GdmSession *self,
const char *name,
......@@ -522,7 +543,7 @@ get_session_command_for_name (GdmSession *self,
gboolean res;
char *filename;
filename = g_strdup_printf ("%s.desktop", name);
filename = get_session_filename_for_session (self, name);
res = get_session_command_for_file (self, filename, command);
g_free (filename);
......@@ -2478,7 +2499,7 @@ get_session_desktop_names (GdmSession *self)
GKeyFile *keyfile;
gchar *desktop_names = NULL;
filename = g_strdup_printf ("%s.desktop", get_session_name (self));
filename = get_session_filename (self);
g_debug ("GdmSession: getting desktop names for file '%s'", filename);
keyfile = load_key_file_for_file (self, filename, NULL);
if (keyfile != NULL) {
......@@ -3017,7 +3038,7 @@ gdm_session_get_conversation_session_id (GdmSession *self,
static char *
get_session_filename (GdmSession *self)
{
return g_strdup_printf ("%s.desktop", get_session_name (self));
return get_session_filename_for_session (self, get_session_name (self));
}
#ifdef ENABLE_WAYLAND_SUPPORT
......
......@@ -99,10 +99,22 @@ gdm-simple-chooser.desktop: $(srcdir)/gdm-simple-chooser.desktop.in
gnome-greeter.desktop: $(srcdir)/gnome-greeter.desktop.in
sed -e 's,[@]gdmdatadir[@],$(gdmdatadir),g' \
-e 's,[@]EXTRA_ARGS[@],,g' \
< $< > $@.tmp && mv $@.tmp $@
gnome-greeter-debug.desktop: $(srcdir)/gnome-greeter.desktop.in
sed -e 's,[@]gdmdatadir[@],$(gdmdatadir),g' \
-e 's,[@]EXTRA_ARGS[@],--debug,g' \
< $< > $@.tmp && mv $@.tmp $@
gnome-initial-setup.desktop: $(srcdir)/gnome-initial-setup.desktop.in
sed -e 's,[@]gdmdatadir[@],$(gdmdatadir),g' \
-e 's,[@]EXTRA_ARGS[@],,g' \
< $< > $@.tmp && mv $@.tmp $@
gnome-initial-setup-debug.desktop: $(srcdir)/gnome-initial-setup.desktop.in
sed -e 's,[@]gdmdatadir[@],$(gdmdatadir),g' \
-e 's,[@]EXTRA_ARGS[@],--debug,g' \
< $< > $@.tmp && mv $@.tmp $@
localealiasdir = $(gdmdatadir)
......@@ -112,14 +124,18 @@ gdmxsessionsdir = $(gdmdatadir)/greeter/xsessions
gdmxsessions_DATA = \
gdm-simple-chooser.desktop \
gnome-greeter.desktop \
gnome-greeter-debug.desktop \
gnome-initial-setup.desktop \
gnome-initial-setup-debug.desktop \
$(NULL)
gdmwaylandsessionsdir = $(gdmdatadir)/greeter/wayland-sessions
gdmwaylandsessions_DATA = \
gdm-simple-chooser.desktop \
gnome-greeter.desktop \
gnome-greeter-debug.desktop \
gnome-initial-setup.desktop \
gnome-initial-setup-debug.desktop \
$(NULL)
sessiondir = $(datadir)/gnome-session/sessions
......@@ -224,7 +240,9 @@ DISTCLEANFILES = \
gdm.schemas \
gdm-simple-chooser.desktop \
gnome-greeter.desktop \
gnome-greeter-debug.desktop \
gnome-initial-setup.desktop \
gnome-initial-setup-debug.desktop \
gnome-login.session \
$(NULL)
......
[Desktop Entry]
Name=GNOME Greeter
Comment=The default GNOME Greeter session
Exec=gnome-session --autostart @gdmdatadir@/greeter/autostart
Exec=gnome-session --autostart @gdmdatadir@/greeter/autostart @EXTRA_ARGS@
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Greeter:GNOME
......
[Desktop Entry]
Name=GNOME Initial Setup
Comment=The GNOME Initial Setup session
Exec=gnome-session --autostart @gdmdatadir@/greeter/autostart --session gnome-initial-setup
Exec=gnome-session --autostart @gdmdatadir@/greeter/autostart --session gnome-initial-setup @EXTRA_ARGS@
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Greeter:GNOME-Initial-Setup:GNOME
......
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