all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / Atom feed
* [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support
@ 2021-09-13  7:35 Josselin Poiret
  2021-09-13  7:45 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret via Guix-patches via
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Josselin Poiret @ 2021-09-13  7:35 UTC (permalink / raw)
  To: 50563

Hi,

This patchset enables Wayland support for GDM: launching GDM itself on Wayland and launching Wayland sessions (the former requires the latter).
This is my first contribution, so do not hesitate to give any feedback (I also haven't setup `git send-email` yet so this is a manual mail).

1. Enables optional support for launching a Wayland GDM session.
2. Adds a wrapper for Wayland sessions in order to setup the environment, similar to the default `/etc/profile` or `xinitrc`.

Best,
Josselin Poiret




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM
  2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
@ 2021-09-13  7:45 ` Josselin Poiret via Guix-patches via
  2021-09-13  7:49 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret via Guix-patches via
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2021-09-13  7:45 UTC (permalink / raw)
  To: 50563

* Add the optional flag `wayland?` in `gdm-configuration` to launch GDM with
Wayland, enabling the use of Wayland sessions with GDM.

* Remove hardcoded Xwayland check in GDM.
* Add `XCURSOR_PATH` to GDM environment.
* Update the documentation.
---
 doc/guix.texi                                 | 33 ++++++++++++-------
 gnu/packages/gnome.scm                        |  3 +-
 .../gdm-remove-hardcoded-xwayland-path.patch  | 22 +++++++++++++
 gnu/services/xorg.scm                         | 14 +++++---
 4 files changed, 56 insertions(+), 16 deletions(-)
 create mode 100644 gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 220499503d..93ea4a321f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18043,19 +18043,26 @@ example the @code{windowmaker} or @code{openbox} packages---preferably
 by adding it to the @code{packages} field of your operating system
 definition (@pxref{operating-system Reference, system-wide packages}).

+@anchor{wayland-gdm}
+GDM also supports Wayland: it can itself use Wayland instead of X11 for
+its user interface, and it can also start Wayland sessions.  The former is
+required for the latter, to enable, set @code{wayland?} to @code{#t} in
+@code{gdm-configuration}.
+
 @defvr {Scheme Variable} gdm-service-type
 This is the type for the @uref{https://wiki.gnome.org/Projects/GDM/, GNOME
 Desktop Manager} (GDM), a program that manages graphical display servers and
 handles graphical user logins.  Its value must be a @code{gdm-configuration}
 (see below).

-@cindex session types (X11)
-@cindex X11 session types
+@cindex session types
 GDM looks for @dfn{session types} described by the @file{.desktop} files in
-@file{/run/current-system/profile/share/xsessions} and allows users to choose
-a session from the log-in screen.  Packages such as @code{gnome}, @code{xfce},
-and @code{i3} provide @file{.desktop} files; adding them to the system-wide
-set of packages automatically makes them available at the log-in screen.
+@file{/run/current-system/profile/share/xsessions} (for X11 sessions) and
+@file{/run/current-system/profile/share/wayland-sessions} (for Wayland
+sessions) and allows users to choose a session from the log-in screen.
+Packages such as @code{gnome}, @code{xfce}, @code{i3} and @code{sway} provide
+@file{.desktop} files; adding them to the system-wide set of packages
+automatically makes them available at the log-in screen.

 In addition, @file{~/.xsession} files are honored.  When available,
 @file{~/.xsession} must be an executable that starts a window manager
@@ -18088,6 +18095,9 @@ File name of the @code{dbus-daemon} executable.

 @item @code{gdm} (default: @code{gdm})
 The GDM package to use.
+
+@item @code{wayland?} (default: @code{#f})
+When true, enables Wayland in GDM, necessary to use Wayland sessions.
 @end table
 @end deftp

@@ -19310,11 +19320,12 @@ expected.

 The desktop environments in Guix use the Xorg display server by
 default.  If you'd like to use the newer display server protocol
-called Wayland, you need to use the @code{sddm-service} instead of
-GDM as the graphical login manager.  You should then
-select the ``GNOME (Wayland)'' session in SDDM@.  Alternatively you can
-also try starting GNOME on Wayland manually from a TTY with the
-command ``XDG_SESSION_TYPE=wayland exec dbus-run-session
+called Wayland, you need to enable Wayland support in GDM
+(@pxref{wayland-gdm}).  Another solution is to use the
+@code{sddm-service} instead of GDM as the graphical login manager.
+You should then select the ``GNOME (Wayland)'' session in SDDM@.
+Alternatively you can also try starting GNOME on Wayland manually from a
+TTY with the command ``XDG_SESSION_TYPE=wayland exec dbus-run-session
 gnome-session``.  Currently only GNOME has support for Wayland.

 @defvr {Scheme Variable} gnome-desktop-service-type
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 5a8bcdb8ce..2da0b3791f 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -8111,7 +8111,8 @@ library.")
               (sha256
                (base32
                 "1lyqvcwxhwxklbxn4xjswjzr6fhjix6h28mi9ypn34wdm9bzcpg8"))
-              (patches (search-patches "gdm-default-session.patch"))))
+              (patches (search-patches "gdm-default-session.patch"
+                                       "gdm-remove-hardcoded-xwayland-path.patch"))))
     (build-system glib-or-gtk-build-system)
     (arguments
      '(#:configure-flags
diff --git a/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch
new file mode 100644
index 0000000000..321a0e4b87
--- /dev/null
+++ b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch
@@ -0,0 +1,22 @@
+Remove check for hardcoded Xwayland path in gdm.
+
+---
+ daemon/gdm-local-display-factory.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
+index da1093bb..37355c06 100644
+--- a/daemon/gdm-local-display-factory.c
++++ b/daemon/gdm-local-display-factory.c
+@@ -203,7 +203,7 @@ gdm_local_display_factory_use_wayland (void)
+ #ifdef ENABLE_WAYLAND_SUPPORT
+         gboolean wayland_enabled = FALSE;
+         if (gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled)) {
+-                if (wayland_enabled && g_file_test ("/usr/bin/Xwayland", G_FILE_TEST_IS_EXECUTABLE) )
++                if (wayland_enabled)
+                         return TRUE;
+         }
+ #endif
+--
+2.33.0
+
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index d5c5316d3f..fe25168a58 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -883,7 +883,8 @@ the GNOME desktop environment.")
   (xorg-configuration gdm-configuration-xorg
                       (default (xorg-configuration)))
   (x-session gdm-configuration-x-session
-             (default (xinitrc))))
+             (default (xinitrc)))
+  (wayland? gdm-configuration-wayland? (default #f)))

 (define (gdm-configuration-file config)
   (mixed-text-file "gdm-custom.conf"
@@ -909,8 +910,9 @@ the GNOME desktop environment.")
                    ;; See also
                    ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39281>.
                    "InitialSetupEnable=false\n"
-                   ;; Enable me once X is working.
-                   "WaylandEnable=false\n"
+                   "WaylandEnable=" (if (gdm-configuration-wayland? config)
+                                        "true"
+                                        "false") "\n"
                    "\n"
                    "[debug]\n"
                    "Enable=" (if (gdm-configuration-debug? config)
@@ -976,7 +978,11 @@ the GNOME desktop environment.")
                                   ;; can depend on GNOME Shell directly.
                                   (cons #$gnome-shell
                                         '#$(gdm-configuration-gnome-shell-assets
-                                            config)))))))))
+                                            config)))))
+                           ;; Add XCURSOR_PATH so that mutter can find its cursors.
+                           ;; gdm doesn't login so doesn't source the corresponding
+                           ;; line in /etc/profile
+                           "XCURSOR_PATH=/run/current-system/profile/share/icons"))))
          (stop #~(make-kill-destructor))
          (respawn? #t))))

--
2.33.0






^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
  2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
  2021-09-13  7:45 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret via Guix-patches via
@ 2021-09-13  7:49 ` Josselin Poiret via Guix-patches via
  2021-09-13  8:13 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2021-09-13  7:49 UTC (permalink / raw)
  To: 50563

* Patch GDM to support launching a wrapper script for Wayland sessions.
* Add `wayland-session` in `gdm-configuration` to specify the wrapper to use.
* Add default wrapper that runs non-GDM sessions through a login shell (based
on the `xinitrc`).
* Update the documentation with those changes.
---
 doc/guix.texi                                 |  4 +++
 gnu/packages/gnome.scm                        |  3 +-
 ...gdm-wayland-session-wrapper-from-env.patch | 35 +++++++++++++++++++
 gnu/services/xorg.scm                         | 21 +++++++++--
 4 files changed, 60 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 93ea4a321f..3e6157c8ab 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18098,6 +18098,10 @@ The GDM package to use.

 @item @code{wayland?} (default: @code{#f})
 When true, enables Wayland in GDM, necessary to use Wayland sessions.
+
+@item @code{wayland-session} (default: @code{gdm-wayland-session-wrapper})
+The Wayland session wrapper to use, needed to setup the
+environment.
 @end table
 @end deftp

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 2da0b3791f..36d58e4c42 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -8112,7 +8112,8 @@ library.")
                (base32
                 "1lyqvcwxhwxklbxn4xjswjzr6fhjix6h28mi9ypn34wdm9bzcpg8"))
               (patches (search-patches "gdm-default-session.patch"
-                                       "gdm-remove-hardcoded-xwayland-path.patch"))))
+                                       "gdm-remove-hardcoded-xwayland-path.patch"
+                                       "gdm-wayland-session-wrapper-from-env.patch"))))
     (build-system glib-or-gtk-build-system)
     (arguments
      '(#:configure-flags
diff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
new file mode 100644
index 0000000000..ca1af557ef
--- /dev/null
+++ b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
@@ -0,0 +1,35 @@
+Get wayland-session wrapper from environment
+
+---
+ daemon/gdm-session.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
+index 4e303e70..1deca4e9 100644
+--- a/daemon/gdm-session.c
++++ b/daemon/gdm-session.c
+@@ -2888,8 +2888,9 @@ gdm_session_start_session (GdmSession *self,
+                                                            allow_remote_connections? "--allow-remote-connections " : "",
+                                                            command);
+                         } else {
+-                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
++                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"",
+                                                            register_session ? "--register-session " : "",
++                                                           g_getenv ("GDM_WAYLAND_SESSION"),
+                                                            command);
+                         }
+                 } else if (run_xsession_script) {
+@@ -2906,8 +2907,9 @@ gdm_session_start_session (GdmSession *self,
+                                                            register_session ? "--register-session " : "",
+                                                            self->selected_program);
+                         } else {
+-                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
++                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"",
+                                                            register_session ? "--register-session " : "",
++                                                           g_getenv ("GDM_WAYLAND_SESSION"),
+                                                            self->selected_program);
+                         }
+                 } else {
+--
+2.33.0
+
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index fe25168a58..a9b2a1a1c6 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -869,6 +869,19 @@ the GNOME desktop environment.")
        (apply execl (string-append #$dbus "/bin/dbus-daemon")
               (program-arguments)))))

