Blame SOURCES/gnome-classic-wayland.patch

c771b0
From 1692d4a91d95fecd5642b0c92bc2c5b0dbcb4184 Mon Sep 17 00:00:00 2001
b19d38
From: Neal Gompa <ngompa@fedoraproject.org>
b19d38
Date: Fri, 29 Oct 2021 09:37:33 -0400
c771b0
Subject: [PATCH] classic: Install the session for Wayland and ship override
c771b0
 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
c771b0
index 00000000..7287c689
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
c771b0
index 00000000..5fb338a1
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
c771b0
index 27f42872..47fe798e 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
c771b0
index dda3ddac..ea8a859d 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]
c771b0
@@ -90,6 +91,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
c771b0
index 00000000..36abe5e4
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