From patchwork Mon Sep 13 08:15:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 32818 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 5EA8727BBE3; Mon, 13 Sep 2021 16:15:03 +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 C6D0827BBE1 for ; Mon, 13 Sep 2021 16:15:02 +0100 (BST) Received: from localhost ([::1]:32870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPnfh-0003Ds-Ox for patchwork@mira.cbaines.net; Mon, 13 Sep 2021 11:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPnek-0002oM-Tm for guix-patches@gnu.org; Mon, 13 Sep 2021 11:14:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPnek-0000RG-LT for guix-patches@gnu.org; Mon, 13 Sep 2021 11:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPnek-0001N3-Ee for guix-patches@gnu.org; Mon, 13 Sep 2021 11:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50563] [PATCH 2/2] gnu: gdm: Add Wayland session wrapper script. References: In-Reply-To: Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Sep 2021 15:14:02 +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: "50563@debbugs.gnu.org" <50563@debbugs.gnu.org> Received: via spool by 50563-submit@debbugs.gnu.org id=B50563.16315459885170 (code B ref 50563); Mon, 13 Sep 2021 15:14:02 +0000 Received: (at 50563) by debbugs.gnu.org; 13 Sep 2021 15:13:08 +0000 Received: from localhost ([127.0.0.1]:46612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPndr-0001LF-Gh for submit@debbugs.gnu.org; Mon, 13 Sep 2021 11:13:08 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:23174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPh7f-0003lr-CO for 50563@debbugs.gnu.org; Mon, 13 Sep 2021 04:15:28 -0400 Date: Mon, 13 Sep 2021 08:15:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=protonmail2; t=1631520920; bh=Hil4mbvHuZ4MbWJ7orIctLxbN1JgouwQhBl7q11Dx8c=; h=Date:To:From:Reply-To:Subject:From; b=UuZOWElJLbttdxJR0eDqLZwYgCG+8D5LxWKTeHZv6fGXb+BUToBSqXXuRwONQsfhn KxgJ5dusfxIucaXDNUw4SvF7idjJMFJ1XfjTZhZyVPmrAN8FkQsEfYIu/C5X+dagdu 1DgtgX0HgE1frmdsxc6XNgqA5mapQB3sKP2+c4YOurkPgj7yaQMKl2OWq3cqr6A8/u Mze3G1SOF69I9XkqU9iGTMTIMIK5L1JctxVCUZXUii292a6VyhxUv8QzN3uBSzr/in 6tQ7sbEo6tB7RLuYCY8SuK8wqWCoz5qGehPvddh6Da9UX6+rWAz/Gmv4tNvz9BH6Ae lWq7FPevvxaEA== From: Josselin Poiret Message-ID: <_O63PhtCI8ZiwBgDZppLf6SqqIgEm3Y0iFYKUIsuLOeAM4yMfbqumjltWSuHKl8tfgUdL0yAC2TVR4nqKvLNJ18Rgs7iImwzPAztAEvIcmM=@jpoiret.xyz> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 13 Sep 2021 11:13:05 -0400 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 * 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 -- 2.33.0 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 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))))