Blame SOURCES/gnome-classic-wayland.patch

b19d38
From a79d2afb2d6119ae3a4d1eba020d6c35b3fece23 Mon Sep 17 00:00:00 2001
b19d38
From: Neal Gompa <ngompa@fedoraproject.org>
b19d38
Date: Fri, 29 Oct 2021 09:33:06 -0400
b19d38
Subject: [PATCH 1/2] classic: Add X-GNOME-SessionRegisters
b19d38
b19d38
GDM has supported sessions registering with it for a few years now so
b19d38
it can know when to shut down the greeter. Having the GNOME Classic
b19d38
session declare that it will register itself allows GDM to avoid
b19d38
executing a fallback codepath.
b19d38
b19d38
This has been supported with the regular GNOME session for a while,
b19d38
and this session was likely forgotten about when it was added there.
b19d38
b19d38
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/195>
b19d38
---
b19d38
 data/gnome-classic.desktop.in | 1 +
b19d38
 1 file changed, 1 insertion(+)
b19d38
b19d38
diff --git a/data/gnome-classic.desktop.in b/data/gnome-classic.desktop.in
b19d38
index 5df6821..13da2b5 100644
b19d38
--- a/data/gnome-classic.desktop.in
b19d38
+++ b/data/gnome-classic.desktop.in
b19d38
@@ -5,3 +5,4 @@ Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session
b19d38
 TryExec=gnome-session
b19d38
 Type=Application
b19d38
 DesktopNames=GNOME-Classic;GNOME;
b19d38
+X-GDM-SessionRegisters=true
b19d38
-- 
b19d38
2.33.1
b19d38
b19d38
b19d38
From eb517c851777067087c3bf067c2baf10dcaf4128 Mon Sep 17 00:00:00 2001
b19d38
From: Neal Gompa <ngompa@fedoraproject.org>
b19d38
Date: Fri, 29 Oct 2021 09:37:33 -0400
b19d38
Subject: [PATCH 2/2] classic: Install the session for Wayland and ship
b19d38
 override sessions
b19d38
b19d38
The regular GNOME session ships with three options:
b19d38
b19d38
* GNOME
b19d38
* GNOME on Wayland (available when GDM starts in X11)
b19d38
* GNOME on Xorg (available when GDM starts in Wayland)
b19d38
b19d38
The main GNOME session is set up so it works to match how GDM starts,
b19d38
so GNOME is on Wayland if GDM is (or GNOME is on X11 if GDM is).
b19d38
b19d38
For GNOME Classic, we are missing this setup, so port this behavior
b19d38
over from the GNOME session setup.
b19d38
b19d38
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/195>
b19d38
---
b19d38
 data/gnome-classic-wayland.desktop.in |  8 ++++++
b19d38
 data/gnome-classic-xorg.desktop.in    |  8 ++++++
b19d38
 data/meson.build                      | 40 +++++++++++++++++++++------
b19d38
 meson.build                           |  5 ++++
b19d38
 meson/session-post-install.py         | 20 ++++++++++++++
b19d38
 5 files changed, 72 insertions(+), 9 deletions(-)
b19d38
 create mode 100644 data/gnome-classic-wayland.desktop.in
b19d38
 create mode 100644 data/gnome-classic-xorg.desktop.in
b19d38
 create mode 100755 meson/session-post-install.py
