From 2df8fc4fb2687402bb8fcb5b225571b865e3c1b7 Mon Sep 17 00:00:00 2001 From: Adrian Vovk Date: Thu, 13 Nov 2025 15:18:51 -0500 Subject: [PATCH] gnome-classic: Define a gnome-session session For one, this is simply more correct: the gnome-classic session is a different session from the default gnome session. So let's define it as such For two, this enables us to directly tell gnome-shell which shell mode to use, rather than passing it through an environment variable. In other words, this enables us to integrate with https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3960 --- REUSE.toml | 8 +++++++- data/gnome-classic.desktop.in | 2 +- data/gnome-classic.session | 2 ++ data/gnome-classic.session.conf | 3 +++ data/meson.build | 10 ++++++++++ meson.build | 7 +++++++ 6 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 data/gnome-classic.session create mode 100644 data/gnome-classic.session.conf diff --git a/REUSE.toml b/REUSE.toml index e917c8f6..768f7a7d 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -15,7 +15,13 @@ SPDX-FileCopyrightText = [ SPDX-License-Identifier = "CC-BY-SA-4.0" [[annotations]] -path = ["**.json.in", "**.desktop.in", "**.gschema.override"] +path = [ + "**.json.in", + "**.desktop.in", + "**.gschema.override", + "**.session", + "**.session.conf", +] SPDX-FileCopyrightText = "Florian Müllner " SPDX-License-Identifier = "GPL-2.0-or-later" diff --git a/data/gnome-classic.desktop.in b/data/gnome-classic.desktop.in index 269f131d..1a30f7d1 100644 --- a/data/gnome-classic.desktop.in +++ b/data/gnome-classic.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Name=GNOME Classic Comment=This session logs you into GNOME Classic -Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session +Exec=gnome-session --session gnome-classic TryExec=gnome-session Type=Application DesktopNames=GNOME-Classic;GNOME; diff --git a/data/gnome-classic.session b/data/gnome-classic.session new file mode 100644 index 00000000..33553721 --- /dev/null +++ b/data/gnome-classic.session @@ -0,0 +1,2 @@ +[GNOME Session] +Name=GNOME Classic \ No newline at end of file diff --git a/data/gnome-classic.session.conf b/data/gnome-classic.session.conf new file mode 100644 index 00000000..441525fc --- /dev/null +++ b/data/gnome-classic.session.conf @@ -0,0 +1,3 @@ +[Unit] +Requires=gnome-session-services.target +Requires=org.gnome.Shell@classic.service \ No newline at end of file diff --git a/data/meson.build b/data/meson.build index 51a2bac7..a4fab5d7 100644 --- a/data/meson.build +++ b/data/meson.build @@ -31,3 +31,13 @@ configure_file( classic_override = '00_org.gnome.shell.extensions.classic.gschema.override' install_data(classic_override, install_dir: schemadir) + +install_data( + 'gnome-classic.session', + install_dir: sessiondir, +) + +install_data( + 'gnome-classic.session.conf', + install_dir: systemd_userunitdir / 'gnome-session@gnome-classic.target.d', +) \ No newline at end of file diff --git a/meson.build b/meson.build index 7b866b8b..d905c049 100644 --- a/meson.build +++ b/meson.build @@ -25,6 +25,13 @@ schemadir = join_paths(datadir, 'glib-2.0', 'schemas') sessiondir = join_paths(datadir, 'gnome-session', 'sessions') wlsessiondir = join_paths(datadir, 'wayland-sessions') +systemd_dep = dependency('systemd', required: false) +systemd_userunitdir = systemd_dep.get_variable( + pkgconfig: 'systemduserunitdir', + pkgconfig_define: ['prefix', get_option('prefix')], + default_value: get_option('prefix') / 'lib' / 'systemd' / 'user', +) + ver_arr = meson.project_version().split('.') shell_version = ver_arr[0]