+;; Wrapper script for Wayland sessions, similar to Xsession.
+;; Used to setup the environment.
+(define gdm-wayland-session-wrapper
+  (program-file
+   "gdm-wayland-session-wrapper"
+   #~((let* ((user (getpw (getuid)))
+	    (name (passwd:name user))
+	    (shell (passwd:shell user))
+	    (args (cdr (command-line))))
+        (if (string=? name "gdm")
+	    (apply execl (cons (car args) args))
+	    (execl shell shell "--login" "-c" (string-join args)))))))
+
 (define-record-type* <gdm-configuration>
   gdm-configuration make-gdm-configuration
   gdm-configuration?
@@ -884,7 +897,8 @@ the GNOME desktop environment.")
                       (default (xorg-configuration)))
   (x-session gdm-configuration-x-session
              (default (xinitrc)))
-  (wayland? gdm-configuration-wayland? (default #f)))
+  (wayland? gdm-configuration-wayland? (default #f))
+  (wayland-session gdm-configuration-wayland-session (default gdm-wayland-session-wrapper)))

 (define (gdm-configuration-file config)
   (mixed-text-file "gdm-custom.conf"
@@ -982,7 +996,10 @@ the GNOME desktop environment.")
                            ;; Add XCURSOR_PATH so that mutter can find its cursors.
                            ;; gdm doesn't login so doesn't source the corresponding
                            ;; line in /etc/profile
-                           "XCURSOR_PATH=/run/current-system/profile/share/icons"))))
+                           "XCURSOR_PATH=/run/current-system/profile/share/icons"
+                           (string-append
+                            "GDM_WAYLAND_SESSION="
+                            #$(gdm-configuration-wayland-session config))))))
          (stop #~(make-kill-destructor))
          (respawn? #t))))

--
2.33.0






^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM
  2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
  2021-09-13  7:45 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret via Guix-patches via
  2021-09-13  7:49 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret via Guix-patches via
@ 2021-09-13  8:13 ` Josselin Poiret
  2021-09-13  8:15 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Josselin Poiret @ 2021-09-13  8:13 UTC (permalink / raw)
  To: 50563

* Add the optional flag `wayland?` in `gdm-configuration` to launch GDM with
Wayland, enabling the use of Wayland sessions with GDM.

* Remove hardcoded Xwayland check in GDM.
* Add `XCURSOR_PATH` to GDM environment.
* Update the documentation.
---
 doc/guix.texi                                 | 33 ++++++++++++-------
 gnu/packages/gnome.scm                        |  3 +-
 .../gdm-remove-hardcoded-xwayland-path.patch  | 22 +++++++++++++
 gnu/services/xorg.scm                         | 14 +++++---
 4 files changed, 56 insertions(+), 16 deletions(-)
 create mode 100644 gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 220499503d..93ea4a321f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18043,19 +18043,26 @@ example the @code{windowmaker} or @code{openbox} packages---preferably
 by adding it to the @code{packages} field of your operating system
 definition (@pxref{operating-system Reference, system-wide packages}).

+@anchor{wayland-gdm}
+GDM also supports Wayland: it can itself use Wayland instead of X11 for
+its user interface, and it can also start Wayland sessions.  The former is
+required for the latter, to enable, set @code{wayland?} to @code{#t} in
+@code{gdm-configuration}.
+
 @defvr {Scheme Variable} gdm-service-type
 This is the type for the @uref{https://wiki.gnome.org/Projects/GDM/, GNOME
 Desktop Manager} (GDM), a program that manages graphical display servers and
 handles graphical user logins.  Its value must be a @code{gdm-configuration}
 (see below).

-@cindex session types (X11)
-@cindex X11 session types
+@cindex session types
 GDM looks for @dfn{session types} described by the @file{.desktop} files in
-@file{/run/current-system/profile/share/xsessions} and allows users to choose
-a session from the log-in screen.  Packages such as @code{gnome}, @code{xfce},
-and @code{i3} provide @file{.desktop} files; adding them to the system-wide
-set of packages automatically makes them available at the log-in screen.
+@file{/run/current-system/profile/share/xsessions} (for X11 sessions) and
+@file{/run/current-system/profile/share/wayland-sessions} (for Wayland
+sessions) and allows users to choose a session from the log-in screen.
+Packages such as @code{gnome}, @code{xfce}, @code{i3} and @code{sway} provide
+@file{.desktop} files; adding them to the system-wide set of packages
+automatically makes them available at the log-in screen.

 In addition, @file{~/.xsession} files are honored.  When available,
 @file{~/.xsession} must be an executable that starts a window manager
@@ -18088,6 +18095,9 @@ File name of the @code{dbus-daemon} executable.

 @item @code{gdm} (default: @code{gdm})
 The GDM package to use.
+
+@item @code{wayland?} (default: @code{#f})
+When true, enables Wayland in GDM, necessary to use Wayland sessions.
 @end table
 @end deftp

@@ -19310,11 +19320,12 @@ expected.

 The desktop environments in Guix use the Xorg display server by
 default.  If you'd like to use the newer display server protocol
-called Wayland, you need to use the @code{sddm-service} instead of
-GDM as the graphical login manager.  You should then
-select the ``GNOME (Wayland)'' session in SDDM@.  Alternatively you can
-also try starting GNOME on Wayland manually from a TTY with the
-command ``XDG_SESSION_TYPE=wayland exec dbus-run-session
+called Wayland, you need to enable Wayland support in GDM
+(@pxref{wayland-gdm}).  Another solution is to use the
+@code{sddm-service} instead of GDM as the graphical login manager.
+You should then select the ``GNOME (Wayland)'' session in SDDM@.
+Alternatively you can also try starting GNOME on Wayland manually from a
+TTY with the command ``XDG_SESSION_TYPE=wayland exec dbus-run-session
 gnome-session``.  Currently only GNOME has support for Wayland.

 @defvr {Scheme Variable} gnome-desktop-service-type
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 5a8bcdb8ce..2da0b3791f 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -8111,7 +8111,8 @@ library.")
               (sha256
                (base32
                 "1lyqvcwxhwxklbxn4xjswjzr6fhjix6h28mi9ypn34wdm9bzcpg8"))
-              (patches (search-patches "gdm-default-session.patch"))))
+              (patches (search-patches "gdm-default-session.patch"
+                                       "gdm-remove-hardcoded-xwayland-path.patch"))))
     (build-system glib-or-gtk-build-system)
     (arguments
      '(#:configure-flags
diff --git a/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch
new file mode 100644
index 0000000000..321a0e4b87
--- /dev/null
+++ b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch
@@ -0,0 +1,22 @@
+Remove check for hardcoded Xwayland path in gdm.
+
+---
+ daemon/gdm-local-display-factory.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
+index da1093bb..37355c06 100644
+--- a/daemon/gdm-local-display-factory.c
++++ b/daemon/gdm-local-display-factory.c
+@@ -203,7 +203,7 @@ gdm_local_display_factory_use_wayland (void)
+ #ifdef ENABLE_WAYLAND_SUPPORT
+         gboolean wayland_enabled = FALSE;
+         if (gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled)) {
+-                if (wayland_enabled && g_file_test ("/usr/bin/Xwayland", G_FILE_TEST_IS_EXECUTABLE) )
++                if (wayland_enabled)
+                         return TRUE;
+         }
+ #endif
+--
+2.33.0
+
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index d5c5316d3f..fe25168a58 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -883,7 +883,8 @@ the GNOME desktop environment.")
   (xorg-configuration gdm-configuration-xorg
                       (default (xorg-configuration)))
   (x-session gdm-configuration-x-session
-             (default (xinitrc))))
+             (default (xinitrc)))
+  (wayland? gdm-configuration-wayland? (default #f)))

 (define (gdm-configuration-file config)
   (mixed-text-file "gdm-custom.conf"
@@ -909,8 +910,9 @@ the GNOME desktop environment.")
                    ;; See also
                    ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39281>.
                    "InitialSetupEnable=false\n"
-                   ;; Enable me once X is working.
-                   "WaylandEnable=false\n"
+                   "WaylandEnable=" (if (gdm-configuration-wayland? config)
+                                        "true"
+                                        "false") "\n"
                    "\n"
                    "[debug]\n"
                    "Enable=" (if (gdm-configuration-debug? config)
@@ -976,7 +978,11 @@ the GNOME desktop environment.")
                                   ;; can depend on GNOME Shell directly.
                                   (cons #$gnome-shell
                                         '#$(gdm-configuration-gnome-shell-assets
-                                            config)))))))))
+                                            config)))))
+                           ;; Add XCURSOR_PATH so that mutter can find its cursors.
+                           ;; gdm doesn't login so doesn't source the corresponding
+                           ;; line in /etc/profile
+                           "XCURSOR_PATH=/run/current-system/profile/share/icons"))))
          (stop #~(make-kill-destructor))
          (respawn? #t))))

--
2.33.0






^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
  2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
                   ` (2 preceding siblings ...)
  2021-09-13  8:13 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret
@ 2021-09-13  8:15 ` Josselin Poiret
  2021-09-13 18:14   ` Maxime Devos
  2021-09-13 15:43 ` [bug#50563] (No Subject) Josselin Poiret via Guix-patches via
  2021-09-14 21:45 ` [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
  5 siblings, 1 reply; 10+ messages in thread
From: Josselin Poiret @ 2021-09-13  8:15 UTC (permalink / raw)
  To: 50563

* Patch GDM to support launching a wrapper script for Wayland sessions.
* Add `wayland-session` in `gdm-configuration` to specify the wrapper to use.
* Add default wrapper that runs non-GDM sessions through a login shell (based
on the `xinitrc`).
* Update the documentation with those changes.
---
 doc/guix.texi                                 |  4 +++
 gnu/packages/gnome.scm                        |  3 +-
 ...gdm-wayland-session-wrapper-from-env.patch | 35 +++++++++++++++++++
 gnu/services/xorg.scm                         | 21 +++++++++--
 4 files changed, 60 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 93ea4a321f..3e6157c8ab 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18098,6 +18098,10 @@ The GDM package to use.

 @item @code{wayland?} (default: @code{#f})
 When true, enables Wayland in GDM, necessary to use Wayland sessions.
+
+@item @code{wayland-session} (default: @code{gdm-wayland-session-wrapper})
+The Wayland session wrapper to use, needed to setup the
+environment.
 @end table
 @end deftp

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 2da0b3791f..36d58e4c42 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -8112,7 +8112,8 @@ library.")
                (base32
                 "1lyqvcwxhwxklbxn4xjswjzr6fhjix6h28mi9ypn34wdm9bzcpg8"))
               (patches (search-patches "gdm-default-session.patch"
-                                       "gdm-remove-hardcoded-xwayland-path.patch"))))
+                                       "gdm-remove-hardcoded-xwayland-path.patch"
+                                       "gdm-wayland-session-wrapper-from-env.patch"))))
     (build-system glib-or-gtk-build-system)
     (arguments
      '(#:configure-flags
diff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
new file mode 100644
index 0000000000..ca1af557ef
--- /dev/null
+++ b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
@@ -0,0 +1,35 @@
+Get wayland-session wrapper from environment
+
+---
+ daemon/gdm-session.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
+index 4e303e70..1deca4e9 100644
+--- a/daemon/gdm-session.c
++++ b/daemon/gdm-session.c
+@@ -2888,8 +2888,9 @@ gdm_session_start_session (GdmSession *self,
+                                                            allow_remote_connections? "--allow-remote-connections " : "",
+                                                            command);
+                         } else {
+-                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
++                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"",
+                                                            register_session ? "--register-session " : "",
++                                                           g_getenv ("GDM_WAYLAND_SESSION"),
+                                                            command);
+                         }
+                 } else if (run_xsession_script) {
+@@ -2906,8 +2907,9 @@ gdm_session_start_session (GdmSession *self,
+                                                            register_session ? "--register-session " : "",
+                                                            self->selected_program);
+                         } else {
+-                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
++                                program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"",
+                                                            register_session ? "--register-session " : "",
++                                                           g_getenv ("GDM_WAYLAND_SESSION"),
+                                                            self->selected_program);
+                         }
+                 } else {
+--
+2.33.0
+
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index fe25168a58..a9b2a1a1c6 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -869,6 +869,19 @@ the GNOME desktop environment.")
        (apply execl (string-append #$dbus "/bin/dbus-daemon")
               (program-arguments)))))