b19d38
b19d38
diff --git a/data/gnome-classic-wayland.desktop.in b/data/gnome-classic-wayland.desktop.in
b19d38
new file mode 100644
b19d38
index 0000000..7287c68
b19d38
--- /dev/null
b19d38
+++ b/data/gnome-classic-wayland.desktop.in
b19d38
@@ -0,0 +1,8 @@
b19d38
+[Desktop Entry]
b19d38
+Name=GNOME Classic on Wayland
b19d38
+Comment=This session logs you into GNOME Classic
b19d38
+Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session
b19d38
+TryExec=gnome-session
b19d38
+Type=Application
b19d38
+DesktopNames=GNOME-Classic;GNOME;
b19d38
+X-GDM-SessionRegisters=true
b19d38
diff --git a/data/gnome-classic-xorg.desktop.in b/data/gnome-classic-xorg.desktop.in
b19d38
new file mode 100644
b19d38
index 0000000..5fb338a
b19d38
--- /dev/null
b19d38
+++ b/data/gnome-classic-xorg.desktop.in
b19d38
@@ -0,0 +1,8 @@
b19d38
+[Desktop Entry]
b19d38
+Name=GNOME Classic on Xorg
b19d38
+Comment=This session logs you into GNOME Classic
b19d38
+Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session
b19d38
+TryExec=gnome-session
b19d38
+Type=Application
b19d38
+DesktopNames=GNOME-Classic;GNOME;
b19d38
+X-GDM-SessionRegisters=true
b19d38
diff --git a/data/meson.build b/data/meson.build
b19d38
index 27f4287..47fe798 100644
b19d38
--- a/data/meson.build
b19d38
+++ b/data/meson.build
b19d38
@@ -1,12 +1,34 @@
b19d38
-session_desktop = 'gnome-classic.desktop'
b19d38
-i18n.merge_file('',
b19d38
-  input:  session_desktop + '.in',
b19d38
-  output: session_desktop,
b19d38
-  po_dir: '../po',
b19d38
-  install: true,
b19d38
-  install_dir: xsessiondir,
b19d38
-  type: 'desktop'
b19d38
-)
b19d38
+session_desktop_base = 'gnome-classic'
b19d38
+
b19d38
+session_desktops = [
b19d38
+  session_desktop_base,
b19d38
+  session_desktop_base + '-xorg',
b19d38
+  session_desktop_base + '-wayland',
b19d38
+]
b19d38
+
b19d38
+foreach name: session_desktops
b19d38
+    session_desktop = name + '.desktop'
b19d38
+    if name.endswith('-xorg')
b19d38
+        session_instdir = xsessiondir
b19d38
+    elif name.endswith('-wayland')
b19d38
+        session_instdir = wlsessiondir
b19d38
+    else
b19d38
+        # FIXME: The same target can not be copied into two directories.
b19d38
+        #        There is a workaround in meson/session-post-install.py until proper
b19d38
+        #        solution arises:
b19d38
+        #        https://github.com/mesonbuild/meson/issues/2416
b19d38
+        session_instdir = xsessiondir
b19d38
+        #session_instdir = [ xesssiondir, wlsessiondir ]
b19d38
+    endif
b19d38
+    i18n.merge_file('',
b19d38
+      input:  session_desktop + '.in',
b19d38
+      output: session_desktop,
b19d38
+      po_dir: '../po',
b19d38
+      install: true,
b19d38
+      install_dir: session_instdir,
b19d38
+      type: 'desktop'
b19d38
+    )
b19d38
+endforeach
b19d38
 
b19d38
 classic_uuids = []
b19d38
 foreach e : classic_extensions
b19d38
diff --git a/meson.build b/meson.build
b19d38
index 8f2afda..33006b3 100644
b19d38
--- a/meson.build
b19d38
+++ b/meson.build
b19d38
@@ -20,6 +20,7 @@ themedir = join_paths(shelldir, 'theme')
b19d38
 schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
b19d38
 sessiondir = join_paths(datadir, 'gnome-session', 'sessions')
b19d38
 xsessiondir = join_paths(datadir, 'xsessions')
b19d38
+wlsessiondir = join_paths(datadir, 'wayland-sessions')
b19d38
 
b19d38
 ver_arr = meson.project_version().split('.')
b19d38
 shell_version = ver_arr[0]
b19d38
@@ -83,6 +84,10 @@ endforeach
b19d38
 
b19d38
 if classic_mode_enabled
b19d38
   subdir('data')
b19d38
+  meson.add_install_script(
b19d38
+    'meson/session-post-install.py',
b19d38
+    join_paths(get_option('prefix'), datadir)
b19d38
+  )
b19d38
 endif
b19d38
 
b19d38
 subdir('extensions')
b19d38
diff --git a/meson/session-post-install.py b/meson/session-post-install.py
b19d38
new file mode 100755
b19d38
index 0000000..36abe5e
b19d38
--- /dev/null
b19d38
+++ b/meson/session-post-install.py
b19d38
@@ -0,0 +1,20 @@
b19d38
+#!/usr/bin/env python3
b19d38
+
b19d38
+import os
b19d38
+import shutil
b19d38
+import sys
b19d38
+
b19d38
+if os.environ.get('DESTDIR'):
b19d38
+  install_root = os.environ.get('DESTDIR') + os.path.abspath(sys.argv[1])
b19d38
+else:
b19d38
+  install_root = sys.argv[1]
b19d38
+
b19d38
+# FIXME: Meson is unable to copy a generated target file:
b19d38
+#        https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
b19d38
+dst_dir = os.path.join(install_root, 'wayland-sessions')
b19d38
+if not os.path.exists(dst_dir):
b19d38
+  os.makedirs(dst_dir)
b19d38
+
b19d38
+src = os.path.join(install_root, 'xsessions', 'gnome-classic.desktop')
b19d38
+dst = os.path.join(dst_dir, 'gnome-classic.desktop')
b19d38
+shutil.copyfile(src, dst)
b19d38
-- 
b19d38
2.33.1
b19d38