Commit f40ea8f1 authored by Marco Trevisan's avatar Marco Trevisan 🎺

launch-environment: use session name instead of generating commands

Add .desktop files to generate gnome-session commands for the greeter itself.
parent 5675903d
...@@ -62,7 +62,7 @@ extern char **environ; ...@@ -62,7 +62,7 @@ extern char **environ;
struct GdmLaunchEnvironmentPrivate struct GdmLaunchEnvironmentPrivate
{ {
GdmSession *session; GdmSession *session;
char *command; char *session_name;
GPid pid; GPid pid;
GdmSessionVerificationMode verification_mode; GdmSessionVerificationMode verification_mode;
...@@ -94,7 +94,7 @@ enum { ...@@ -94,7 +94,7 @@ enum {
PROP_X11_DISPLAY_IS_LOCAL, PROP_X11_DISPLAY_IS_LOCAL,
PROP_USER_NAME, PROP_USER_NAME,
PROP_RUNTIME_DIR, PROP_RUNTIME_DIR,
PROP_COMMAND, PROP_SESSION_NAME,
}; };
enum { enum {
...@@ -449,7 +449,7 @@ gdm_launch_environment_start (GdmLaunchEnvironment *launch_environment) ...@@ -449,7 +449,7 @@ gdm_launch_environment_start (GdmLaunchEnvironment *launch_environment)
0); 0);
gdm_session_start_conversation (launch_environment->priv->session, "gdm-launch-environment"); gdm_session_start_conversation (launch_environment->priv->session, "gdm-launch-environment");
gdm_session_select_program (launch_environment->priv->session, launch_environment->priv->command); gdm_session_select_session (launch_environment->priv->session, launch_environment->priv->session_name);
if (launch_environment->priv->session_type != NULL) { if (launch_environment->priv->session_type != NULL) {
g_object_set (G_OBJECT (launch_environment->priv->session), g_object_set (G_OBJECT (launch_environment->priv->session),
...@@ -584,11 +584,11 @@ _gdm_launch_environment_set_runtime_dir (GdmLaunchEnvironment *launch_environmen ...@@ -584,11 +584,11 @@ _gdm_launch_environment_set_runtime_dir (GdmLaunchEnvironment *launch_environmen
} }
static void static void
_gdm_launch_environment_set_command (GdmLaunchEnvironment *launch_environment, _gdm_launch_environment_set_session_name (GdmLaunchEnvironment *launch_environment,
const char *name) const char *session_name)
{ {
g_free (launch_environment->priv->command); g_free (launch_environment->priv->session_name);
launch_environment->priv->command = g_strdup (name); launch_environment->priv->session_name = g_strdup (session_name);
} }
static void static void
...@@ -635,8 +635,8 @@ gdm_launch_environment_set_property (GObject *object, ...@@ -635,8 +635,8 @@ gdm_launch_environment_set_property (GObject *object,
case PROP_RUNTIME_DIR: case PROP_RUNTIME_DIR:
_gdm_launch_environment_set_runtime_dir (self, g_value_get_string (value)); _gdm_launch_environment_set_runtime_dir (self, g_value_get_string (value));
break; break;
case PROP_COMMAND: case PROP_SESSION_NAME:
_gdm_launch_environment_set_command (self, g_value_get_string (value)); _gdm_launch_environment_set_session_name (self, g_value_get_string (value));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
...@@ -688,8 +688,8 @@ gdm_launch_environment_get_property (GObject *object, ...@@ -688,8 +688,8 @@ gdm_launch_environment_get_property (GObject *object,
case PROP_RUNTIME_DIR: case PROP_RUNTIME_DIR:
g_value_set_string (value, self->priv->runtime_dir); g_value_set_string (value, self->priv->runtime_dir);
break; break;
case PROP_COMMAND: case PROP_SESSION_NAME:
g_value_set_string (value, self->priv->command); g_value_set_string (value, self->priv->session_name);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
...@@ -787,10 +787,10 @@ gdm_launch_environment_class_init (GdmLaunchEnvironmentClass *klass) ...@@ -787,10 +787,10 @@ gdm_launch_environment_class_init (GdmLaunchEnvironmentClass *klass)
NULL, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_COMMAND, PROP_SESSION_NAME,
g_param_spec_string ("command", g_param_spec_string ("session-name",
"command", "session name",
"command", "session name",
NULL, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
signals [OPENED] = signals [OPENED] =
...@@ -865,7 +865,7 @@ gdm_launch_environment_init (GdmLaunchEnvironment *launch_environment) ...@@ -865,7 +865,7 @@ gdm_launch_environment_init (GdmLaunchEnvironment *launch_environment)
launch_environment->priv = GDM_LAUNCH_ENVIRONMENT_GET_PRIVATE (launch_environment); launch_environment->priv = GDM_LAUNCH_ENVIRONMENT_GET_PRIVATE (launch_environment);
launch_environment->priv->command = NULL; launch_environment->priv->session_name = NULL;
launch_environment->priv->session = NULL; launch_environment->priv->session = NULL;
} }
...@@ -887,7 +887,7 @@ gdm_launch_environment_finalize (GObject *object) ...@@ -887,7 +887,7 @@ gdm_launch_environment_finalize (GObject *object)
g_object_unref (launch_environment->priv->session); g_object_unref (launch_environment->priv->session);
} }
g_free (launch_environment->priv->command); g_free (launch_environment->priv->session_name);
g_free (launch_environment->priv->user_name); g_free (launch_environment->priv->user_name);
g_free (launch_environment->priv->runtime_dir); g_free (launch_environment->priv->runtime_dir);
g_free (launch_environment->priv->x11_display_name); g_free (launch_environment->priv->x11_display_name);
...@@ -902,7 +902,7 @@ gdm_launch_environment_finalize (GObject *object) ...@@ -902,7 +902,7 @@ gdm_launch_environment_finalize (GObject *object)
} }
static GdmLaunchEnvironment * static GdmLaunchEnvironment *
create_gnome_session_environment (const char *session_id, create_gnome_session_environment (const char *session_name,
const char *user_name, const char *user_name,
const char *display_name, const char *display_name,
const char *seat_id, const char *seat_id,
...@@ -911,37 +911,10 @@ create_gnome_session_environment (const char *session_id, ...@@ -911,37 +911,10 @@ create_gnome_session_environment (const char *session_id,
const char *display_hostname, const char *display_hostname,
gboolean display_is_local) gboolean display_is_local)
{ {
gboolean debug = FALSE;
char *command;
GdmLaunchEnvironment *launch_environment; GdmLaunchEnvironment *launch_environment;
char **argv;
GPtrArray *args;
gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
args = g_ptr_array_new ();
g_ptr_array_add (args, "gnome-session");
g_ptr_array_add (args, "--autostart");
g_ptr_array_add (args, DATADIR "/gdm/greeter/autostart");
if (debug) {
g_ptr_array_add (args, "--debug");
}
if (session_id != NULL) {
g_ptr_array_add (args, " --session");
g_ptr_array_add (args, (char *) session_id);
}
g_ptr_array_add (args, NULL);
argv = (char **) g_ptr_array_free (args, FALSE);
command = g_strjoinv (" ", argv);
g_free (argv);
launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT, launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT,
"command", command, "session-name", session_name,
"user-name", user_name, "user-name", user_name,
"session-type", session_type, "session-type", session_type,
"session-mode", session_mode, "session-mode", session_mode,
...@@ -952,7 +925,6 @@ create_gnome_session_environment (const char *session_id, ...@@ -952,7 +925,6 @@ create_gnome_session_environment (const char *session_id,
"runtime-dir", GDM_SCREENSHOT_DIR, "runtime-dir", GDM_SCREENSHOT_DIR,
NULL); NULL);
g_free (command);
return launch_environment; return launch_environment;
} }
...@@ -963,9 +935,7 @@ gdm_create_greeter_launch_environment (const char *display_name, ...@@ -963,9 +935,7 @@ gdm_create_greeter_launch_environment (const char *display_name,
const char *display_hostname, const char *display_hostname,
gboolean display_is_local) gboolean display_is_local)
{ {
const char *session_name = NULL; return create_gnome_session_environment ("gnome-greeter",
return create_gnome_session_environment (session_name,
GDM_USERNAME, GDM_USERNAME,
display_name, display_name,
seat_id, seat_id,
...@@ -1000,7 +970,7 @@ gdm_create_chooser_launch_environment (const char *display_name, ...@@ -1000,7 +970,7 @@ gdm_create_chooser_launch_environment (const char *display_name,
GdmLaunchEnvironment *launch_environment; GdmLaunchEnvironment *launch_environment;
launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT, launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT,
"command", LIBEXECDIR "/gdm-simple-chooser", "session-name", "gdm-simple-chooser",
"verification-mode", GDM_SESSION_VERIFICATION_MODE_CHOOSER, "verification-mode", GDM_SESSION_VERIFICATION_MODE_CHOOSER,
"user-name", GDM_USERNAME, "user-name", GDM_USERNAME,
"x11-display-name", display_name, "x11-display-name", display_name,
......
...@@ -15,6 +15,7 @@ workingdir = $(GDM_WORKING_DIR) ...@@ -15,6 +15,7 @@ workingdir = $(GDM_WORKING_DIR)
xauthdir = $(GDM_XAUTH_DIR) xauthdir = $(GDM_XAUTH_DIR)
screenshotdir = $(GDM_SCREENSHOT_DIR) screenshotdir = $(GDM_SCREENSHOT_DIR)
cachedir = $(localstatedir)/cache/gdm cachedir = $(localstatedir)/cache/gdm
gdmdatadir = $(datadir)/gdm
Init: $(srcdir)/Init.in Init: $(srcdir)/Init.in
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \ sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
...@@ -80,16 +81,47 @@ $(schemas_DATA): $(schemas_in_files) ...@@ -80,16 +81,47 @@ $(schemas_DATA): $(schemas_in_files)
<$(srcdir)/gdm.schemas.in >gdm.schemas <$(srcdir)/gdm.schemas.in >gdm.schemas
EXTRA_DIST += gnome-login.session.in EXTRA_DIST += \
gdm-simple-chooser.desktop.in \
gnome-greeter.desktop.in \
gnome-initial-setup.desktop.in \
gnome-login.session.in \
$(NULL)
gnome-login.session: $(srcdir)/gnome-login.session.in gnome-login.session: $(srcdir)/gnome-login.session.in
sed -e 's,[@]libexecdir[@],$(libexecdir),g' \ sed -e 's,[@]libexecdir[@],$(libexecdir),g' \
-e 's,[@]CHECK_ACCELERATED_DIR[@],$(CHECK_ACCELERATED_DIR),g' \ -e 's,[@]CHECK_ACCELERATED_DIR[@],$(CHECK_ACCELERATED_DIR),g' \
< $< > $@.tmp && mv $@.tmp $@ < $< > $@.tmp && mv $@.tmp $@
localealiasdir = $(datadir)/gdm gdm-simple-chooser.desktop: $(srcdir)/gdm-simple-chooser.desktop.in
sed -e 's,[@]libexecdir[@],$(libexecdir),g' \
< $< > $@.tmp && mv $@.tmp $@
gnome-greeter.desktop: $(srcdir)/gnome-greeter.desktop.in
sed -e 's,[@]gdmdatadir[@],$(gdmdatadir),g' \
< $< > $@.tmp && mv $@.tmp $@
gnome-initial-setup.desktop: $(srcdir)/gnome-initial-setup.desktop.in
sed -e 's,[@]gdmdatadir[@],$(gdmdatadir),g' \
< $< > $@.tmp && mv $@.tmp $@
localealiasdir = $(gdmdatadir)
localealias_DATA = locale.alias localealias_DATA = locale.alias
gdmxsessionsdir = $(gdmdatadir)/greeter/xsessions
gdmxsessions_DATA = \
gdm-simple-chooser.desktop \
gnome-greeter.desktop \
gnome-initial-setup.desktop \
$(NULL)
gdmwaylandsessionsdir = $(gdmdatadir)/greeter/wayland-sessions
gdmwaylandsessions_DATA = \
gdm-simple-chooser.desktop \
gnome-greeter.desktop \
gnome-initial-setup.desktop \
$(NULL)
sessiondir = $(datadir)/gnome-session/sessions sessiondir = $(datadir)/gnome-session/sessions
session_DATA = gnome-login.session session_DATA = gnome-login.session
...@@ -190,6 +222,9 @@ CLEANFILES = \ ...@@ -190,6 +222,9 @@ CLEANFILES = \
DISTCLEANFILES = \ DISTCLEANFILES = \
$(dbusconf_DATA) \ $(dbusconf_DATA) \
gdm.schemas \ gdm.schemas \
gdm-simple-chooser.desktop \
gnome-greeter.desktop \
gnome-initial-setup.desktop \
gnome-login.session \ gnome-login.session \
$(NULL) $(NULL)
......
[Desktop Entry]
Name=GDM Simple Chooser
Comment=GNOME Display Manager Simple Chooser
Exec=@libexecdir@/gdm-simple-chooser
TryExec=@libexecdir@/gdm-simple-chooser
Type=Application
DesktopNames=GDM-Simple-Chooser:GNOME-Greeter:GNOME
NoDisplay=true
[Desktop Entry]
Name=GNOME Greeter
Comment=The default GNOME Greeter session
Exec=gnome-session --autostart @gdmdatadir@/greeter/autostart
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Greeter:GNOME
NoDisplay=true
[Desktop Entry]
Name=GNOME Initial Setup
Comment=The GNOME Initial Setup session
Exec=gnome-session --autostart @gdmdatadir@/greeter/autostart --session gnome-initial-setup
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Greeter:GNOME-Initial-Setup:GNOME
NoDisplay=true
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