+;; Wrapper script for Wayland sessions, similar to Xsession.
+;; Used to setup the environment.
+(define gdm-wayland-session-wrapper
+  (program-file
+   "gdm-wayland-session-wrapper"
+   #~((let* ((user (getpw (getuid)))
+	    (name (passwd:name user))
+	    (shell (passwd:shell user))
+	    (args (cdr (command-line))))
+        (if (string=? name "gdm")
+	    (apply execl (cons (car args) args))
+	    (execl shell shell "--login" "-c" (string-join args)))))))
+
 (define-record-type* <gdm-configuration>
   gdm-configuration make-gdm-configuration
   gdm-configuration?
@@ -884,7 +897,8 @@ the GNOME desktop environment.")
                       (default (xorg-configuration)))
   (x-session gdm-configuration-x-session
              (default (xinitrc)))
-  (wayland? gdm-configuration-wayland? (default #f)))
+  (wayland? gdm-configuration-wayland? (default #f))
+  (wayland-session gdm-configuration-wayland-session (default gdm-wayland-session-wrapper)))

 (define (gdm-configuration-file config)
   (mixed-text-file "gdm-custom.conf"
@@ -982,7 +996,10 @@ the GNOME desktop environment.")
                            ;; Add XCURSOR_PATH so that mutter can find its cursors.
                            ;; gdm doesn't login so doesn't source the corresponding
                            ;; line in /etc/profile
-                           "XCURSOR_PATH=/run/current-system/profile/share/icons"))))
+                           "XCURSOR_PATH=/run/current-system/profile/share/icons"
+                           (string-append
+                            "GDM_WAYLAND_SESSION="
+                            #$(gdm-configuration-wayland-session config))))))
          (stop #~(make-kill-destructor))
          (respawn? #t))))

--
2.33.0






^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] (No Subject)
  2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
                   ` (3 preceding siblings ...)
  2021-09-13  8:15 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
@ 2021-09-13 15:43 ` Josselin Poiret via Guix-patches via
  2021-09-14  2:02   ` Jack Hill
  2021-09-14 21:45 ` [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
  5 siblings, 1 reply; 10+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2021-09-13 15:43 UTC (permalink / raw)
  To: 50563

My bad, I've confused my email addresses, so both patches were sent twice. Please disregard the duplicated mails.

On another note, I've only been testing with `sway` and don't really have the disk space right now to test Wayland GNOME itself, but I think it should work fine. Maybe someone else can pitch in on this.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
  2021-09-13  8:15 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
@ 2021-09-13 18:14   ` Maxime Devos
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Devos @ 2021-09-13 18:14 UTC (permalink / raw)
  To: Josselin Poiret, 50563

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

Josselin Poiret schreef op ma 13-09-2021 om 08:15 [+0000]:
> * Patch GDM to support launching a wrapper script for Wayland sessions.
> * Add `wayland-session` in `gdm-configuration` to specify the wrapper to use.
> * Add default wrapper that runs non-GDM sessions through a login shell (based
> on the `xinitrc`).
> * Update the documentation with those changes.
> ---
>  doc/guix.texi                                 |  4 +++
>  gnu/packages/gnome.scm                        |  3 +-
>  ...gdm-wayland-session-wrapper-from-env.patch | 35 +++++++++++++++++++
>  gnu/services/xorg.scm                         | 21 +++++++++--
>  4 files changed, 60 insertions(+), 3 deletions(-)
>  create mode 100644 gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 93ea4a321f..3e6157c8ab 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -18098,6 +18098,10 @@ The GDM package to use.
> 
>  @item @code{wayland?} (default: @code{#f})
>  When true, enables Wayland in GDM, necessary to use Wayland sessions.
> +
> +@item @code{wayland-session} (default: @code{gdm-wayland-session-wrapper})
> +The Wayland session wrapper to use, needed to setup the
> +environment.

‘needed to setup the environment’ --> this sounds like sometimes, the session
wrapper needs to be changed such that the environment variables are correct.
However, gdm-wayland-session-wrapper doesn't actually set any environment variables,
and the X equivalent 'xsession' doesn't need to be modified (at least on my system,
when I last used gdm), so I presume the default is quite reasonable for most users.

So to reduce confusion, I would drop the ‘needed to set up the environment’.

A ‘real-world’ example of a custom 'wayland-session' would be helpful to illustrate
matters.

Greetings,
Maxime

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] (No Subject)
  2021-09-13 15:43 ` [bug#50563] (No Subject) Josselin Poiret via Guix-patches via
@ 2021-09-14  2:02   ` Jack Hill
  0 siblings, 0 replies; 10+ messages in thread
From: Jack Hill @ 2021-09-14  2:02 UTC (permalink / raw)
  To: Josselin Poiret; +Cc: 50563

On Mon, 13 Sep 2021, Josselin Poiret via Guix-patches via wrote:

> On another note, I've only been testing with `sway` and don't really 
> have the disk space right now to test Wayland GNOME itself, but I think 
> it should work fine. Maybe someone else can pitch in on this.

I've tested launching a Wayland GNOME session on x86-64 and everything 
works as expected there. Thanks for the patches!

Best,
Jack




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
  2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
                   ` (4 preceding siblings ...)
  2021-09-13 15:43 ` [bug#50563] (No Subject) Josselin Poiret via Guix-patches via
@ 2021-09-14 21:45 ` Josselin Poiret
  2021-09-15  9:47   ` Maxime Devos
  5 siblings, 1 reply; 10+ messages in thread
From: Josselin Poiret @ 2021-09-14 21:45 UTC (permalink / raw)
  To: 50563

Maxime: I agree that this was a very confusing wording. Here is a reformulation that I hope clears up any misunderstanding.
PS: `gdm-wayland-session-wrapper` does in fact set environment variables, only that it indirectly uses `/etc/profile` to do so. Otherwise, the default profile wouldn't be active in the wayland session.

---
 doc/guix.texi | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3e6157c8ab..8a0eba16e1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18064,9 +18064,9 @@ Packages such as @code{gnome}, @code{xfce}, @code{i3} and @code{sway} provide
 @file{.desktop} files; adding them to the system-wide set of packages
 automatically makes them available at the log-in screen.

-In addition, @file{~/.xsession} files are honored.  When available,
-@file{~/.xsession} must be an executable that starts a window manager
-and/or other X clients.
+In addition, @file{~/.xsession} files are honored when launching X11 sessions.
+When available, @file{~/.xsession} must be an executable that starts a window
+manager and/or other X clients.
 @end defvr

 @deftp {Data Type} gdm-configuration
@@ -18100,8 +18100,8 @@ The GDM package to use.
 When true, enables Wayland in GDM, necessary to use Wayland sessions.

 @item @code{wayland-session} (default: @code{gdm-wayland-session-wrapper})
-The Wayland session wrapper to use, needed to setup the
-environment.
+The Wayland session wrapper to use, analogous to @code{xsession}. The default
+wrapper simply launches the session in a login shell.
 @end table
 @end deftp

--
2.33.0

Jack: Great news! I've been using it on my daily driver as well, without any problem so far.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
  2021-09-14 21:45 ` [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
@ 2021-09-15  9:47   ` Maxime Devos
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Devos @ 2021-09-15  9:47 UTC (permalink / raw)
  To: Josselin Poiret, 50563

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

Josselin Poiret schreef op di 14-09-2021 om 21:45 [+0000]:
> Maxime: I agree that this was a very confusing wording. Here is a reformulation that I hope clears up any misunderstanding.
> PS: `gdm-wayland-session-wrapper` does in fact set environment variables, only that it indirectly uses `/etc/profile` to do so. Otherwise, the default profile wouldn't be active in the wayland session.
> 
> [...]
> 
> -In addition, @file{~/.xsession} files are honored.  When available,
> -@file{~/.xsession} must be an executable that starts a window manager
> -and/or other X clients.
> +In addition, @file{~/.xsession} files are honored when launching X11 sessions.
> +When available, @file{~/.xsession} must be an executable that starts a window
> +manager and/or other X clients.
>  @end defvr
> 
>  @deftp {Data Type} gdm-configuration
> @@ -18100,8 +18100,8 @@ The GDM package to use.
>  When true, enables Wayland in GDM, necessary to use Wayland sessions.
> 
>  @item @code{wayland-session} (default: @code{gdm-wayland-session-wrapper})
> -The Wayland session wrapper to use, needed to setup the
> -environment.
> +The Wayland session wrapper to use, analogous to @code{xsession}. The default
> +wrapper simply launches the session in a login shell.
>  @end table
>  @end deftp

This is clear to me, thanks!

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-09-15  9:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  7:35 [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Josselin Poiret
2021-09-13  7:45 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret via Guix-patches via
2021-09-13  7:49 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret via Guix-patches via
2021-09-13  8:13 ` [bug#50563] [PATCH 1/2] gnu: Add Wayland support for GDM Josselin Poiret
2021-09-13  8:15 ` [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
2021-09-13 18:14   ` Maxime Devos
2021-09-13 15:43 ` [bug#50563] (No Subject) Josselin Poiret via Guix-patches via
2021-09-14  2:02   ` Jack Hill
2021-09-14 21:45 ` [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script Josselin Poiret
2021-09-15  9:47   ` Maxime Devos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.