[PATCH [0/2] gnu: GDM: Add Wayland support

DoneSubmitted by Josselin Poiret.
Details
5 participants
  • Josselin Poiret
  • Jack Hill
  • Josselin Poiret
  • Maxime Devos
  • Mathieu Othacehe
Owner
unassigned
Severity
normal
J
J
Josselin Poiret wrote on 13 Sep 09:35 +0200
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
KMN7RYYPktrwK2z_REQjG3bPRO8HX3qFBs6gAOCnqILPNK0S-Eepvof4K1nkZEa8BOS3zf2U_FaukNJeZfpxs2bec9lK7ZOxQMENe2pyVEU=@jpoiret.xyz
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
J
J
Josselin Poiret wrote on 13 Sep 10:13 +0200
[PATCH 1/2] gnu: Add Wayland support for GDM
(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
9gqXo6rQHM8BM_pHSQdjp5Rn0mQaztAGmA-Nf-_o79iMvKAkYbjRJi4lBj1VsUi3VCeWC6oRpQLPNsN6id9BcsVGtjgqzzHATCJNneF16JE=@jpoiret.xyz
* Add the optional flag `wayland?` in `gdm-configuration` to launch GDM withWayland, 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
Toggle diff (146 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 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-typediff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scmindex 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-flagsdiff --git a/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patchnew file mode 100644index 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.scmindex 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
J
J
Josselin Poiret wrote on 13 Sep 09:45 +0200
(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
Tvb8p1h-DUKsC_XBrgw326afKSNTg5QrkgHHyu-anDK2mlR3cLMJRettx3HsE1XNkuWEfBJMS9FXe0FZFReiZKPHht0b_7gSwocnuwR0yhA=@protonmail.ch
* Add the optional flag `wayland?` in `gdm-configuration` to launch GDM withWayland, 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
Toggle diff (146 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 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-typediff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scmindex 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-flagsdiff --git a/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patchnew file mode 100644index 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.scmindex 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
J
J
Josselin Poiret wrote on 13 Sep 09:49 +0200
[PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
bQhHFOBTpzX7JdfIBHNpzkQz3jxa_Yvewww_HhpsZT9S0T9JWX2ULCAbzsScMTbJHNLJ2vxaaRNGLDuLrDCZt3qOXU8-NARpIe6T5EO8G7o=@protonmail.ch
* 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 (basedon 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
Toggle diff (116 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 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.scmindex 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-flagsdiff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patchnew file mode 100644index 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.scmindex 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
J
J
Josselin Poiret wrote on 13 Sep 10:15 +0200
(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
_O63PhtCI8ZiwBgDZppLf6SqqIgEm3Y0iFYKUIsuLOeAM4yMfbqumjltWSuHKl8tfgUdL0yAC2TVR4nqKvLNJ18Rgs7iImwzPAztAEvIcmM=@jpoiret.xyz
* 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 (basedon 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
Toggle diff (116 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 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.scmindex 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-flagsdiff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patchnew file mode 100644index 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.scmindex 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
J
J
Josselin Poiret wrote on 13 Sep 17:43 +0200
(No Subject)
(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
gPZl70B_wLO7TYFkhx1kq5TKlinjrOHf2lHhtkP9DfjP3V_ipi2P2Ile_6teLLkjv_FYnw8YMUOQsv9eDbiNkoCSYfMEOB1n7U1TW6xnZh8=@protonmail.ch
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.
M
M
Maxime Devos wrote on 13 Sep 20:14 +0200
Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
d5a8394c827d1b115344703fb7fe7a8c9eeedd48.camel@telenet.be
Josselin Poiret schreef op ma 13-09-2021 om 08:15 [+0000]:
Toggle quote (26 lines)> * 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 sessionwrapper 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 illustratematters.
Greetings,Maxime
-----BEGIN PGP SIGNATURE-----
iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYT+VGxccbWF4aW1lZGV2b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vUrAP41wO5adtiLf9BExaViGMzViFVQfaROde9MmScFYevGBwD/QCNNAqKkLA8PHvmJXmWkNP4xnLKVvpwZNDDza16D9Ao==+4qJ-----END PGP SIGNATURE-----

J
J
Jack Hill wrote on 14 Sep 04:02 +0200
Re: [bug#50563] (No Subject)
(name . Josselin Poiret)(address . josselin.poiret@protonmail.ch)(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
alpine.DEB.2.21.2109132200360.4243@marsh.hcoop.net
On Mon, 13 Sep 2021, Josselin Poiret via Guix-patches via wrote:
Toggle quote (4 lines)> 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
J
J
Josselin Poiret wrote on 14 Sep 23:45 +0200
Re: Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
K0eT0ERo5Yl3ByH2Lo7fUVUq7NVpV36zL-KnQ440i6N0XafiijFod-id3xUnSo7MBO1Md8XCpciPCyfwpyslhFiwg3ZdMicD6VTntddRt4o=@jpoiret.xyz
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(-)
Toggle diff (28 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 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.
M
M
Maxime Devos wrote on 15 Sep 11:47 +0200
Re: [bug#50563] Re: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script.
55b6e182fadac783a11f40e8752d6b126f6a04ca.camel@telenet.be
Josselin Poiret schreef op di 14-09-2021 om 21:45 [+0000]:
Toggle quote (25 lines)> 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.
-----BEGIN PGP SIGNATURE-----
iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYUHBTxccbWF4aW1lZGV2b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ndDAP4kWV3gutHhtNHmGGFl1iLKTy04Emm7TCvM92b73kzhCgEA0WRqCHFukP59vFaZtaIG/x234N4+Vz5XkJs5NyQSHQo==tWDQ-----END PGP SIGNATURE-----

M
M
Mathieu Othacehe wrote on 29 Sep 13:20 +0200
Re: bug#50563: [PATCH [0/2] gnu: GDM: Add Wayland support
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(address . 50563@debbugs.gnu.org)
87tui31vc5.fsf@gnu.org
Hello Josselin,
Toggle quote (3 lines)> 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).
Thanks for this first contribution! I was able to apply the patches justfine. However, it would nice if you could write commit messagesrespecting the ChangeLog format as explained here:https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html.
Toggle quote (4 lines)> 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`.
I tried to apply both patches on top of the wip-gnome40 branch to see ifI can get Wayland support. There are minor merge conflicts that aresolved on the wip-gnome40-wayland branch.
I then edited the desktop.tmpl file this way:
Toggle snippet (26 lines)--- a/gnu/system/examples/desktop.tmpl+++ b/gnu/system/examples/desktop.tmpl@@ -64,12 +64,15 @@ ;; by clicking the gear. Use the "desktop" services, which ;; include the X11 log-in service, networking with ;; NetworkManager, and more.- (services (append (list (service gnome-desktop-service-type)- (service xfce-desktop-service-type)- (set-xorg-configuration- (xorg-configuration- (keyboard-layout keyboard-layout))))- %desktop-services))+ (services (modify-services+ (append (list (service gnome-desktop-service-type)+ (set-xorg-configuration+ (xorg-configuration+ (keyboard-layout keyboard-layout))))+ %desktop-services)+ (gdm-service-type config =>+ (gdm-configuration+ (wayland? #t))))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss))
And tested it by running:
Toggle snippet (4 lines)$(./pre-inst-env guix system vm gnu/system/examples/desktop.tmpl--no-grafts --no-offload -v3 -K) -m 2048
Looks like there's a good old xorg-server running, plus the "About"section in GNOME configuration reports that it is running using the X11window system.
Anything wrong with my integration?
Thanks,
Mathieu
M
M
Mathieu Othacehe wrote on 29 Sep 14:10 +0200
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(address . 50563@debbugs.gnu.org)
87r1d71t0t.fsf_-_@gnu.org
Toggle quote (2 lines)> Anything wrong with my integration?
I notied that mutter was complaining that the /tmp/.X11-unix file wasmissing the sticky bit when launching the xorg-xwayland binary.
The following patch fixes it for me:
Toggle diff (16 lines)diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scmindex 64d0e85301..612d548eea 100644--- a/gnu/services/desktop.scm+++ b/gnu/services/desktop.scm@@ -1021,7 +1021,7 @@ rules." (use-modules (guix build utils)) (let ((directory "/tmp/.X11-unix")) (mkdir-p directory)- (chmod directory #o777))))))+ (chmod directory #o1777))))))
What do you think about it?
Thanks,
Mathieu
J
J
Josselin Poiret wrote on 30 Sep 00:10 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 50563@debbugs.gnu.org)
HIzTzQ5Tl4XyXt9wJGVJF-BSMBwv65YOpVv15hYJ-jfB19p6sa_EkB2uee6jytt14DvAEtQAaVWUC-j6HGpiPr5vn6LMGEQqz4eY1eUJrjk=@jpoiret.xyz
On Wednesday, September 29th, 2021 at 12:10 PM, Mathieu Othacehe <othacehe@gnu.org> wrote:
Toggle quote (6 lines)> > Anything wrong with my integration?> I notied that mutter was complaining that the /tmp/.X11-unix file was> missing the sticky bit when launching the xorg-xwayland binary.> The following patch fixes it for me:> [snip]> What do you think about it?
Nice find, looks like this is the perfect fix (maybe this check was introduced in a new `gnome-shell` version).Thanks for your review and testing!I tried messing around and everything looked like it was working as it should, with GNOME Settings reporting it was running under Wayland.
As for the ChangeLog style, I'm sorry about it. If I'm reading correctly, I missed adding which files and symbols were changed, am I right?
M
M
Mathieu Othacehe wrote on 30 Sep 11:41 +0200
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(address . 50563@debbugs.gnu.org)
87wnmyv1rt.fsf@gnu.org
Hello,
Toggle quote (3 lines)> Nice find, looks like this is the perfect fix (maybe this check was> introduced in a new `gnome-shell` version).
Thanks I'll probably write a proper patch then.
Toggle quote (4 lines)> As for the ChangeLog style, I'm sorry about it. If I'm reading> correctly, I missed adding which files and symbols were changed, am I> right?
Yeah, that was more for future contributions, I'll get this one fixedwhen applying.
Now, I also tried to run Sway (by adding it to the operating-systempackages list). It is proposed in the GDM selection box at login whichis nice, however all I get is a black screen with a frozen mousepointer after that.
There's a bunch of errors in /var/log/messages and/var/log/gdm/greeter.log but I'm not sure if some are relevant here.
Mathieu
J
J
Josselin Poiret wrote on 30 Sep 16:27 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 50563@debbugs.gnu.org)
rDOJFqJ5_60mvkB95ICqMEtzMCZiRL_MP2OjTdtnoRFK417Uo2TETOuNZPiQDaBdhXE1BRojqGsw5FQx3jb3SkxgSPmnucrf3Lj81edDf5Q=@jpoiret.xyz
On Thursday, September 30th, 2021 at 9:41 AM, Mathieu Othacehe <othacehe@gnu.org> wrote:
Toggle quote (7 lines)> Now, I also tried to run Sway (by adding it to the operating-system> packages list). It is proposed in the GDM selection box at login which> is nice, however all I get is a black screen with a frozen mouse> pointer after that.> There's a bunch of errors in /var/log/messages and> /var/log/gdm/greeter.log but I'm not sure if some are relevant here.
After looking around, this is because in the `wip-gnome40-wayland` branch the `sway` package has been upgraded to 1.6, introducing a regression with the bochs-drm driver that is used in qemu by default.If you start qemu with `-vga virtio`, sway starts as usual.This was reported upstream at https://github.com/swaywm/sway/issues/6244
M
M
Mathieu Othacehe wrote on 1 Oct 09:33 +0200
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(address . 50563@debbugs.gnu.org)
87a6jtqjvv.fsf@gnu.org
Hey,
Toggle quote (6 lines)> After looking around, this is because in the `wip-gnome40-wayland` branch the> `sway` package has been upgraded to 1.6, introducing a regression with the> bochs-drm driver that is used in qemu by default.> If you start qemu with `-vga virtio`, sway starts as usual.> This was reported upstream at https://github.com/swaywm/sway/issues/6244
Oh, good catch! Running the following command works flawlessly indeed:
Toggle snippet (3 lines)$(./pre-inst-env guix system vm gnu/system/examples/desktop.tmpl --no-grafts --no-offload -v3 -K) -m 4096 -vga virtio
Thanks,
Mathieu
M
M
Mathieu Othacehe wrote on 1 Oct 09:37 +0200
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
875yuhqjp0.fsf_-_@gnu.org
Hello,
Toggle quote (13 lines)> +;; 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)))))))
I'm not sure to get perfectly the role of this wrapper, could youplease clarify it?
It looks like nix is dealing differently with the session starting,without using a dedicated script:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/desktops/gnome/core/gdm/fix-paths.patch
Thanks,
Mathieu
J
J
Josselin Poiret wrote on 1 Oct 10:56 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
EFDLsErTowu_-9L8iNXNX3bzVoRTnELojRmKLBDBqcmdhL7tkFRzAl3-LwouNx3NZ_25dvE_KphxphCb00bixPmDQcytM1ApbkgCR7R2rPE=@jpoiret.xyz
Hello,
On Friday, October 1st, 2021 at 9:37 AM, Mathieu Othacehe <othacehe@gnu.org> wrote:
Toggle quote (3 lines)> I'm not sure to get perfectly the role of this wrapper, could you> please clarify it?
Simply put, when display managers (on Guix) start an X session, they are all configured to use a generic Guix-specific wrapper script, a `xinitrc`.This feature predates Guix of course, and is supported by all display managers afaik. `xinitrc` is defined in `gnu/services/xorg.scm` and is the generic Guix wrapper.Notice that most importantly, it runs the window manager inside a login shell, which thus inherits the right environment variables that are set by default in `/etc/profile` (unless of course `/etc/profile` isn't sourced by the login shell, but then the user is on his own).
So we would like to do the same with Wayland, however since Wayland compositors are just single programs that need to be launched, most display managers used to simply start the compositors without doing anything else. This is still the behaviour of GDM, whereas for example SDDM or Slim (at least in Guix) already support wrapping those in some scripts. Here, I just define a generic script that launches sessions inside a login shell, akin to the default `xinitrc`. The check for the `gdm` user is that the GDM graphical display is launched through... GDM itself, and thus is handled like the other Wayland sessions; but since the `gdm` user doesn't have a login shell, this wouldn't work.
Toggle quote (4 lines)> It looks like nix is dealing differently with the session starting,> without using a dedicated script:> https://github.com/NixOS/nixpkgs/blob/master/pkgs/desktops/gnome/core/gdm/fix-paths.patch
From my understanding of https://github.com/NixOS/nixpkgs/issues/109546,they're still trying to deal with this generic issue (ie. they haven't patched in wrapper support in GDM).See https://github.com/NixOS/nixpkgs/issues/109542for an example of a bug that stems from it.
Josselin
M
M
Mathieu Othacehe wrote on 1 Oct 11:16 +0200
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
87v92hp0kb.fsf@gnu.org
Toggle quote (5 lines)> the default `xinitrc`. The check for the `gdm` user is that the GDM graphical> display is launched through... GDM itself, and thus is handled like the other> Wayland sessions; but since the `gdm` user doesn't have a login shell, this> wouldn't work.
I see that for explaining! This would deserve a comment I think, couldyou please send a v2 for the second patch?
That's unrelated, but what's your take on enabling wayland by default onGDM, like some other distributions? Just ran a quick search and it lookslike it could be problematic for Nvidia users.
Thanks,
Mathieu
J
J
Josselin Poiret wrote on 2 Oct 18:51 +0200
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . 50563@debbugs.gnu.org)(address . 50563@debbugs.gnu.org)
dOdQ9VarjnqorXfOtKz_0I8J34K70GFG-GUHkjAFPosZDyqQfRsAFGE8PDDXhTj1X620LZ38aHqIlJJukmmC74BJfXHUGNyklOhRHw2TSMs=@jpoiret.xyz
On Friday, October 1st, 2021 at 9:16 AM, Mathieu Othacehe <othacehe@gnu.org> wrote:
Toggle quote (3 lines)> I see that for explaining! This would deserve a comment I think, could> you please send a v2 for the second patch?
* gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch: Patch GDM to support launching a wrapper script for Wayland sessions.* gnu/services/xorg.scm (gdm-configuration): Add `wayland-session` in `gdm-configuration` tospecify the wrapper to use.* gnu/services/xorg.scm (gdm-wayland-session-wrapper): Add default wrapper that runs non-GDM sessions through a login shell (basedon the `xinitrc`).* doc/guix.texi: 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 | 25 +++++++++++-- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
Toggle diff (120 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 9e80a2c397..21c1fc04e1 100644--- a/doc/guix.texi+++ b/doc/guix.texi@@ -18201,6 +18201,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.scmindex f155867dfc..ca4d00917d 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-flagsdiff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patchnew file mode 100644index 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.scmindex fe25168a58..122dd14ae2 100644--- a/gnu/services/xorg.scm+++ b/gnu/services/xorg.scm@@ -869,6 +869,23 @@ the GNOME desktop environment.") (apply execl (string-append #$dbus "/bin/dbus-daemon") (program-arguments)))))
+;; Wrapper script for Wayland sessions, similar to Xsession. See `xinitrc`.+;; By default, launches the specified session through a login shell.+;; With default Guix configuration, this should source /etc/profile,+;; setting up Guix profile environment variables.+;; However, gdm launches its own graphical session through the same method, so+;; we need to ignore this case, since `gdm` doesn't have a login shell.+(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 +901,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 +1000,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
Toggle quote (4 lines)> That's unrelated, but what's your take on enabling wayland by default on> GDM, like some other distributions? Just ran a quick search and it looks> like it could be problematic for Nvidia users.
I'd be mostly in favor of it, as this makes the experience smoother when trying to use a Wayland compositor "out-of-the-box" (sway and such are getting quite popular).For Nvidia users, they mostly are aware of the driver shortcomings (and it seems that the incompatibility will soon disappear anyway),maybe a short heads-up in the documentation would suffice.
Thanks again for the review,Josselin
M
M
Mathieu Othacehe wrote on 2 Oct 19:29 +0200
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(address . 50563-done@debbugs.gnu.org)
875yufwd17.fsf@gnu.org
Hey,
Thanks for the v2, I applied it on the core-updates-frozen branchbecause that's where it tested it. It should soon be merged in themaster branch.
I edited the patches to add your copyrights on top of the editedfiles. I also wrapped a few lines and edited the commit messages.
Toggle quote (11 lines)>> That's unrelated, but what's your take on enabling wayland by default on>> GDM, like some other distributions? Just ran a quick search and it looks>> like it could be problematic for Nvidia users.>> I'd be mostly in favor of it, as this makes the experience smoother> when trying to use a Wayland compositor "out-of-the-box" (sway and> such are getting quite popular). For Nvidia users, they mostly are> aware of the driver shortcomings (and it seems that the> incompatibility will soon disappear anyway), maybe a short heads-up in> the documentation would suffice.
OK so we are on the same page. Do you think you could send a patchenabling Wayland by default for GDM and the associated documentationupdate :)?
Thanks for your work on that topic,
Mathieu
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 50563@debbugs.gnu.org