guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: gdm: Add Wayland session wrapper script.


From: guix-commits
Subject: 02/02: gnu: gdm: Add Wayland session wrapper script.
Date: Wed, 29 Sep 2021 07:20:55 -0400 (EDT)

mothacehe pushed a commit to branch wip-gnome40-wayland
in repository guix.

commit d507d9c2c96b1cbbac0fae1a8a113b7b038ada25
Author: Josselin Poiret <dev@jpoiret.xyz>
AuthorDate: Mon Sep 13 08:15:19 2021 +0000

    gnu: gdm: Add Wayland session wrapper script.
    
    * 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.
    
    Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
 doc/guix.texi                                      |  4 +++
 .../gdm-wayland-session-wrapper-from-env.patch     | 35 ++++++++++++++++++++++
 gnu/services/xorg.scm                              | 21 +++++++++++--
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 16f39cb..a9b13c0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18308,6 +18308,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/patches/gdm-wayland-session-wrapper-from-env.patch 
b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
new file mode 100644
index 0000000..2b95aad
--- /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 fe25168..a9b2a1a 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))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]