From ed5ea372fd5938c4ff46ef2deee407d8a50b4a7b Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 29 Oct 2021 10:16:13 -0400 Subject: [PATCH] Backport GNOME Classic session for Wayland (#2015741) --- gnome-classic-wayland.patch | 189 ++++++++++++++++++++++++++++++++++++ gnome-shell-extensions.spec | 11 ++- 2 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 gnome-classic-wayland.patch diff --git a/gnome-classic-wayland.patch b/gnome-classic-wayland.patch new file mode 100644 index 0000000..364acf3 --- /dev/null +++ b/gnome-classic-wayland.patch @@ -0,0 +1,189 @@ +From a79d2afb2d6119ae3a4d1eba020d6c35b3fece23 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Fri, 29 Oct 2021 09:33:06 -0400 +Subject: [PATCH 1/2] classic: Add X-GNOME-SessionRegisters + +GDM has supported sessions registering with it for a few years now so +it can know when to shut down the greeter. Having the GNOME Classic +session declare that it will register itself allows GDM to avoid +executing a fallback codepath. + +This has been supported with the regular GNOME session for a while, +and this session was likely forgotten about when it was added there. + +Part-of: +--- + data/gnome-classic.desktop.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/data/gnome-classic.desktop.in b/data/gnome-classic.desktop.in +index 5df6821..13da2b5 100644 +--- a/data/gnome-classic.desktop.in ++++ b/data/gnome-classic.desktop.in +@@ -5,3 +5,4 @@ Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session + TryExec=gnome-session + Type=Application + DesktopNames=GNOME-Classic;GNOME; ++X-GDM-SessionRegisters=true +-- +2.33.1 + + +From eb517c851777067087c3bf067c2baf10dcaf4128 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Fri, 29 Oct 2021 09:37:33 -0400 +Subject: [PATCH 2/2] classic: Install the session for Wayland and ship + override sessions + +The regular GNOME session ships with three options: + +* GNOME +* GNOME on Wayland (available when GDM starts in X11) +* GNOME on Xorg (available when GDM starts in Wayland) + +The main GNOME session is set up so it works to match how GDM starts, +so GNOME is on Wayland if GDM is (or GNOME is on X11 if GDM is). + +For GNOME Classic, we are missing this setup, so port this behavior +over from the GNOME session setup. + +Part-of: +--- + data/gnome-classic-wayland.desktop.in | 8 ++++++ + data/gnome-classic-xorg.desktop.in | 8 ++++++ + data/meson.build | 40 +++++++++++++++++++++------ + meson.build | 5 ++++ + meson/session-post-install.py | 20 ++++++++++++++ + 5 files changed, 72 insertions(+), 9 deletions(-) + create mode 100644 data/gnome-classic-wayland.desktop.in + create mode 100644 data/gnome-classic-xorg.desktop.in + create mode 100755 meson/session-post-install.py + +diff --git a/data/gnome-classic-wayland.desktop.in b/data/gnome-classic-wayland.desktop.in +new file mode 100644 +index 0000000..7287c68 +--- /dev/null ++++ b/data/gnome-classic-wayland.desktop.in +@@ -0,0 +1,8 @@ ++[Desktop Entry] ++Name=GNOME Classic on Wayland ++Comment=This session logs you into GNOME Classic ++Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session ++TryExec=gnome-session ++Type=Application ++DesktopNames=GNOME-Classic;GNOME; ++X-GDM-SessionRegisters=true +diff --git a/data/gnome-classic-xorg.desktop.in b/data/gnome-classic-xorg.desktop.in +new file mode 100644 +index 0000000..5fb338a +--- /dev/null ++++ b/data/gnome-classic-xorg.desktop.in +@@ -0,0 +1,8 @@ ++[Desktop Entry] ++Name=GNOME Classic on Xorg ++Comment=This session logs you into GNOME Classic ++Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session ++TryExec=gnome-session ++Type=Application ++DesktopNames=GNOME-Classic;GNOME; ++X-GDM-SessionRegisters=true +diff --git a/data/meson.build b/data/meson.build +index 27f4287..47fe798 100644 +--- a/data/meson.build ++++ b/data/meson.build +@@ -1,12 +1,34 @@ +-session_desktop = 'gnome-classic.desktop' +-i18n.merge_file('', +- input: session_desktop + '.in', +- output: session_desktop, +- po_dir: '../po', +- install: true, +- install_dir: xsessiondir, +- type: 'desktop' +-) ++session_desktop_base = 'gnome-classic' ++ ++session_desktops = [ ++ session_desktop_base, ++ session_desktop_base + '-xorg', ++ session_desktop_base + '-wayland', ++] ++ ++foreach name: session_desktops ++ session_desktop = name + '.desktop' ++ if name.endswith('-xorg') ++ session_instdir = xsessiondir ++ elif name.endswith('-wayland') ++ session_instdir = wlsessiondir ++ else ++ # FIXME: The same target can not be copied into two directories. ++ # There is a workaround in meson/session-post-install.py until proper ++ # solution arises: ++ # https://github.com/mesonbuild/meson/issues/2416 ++ session_instdir = xsessiondir ++ #session_instdir = [ xesssiondir, wlsessiondir ] ++ endif ++ i18n.merge_file('', ++ input: session_desktop + '.in', ++ output: session_desktop, ++ po_dir: '../po', ++ install: true, ++ install_dir: session_instdir, ++ type: 'desktop' ++ ) ++endforeach + + classic_uuids = [] + foreach e : classic_extensions +diff --git a/meson.build b/meson.build +index 8f2afda..33006b3 100644 +--- a/meson.build ++++ b/meson.build +@@ -20,6 +20,7 @@ themedir = join_paths(shelldir, 'theme') + schemadir = join_paths(datadir, 'glib-2.0', 'schemas') + sessiondir = join_paths(datadir, 'gnome-session', 'sessions') + xsessiondir = join_paths(datadir, 'xsessions') ++wlsessiondir = join_paths(datadir, 'wayland-sessions') + + ver_arr = meson.project_version().split('.') + shell_version = ver_arr[0] +@@ -83,6 +84,10 @@ endforeach + + if classic_mode_enabled + subdir('data') ++ meson.add_install_script( ++ 'meson/session-post-install.py', ++ join_paths(get_option('prefix'), datadir) ++ ) + endif + + subdir('extensions') +diff --git a/meson/session-post-install.py b/meson/session-post-install.py +new file mode 100755 +index 0000000..36abe5e +--- /dev/null ++++ b/meson/session-post-install.py +@@ -0,0 +1,20 @@ ++#!/usr/bin/env python3 ++ ++import os ++import shutil ++import sys ++ ++if os.environ.get('DESTDIR'): ++ install_root = os.environ.get('DESTDIR') + os.path.abspath(sys.argv[1]) ++else: ++ install_root = sys.argv[1] ++ ++# FIXME: Meson is unable to copy a generated target file: ++# https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0 ++dst_dir = os.path.join(install_root, 'wayland-sessions') ++if not os.path.exists(dst_dir): ++ os.makedirs(dst_dir) ++ ++src = os.path.join(install_root, 'xsessions', 'gnome-classic.desktop') ++dst = os.path.join(dst_dir, 'gnome-classic.desktop') ++shutil.copyfile(src, dst) +-- +2.33.1 + diff --git a/gnome-shell-extensions.spec b/gnome-shell-extensions.spec index a80c540..407f422 100644 --- a/gnome-shell-extensions.spec +++ b/gnome-shell-extensions.spec @@ -7,13 +7,16 @@ Name: gnome-shell-extensions Version: 41.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Modify and extend GNOME Shell functionality and behavior License: GPLv2+ URL: http://wiki.gnome.org/Projects/GnomeShell/Extensions Source0: http://ftp.gnome.org/pub/GNOME/sources/%{name}/%{major_version}/%{name}-%{tarball_version}.tar.xz +# Adds Wayland session for GNOME Classic (#2015741) +Patch0001: gnome-classic-wayland.patch + BuildRequires: meson BuildRequires: git BuildRequires: gettext >= 0.19.6 @@ -201,6 +204,9 @@ workspaces. %{_datadir}/gnome-shell/theme/gnome-classic-high-contrast.css %{_datadir}/gnome-shell/theme/gnome-classic.css %{_datadir}/xsessions/gnome-classic.desktop +%{_datadir}/xsessions/gnome-classic-xorg.desktop +%{_datadir}/wayland-sessions/gnome-classic.desktop +%{_datadir}/wayland-sessions/gnome-classic-wayland.desktop %{_datadir}/glib-2.0/schemas/00_org.gnome.shell.extensions.classic.gschema.override %files -n %{pkg_prefix}-apps-menu @@ -253,6 +259,9 @@ workspaces. %changelog +* Fri Oct 29 2021 Neal Gompa - 41.0-2 +- Backport GNOME Classic session for Wayland (#2015741) + * Sun Sep 19 2021 Florian Müllner - 41.0-1 - Update to 41.0