From patchwork Sat Oct 2 16:51:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 33580 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E4F327BBE3; Sat, 2 Oct 2021 17:52:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8C53127BBE1 for ; Sat, 2 Oct 2021 17:52:12 +0100 (BST) Received: from localhost ([::1]:53938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWiF9-0008ET-Iy for patchwork@mira.cbaines.net; Sat, 02 Oct 2021 12:52:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWiF0-0008Au-2B for guix-patches@gnu.org; Sat, 02 Oct 2021 12:52:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWiEz-0005zd-QV for guix-patches@gnu.org; Sat, 02 Oct 2021 12:52:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWiEz-0000Fj-Ma for guix-patches@gnu.org; Sat, 02 Oct 2021 12:52:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50563] [PATCH [0/2] gnu: GDM: Add Wayland support Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 Oct 2021 16:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50563 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: "50563@debbugs.gnu.org" <50563@debbugs.gnu.org> Received: via spool by 50563-submit@debbugs.gnu.org id=B50563.1633193507948 (code B ref 50563); Sat, 02 Oct 2021 16:52:01 +0000 Received: (at 50563) by debbugs.gnu.org; 2 Oct 2021 16:51:47 +0000 Received: from localhost ([127.0.0.1]:60465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWiEl-0000FD-67 for submit@debbugs.gnu.org; Sat, 02 Oct 2021 12:51:47 -0400 Received: from mail-4323.protonmail.ch ([185.70.43.23]:63927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWiEi-0000Ew-0Z for 50563@debbugs.gnu.org; Sat, 02 Oct 2021 12:51:46 -0400 Date: Sat, 02 Oct 2021 16:51:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=protonmail2; t=1633193497; bh=MAOIO24EZN8y+KDnBl+rq1k6XQ5M/2LeaEy3IHlOUTo=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=lOpPMc6W17xBdW/B0VrMLvx+CSSMm8BGbsBtLZf5B1/Voteps5ShprFXlEA5AWaeF PjWFrYp8L5xx6Fjzaoihu5HHx28T+ifZ5jeElb+9YtCV9X9Pjt/UQIDczl8zptNfkK M8M6NX1wvJeTMX7kiFqRP13jvobd/EzH2IvbwNne1UbA4zoA+WEcOYusaVFkoLz8cq uFcOdCU1rj+zTkjLaviPPIuzqWnIHj/mzprUW91zZzh1XdC/yBDE1vkdHZz1Vy02WG pUYgtTbft6avmmMeSFEkHgEFDdjQynYVnT6gRvU68egAwy09tvvEKQYqq9Hv4a+2ca RqzhVPB08VMJA== From: Josselin Poiret Message-ID: In-Reply-To: <87v92hp0kb.fsf@gnu.org> References: <_O63PhtCI8ZiwBgDZppLf6SqqIgEm3Y0iFYKUIsuLOeAM4yMfbqumjltWSuHKl8tfgUdL0yAC2TVR4nqKvLNJ18Rgs7iImwzPAztAEvIcmM=@jpoiret.xyz> <875yuhqjp0.fsf_-_@gnu.org> <87v92hp0kb.fsf@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Josselin Poiret Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches On Friday, October 1st, 2021 at 9:16 AM, Mathieu Othacehe wrote: > 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` to specify the wrapper to use. * gnu/services/xorg.scm (gdm-wayland-session-wrapper): Add default wrapper that runs non-GDM sessions through a login shell (based on 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 -- 2.33.0 > 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 diff --git a/doc/guix.texi b/doc/guix.texi index 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.scm index 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-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..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 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))))