From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH] home: services: Add 'x11-display' service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Wed, 16 Aug 2023 17:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65343@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by submit@debbugs.gnu.org id=B.16922078541893 (code B ref -1); Wed, 16 Aug 2023 17:45:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Aug 2023 17:44:14 +0000 Received: from localhost ([127.0.0.1]:42035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWKZ3-0000UT-Ua for submit@debbugs.gnu.org; Wed, 16 Aug 2023 13:44:14 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWKZ0-0000UD-Q9 for submit@debbugs.gnu.org; Wed, 16 Aug 2023 13:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWKYv-0003uk-Ee for guix-patches@gnu.org; Wed, 16 Aug 2023 13:44:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWKYu-00056e-Cl; Wed, 16 Aug 2023 13:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=EDkNBdMmWiQJ2cFWH+ok30iDoKP/xvyrFsRvLoBCUf8=; b=nscRo4agFlDI/8 bMFuRI1iucfgBKrdulY17LWl27M5J94ktWE6r40ahQ9rwBH2zYCn2DGfLCyWtu5/k3S954GfBInEZ p41VzpVXxr7sHRllEHwg2GDS8BHzsw4FxApTzg3WpbBNR7yOFkV++/hJGwqfdZGgj+xMwWkWxWacQ E/zsolwf5lStwv594syVOW0XjPWMBVRF4tMiLujUswIfV8Hn7M/8ttxxTYZFR2rvhrB01DpTaSs3V DJqzHrEMeqzFCK3D599nSwA7yrE4jXR8o/C3Aq6Sg34Xq/z3eKR4x9op/FViPSQZ2DhSFotnQC58v Kb0K/ncb58WzDpRrOsdg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 16 Aug 2023 19:43:51 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services/desktop.scm (x11-shepherd-service): New procedure. (home-x11-service-type): New variable. (redshift-shepherd-service): Add 'requirement' field. (home-redshift-service-type): Extend 'home-x11-service-type'. * doc/guix.texi (Desktop Home Services): Document it. --- doc/guix.texi | 22 ++++++++++ gnu/home/services/desktop.scm | 82 ++++++++++++++++++++++++++++++++--- 2 files changed, 99 insertions(+), 5 deletions(-) Hello Guix! This is an attempt to fix a longstanding issue with Home services that depend on X11: how can we make sure that (1) they are not started when X is not running, and (2) they get the correct ‘DISPLAY’ variable. It’s a bit of a hack (the idea came up during a discussion on IRC a few days ago), but it does the job. I guess it could be extended to Wayland as well, but I’m not familiar with it. Thoughts? Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index 22590b4f9c..a99ef8e5e8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44067,6 +44067,28 @@ Desktop Home Services may find useful on ``desktop'' systems running a graphical user environment such as Xorg. +@cindex X Window, for Guix Home services +@cindex X11, in Guix Home +@defvar home-x11-service-type +This is the service type representing the X Window graphical display +server (also referred to as ``X11''). + +X Window is necessarily started by a system service; on Guix System, +starting it is the responsibility of @code{gdm-service-type} and similar +services (@pxref{X Window}). At the level of Guix Home, as an +unprivileged user, we cannot start X Window; all we can do is check +whether it is running. This is what this service does. + +As a user, you probably don't need to worry or explicitly instantiate +@code{home-x11-service-type}. Services that require an X Window +graphical display, such as @code{home-redshift-service-type} below, +instantiate it and depend on its corresponding @code{x11-display} +Shepherd service (@pxref{Shepherd Home Service}). When X Window is +running, the @code{x11-display} Shepherd service starts and sets the +@code{DISPLAY} environment variable of the @command{shepherd} process; +otherwise, it fails to start. +@end defvar + @defvar home-redshift-service-type This is the service type for @uref{https://github.com/jonls/redshift, Redshift}, a program that adjusts the display color temperature diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index 626918fd9e..b293031fd1 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2022-2023 Ludovic Courtès ;;; Copyright © 2022 ( ;;; Copyright © 2023 conses ;;; Copyright © 2023 Janneke Nieuwenhuizen @@ -30,7 +30,9 @@ (define-module (gnu home services desktop) #:use-module (guix gexp) #:use-module (srfi srfi-1) #:use-module (ice-9 match) - #:export (home-redshift-configuration + #:export (home-x11-service-type + + home-redshift-configuration home-redshift-configuration? home-redshift-service-type @@ -43,6 +45,69 @@ (define-module (gnu home services desktop) home-xmodmap-configuration home-xmodmap-service-type)) + +;;; +;;; Waiting for X11. +;;; + +(define (x11-shepherd-service delay) + (list (shepherd-service + (provision '(x11-display)) + (modules '((ice-9 ftw) + (ice-9 match) + (srfi srfi-1))) + (start #~(lambda () + (define x11-directory + "/tmp/.X11-unix") + + ;; Wait for an accessible socket to show up in + ;; X11-DIRECTORY, up to DELAY seconds. + (let loop ((attempts #$delay)) + (define socket + (find (match-lambda + ((or "." "..") #f) + (name + (let ((name (in-vicinity x11-directory + name))) + (access? name O_RDWR)))) + (or (scandir x11-directory) '()))) + + (if (and socket (string-prefix? "X" socket)) + (let ((display (string-append + ":" (string-drop socket 1)))) + (format #t "X11 display server found at ~s.~%" + display) + (setenv "DISPLAY" display) + display) + (if (zero? attempts) + (begin + (display + "X11 display server did not show up; \ +giving up.\n" + (current-error-port)) + #f) + (begin + (sleep 1) + (loop (- attempts 1)))))))) + (stop #~(lambda (_) + (unsetenv "DISPLAY") + #f)) + (respawn? #f)))) + +(define home-x11-service-type + (service-type + (name 'home-x11-display) + (extensions (list (service-extension home-shepherd-service-type + x11-shepherd-service))) + (default-value 5) + (description + "Create a @code{x11-display} Shepherd service that waits for the X +Window (or ``X11'') graphical display server to be up and running, up to a +configurable delay, and sets the @code{DISPLAY} environment variable of +@command{shepherd} itself accordingly. If no accessible X11 server shows up +during that time, the @code{x11-display} service is marked as failing to +start."))) + ;;; ;;; Redshift. @@ -169,8 +234,11 @@ (define (redshift-shepherd-service config) (list (shepherd-service (documentation "Redshift program.") (provision '(redshift)) - ;; FIXME: This fails to start if Home is first activated from a - ;; non-X11 session. + + ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is + ;; available, and fails to start otherwise. + (requirement '(x11-display)) + (start #~(make-forkexec-constructor (list #$(file-append redshift "/bin/redshift") "-c" #$config-file))) @@ -181,7 +249,11 @@ (define home-redshift-service-type (service-type (name 'home-redshift) (extensions (list (service-extension home-shepherd-service-type - redshift-shepherd-service))) + redshift-shepherd-service) + ;; Ensure 'home-x11-service-type' is instantiated so we + ;; can depend on the Shepherd 'x11-display' service. + (service-extension home-x11-service-type + (const #t)))) (default-value (home-redshift-configuration)) (description "Run Redshift, a program that adjusts the color temperature of display base-commit: 880ada0bdb9e694573ec42200d48658b27744b9b -- 2.41.0 From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH] home: services: Add 'x11-display' service. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Aug 2023 19:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: paren@disroot.org, 65343@debbugs.gnu.org, Andrew Tropin Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169221262130325 (code B ref 65343); Wed, 16 Aug 2023 19:04:02 +0000 Received: (at 65343) by debbugs.gnu.org; 16 Aug 2023 19:03:41 +0000 Received: from localhost ([127.0.0.1]:42105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWLnw-0007t3-Jj for submit@debbugs.gnu.org; Wed, 16 Aug 2023 15:03:40 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]:40029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWLnu-0007sl-E4 for 65343@debbugs.gnu.org; Wed, 16 Aug 2023 15:03:38 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2bb8ab71165so6547781fa.0 for <65343@debbugs.gnu.org>; Wed, 16 Aug 2023 12:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692212612; x=1692817412; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=h6Qol76kKVHY3LoujH7WtdNHeDQ0V09pZcB+4qB7PqM=; b=pylPiJH6PIT4RRRD7wnJ7uURyEHfBUEqb/x9fXuJICHLclHocUVLflAhqfYmD41u1E 8m5S98E5j0dcMvQdkaaGuPUNpyFbtsLYJKfHJ80Z1SXdHnrX4gcNxmlKKKHEAyzjih+g nMz38ZpDiAUJPdEhNsSV+QLSlFTi7zxWoOPY+kr3YERGGeLeXoIRtb/4NJWPYbAf+IgZ WGcBKZz4Uf0zM4zgfW3SdZlUVDy+ABvw4Y7niUe3QcQC1CIjFDv3BDYOq6j+pNnX2cR3 zRImx4tjARO41Gv7lkoxrgu8XTW1ewlVOCownNpiP0JOXBJtYSWVEtlkSd8+19atT+1B F0bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692212612; x=1692817412; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h6Qol76kKVHY3LoujH7WtdNHeDQ0V09pZcB+4qB7PqM=; b=ZUvzZh4ZOv0JspE5++fIhgndJf2RxYw4+IpEYPZJe1lMHGH1HBuFse9W1oTeSZrEnY /WWypcS6IuXR2xpKSZTZ7qtKztADEr5KV/Js9q9trMjb4QFRX3C+jf2nwYWryv6sIJex +oVb2yc9quBIwcoymywKJnSrVv/ZOlH+97uAPfaV4FfpZ8KYPUpvyAFok6PWwPgL+jA6 yVzsLmq2RQEbD4708snh9byM0kABC291Lv8kk46x5cdETSDeVlZZBcg2n+ZjOOxoKT99 yZB99Lv3icQIt/5r7nt9/wZ3cCfOIZ1ihp8GC5VrXOyGUs6v/7Q2zm83kaVSNtPvS5bO 8G9g== X-Gm-Message-State: AOJu0YwNf4XH/mhognvRKiyIJotWBiKUrVPBJRkzYIX5ZwW34vXsyO3J ZPnyZiN/APowgmEPBDkQnTg= X-Google-Smtp-Source: AGHT+IE6STeF5xr8SvDm5zl+sEmxoOusMzda3Q1M07Lm4lQImZVjWQzWinQJfZ8EVZnKXULxcTibWg== X-Received: by 2002:a2e:a238:0:b0:2b9:4bc3:c367 with SMTP id i24-20020a2ea238000000b002b94bc3c367mr1872144ljm.5.1692212612122; Wed, 16 Aug 2023 12:03:32 -0700 (PDT) Received: from localhost ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id g1-20020a2e9cc1000000b002b9f4841913sm3633715ljj.1.2023.08.16.12.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 12:03:31 -0700 (PDT) From: Oleg Pykhalov References: Date: Wed, 16 Aug 2023 22:03:30 +0300 In-Reply-To: ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Wed, 16 Aug 2023 19:43:51 +0200") Message-ID: <877cpuernh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludovic, Ludovic Court=C3=A8s writes: > * gnu/home/services/desktop.scm (x11-shepherd-service): New procedure. > (home-x11-service-type): New variable. > (redshift-shepherd-service): Add 'requirement' field. > (home-redshift-service-type): Extend 'home-x11-service-type'. > * doc/guix.texi (Desktop Home Services): Document it. > --- > doc/guix.texi | 22 ++++++++++ > gnu/home/services/desktop.scm | 82 ++++++++++++++++++++++++++++++++--- > 2 files changed, 99 insertions(+), 5 deletions(-) > > This is an attempt to fix a longstanding issue with Home services > that depend on X11: how can we make sure that (1) they are not started > when X is not running, and (2) they get the correct =E2=80=98DISPLAY=E2= =80=99 > variable. > > [=E2=80=A6] > > Thoughts? If I understood the patch correctly, the =E2=80=98x11-shepherd-service=E2= =80=99 procedure finds a first file like =E2=80=98/tmp/.X11-unix/X0=E2=80=99 or =E2=80=98/tmp/.X11-unix/X2=E2=80=99 which is readable by a user which runs = the Shepherd. Is it possible to allow a user to exactly specify a list of files in =E2=80=98/tmp/.X11-unix=E2=80=99 directory, which will be checked? It will= be useful for VNC users to make sure X11 services are running on a specified DISPLAY. Otherwise X11 services will be running on a DISPLAY handled by VNC after boot and never on DISPLAY which becomes available after authentication (XWayland, GDM , SLIM, LightDM, etc). Regards, Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmTdHYMUHGdvLndpZ3Vz dEBnbWFpbC5jb20ACgkQFn+OpQAa+pzVzA//QTaSDnAz2wcmgLZOU6iD8az9BZ5S 1cImUIxJl7ZP3MArUjntJYVvZH41lRxUcwcxipXhNANDcVTvnfynA7w3zQQqpbP5 tgrAprR9SpSwJpOjIhYPXKUnrMkLfeqhzIdfETAjRlrO2Ldlbb3YXquQwVNqkp+m BVCeq57cFjpvKeLDti2gmraC2ds8uTSgAeySoL7qP5eRYkg/We+45w6osmcKoig4 Wul2VPhY2em673pA6oEA86CqzRUiLfNGG3jLcK3Fk1JDlIht57yZ9s7a3+xNe626 OG4uSK99RnGy3+7jpx82hS2mmFYZCXt+AOevZtvwON7Gi8CKGINXxyQhpvYuhj2d JY31IgpfgRlfGU2IujpviXEnso14qCA8eAYzzQ9lZ4Fp/K5yMp6LK+mRPPrAoY2/ KMxQyXo0evlcLgRv2hcGwvnmiZ4tFASy3CQirhNhWSoW1kQQ3I0Fd6whbCtnjTKB zTlZLKUN1wkd3QoSdevKh2zIQTzASgXGbzu8gpQ/hno8EEIqI2K61myfNL23FgPU 7sKhLL80T+pvNUm7NE8hf1J2ghmoMxVeUvNH1VJX5l3ZNNEkmrSYAOBexJ7HfyBJ UoSsEW0ltWSRlI1Mx4mjGrHPocj24iXLvE5hnbEts1o6aJLf7NeKCgr1Egok+v0Q iFjGcFnEWkIn+Ec= =RRQ7 -----END PGP SIGNATURE----- --=-=-=-- From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH] home: services: Add 'x11-display' service. Resent-From: Brian Cully Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Aug 2023 20:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: paren@disroot.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= , 65343@debbugs.gnu.org, Andrew Tropin Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.16922193369749 (code B ref 65343); Wed, 16 Aug 2023 20:56:01 +0000 Received: (at 65343) by debbugs.gnu.org; 16 Aug 2023 20:55:36 +0000 Received: from localhost ([127.0.0.1]:42243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWNYF-0002XA-Os for submit@debbugs.gnu.org; Wed, 16 Aug 2023 16:55:36 -0400 Received: from coleridge.kublai.com ([166.84.7.167]:55428 helo=mail.spork.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWNYD-0002X0-9B for 65343@debbugs.gnu.org; Wed, 16 Aug 2023 16:55:34 -0400 Received: from psyduck (ool-18b8e9e7.dyn.optonline.net [24.184.233.231]) by mail.spork.org (Postfix) with ESMTPSA id 33874CD5; Wed, 16 Aug 2023 16:55:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim; t=1692219332; bh=0ioknHgwcUDOW403FxfoYm+Smd5AGIYuOjT7jXg63CM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=xU7T0R8zpUf7yp5lrt/wvt7BYHN4dqv9FD5fkvSu3PAGosQM5JK8M3KDoYgM3hbyy Qbg6B4k40lqbN+rRskzZaoBRDd2S0N+Hj6j7QgXialHBm0MsC1/fMdd0qyC3EkFMP4 ztcQFm/x7Zq9uEbM54pBgqjXr2VAxamlsGo1OiKM= From: Brian Cully In-Reply-To: <877cpuernh.fsf@gmail.com> (Oleg Pykhalov's message of "Wed, 16 Aug 2023 22:03:30 +0300") References: <877cpuernh.fsf@gmail.com> Date: Wed, 16 Aug 2023 16:55:05 -0400 Message-ID: <87a5uqwvva.fsf@spork.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) The largest issue I see with this patch is that it doesn't correlate the X11 socket with the session being used in cases where there's more than one X11 display. If, for instance, I start an X session on the console, allocating the first display (:0), everything will start up correctly. If I then log in from a remote host with SSH using X forwarding, I'll get another display allocated (:1), but this isn't accounted for. If I do these operations in reverse, first starting my X-forwarded SSH session, then logging in via console, it will almost certainly not do what just about anyone wants. This does presume the Shepherd can be started multiple times for a given user, and run concurrently, though this does not appear to actually be the case, since there's a single global location for the socket, which isn't differentiated by session. But that's a separate issue. This also doesn't handle the case of the X11 server going away, either by crash or user request. If we're starting stuff on behalf of users when it comes up, it seems to me we should also be stopping stuff on users' behalf when it comes down. The lack of handling this could easily lead to resource-churning loops where X11 goes away, but Shepherd services continuously restart themselves trying to connect to a display that no longer exists. If this is only meant to be used when using a display manager, a la gdm, then it might be ok. I'm not sure, since I don't use them. When logging out of an X session started from gdm, is the user's shepherd process stopped? Is it stopped gracefully? What about sddm? lightdm? From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH] home: services: Add 'x11-display' service. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 05 Sep 2023 12:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Brian Cully , Oleg Pykhalov Cc: paren@disroot.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= , 65343@debbugs.gnu.org Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169391524126136 (code B ref 65343); Tue, 05 Sep 2023 12:01:02 +0000 Received: (at 65343) by debbugs.gnu.org; 5 Sep 2023 12:00:41 +0000 Received: from localhost ([127.0.0.1]:54653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdUjY-0006nU-UL for submit@debbugs.gnu.org; Tue, 05 Sep 2023 08:00:41 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:55093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdUjW-0006nH-Ms for 65343@debbugs.gnu.org; Tue, 05 Sep 2023 08:00:39 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8DCF820005; Tue, 5 Sep 2023 12:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1693915232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q3vdKyvOR3c9DKF5g3t4s4jda8CSzRPjZysVJmDDBt8=; b=WB1mXjn6sqwRXc2EwT98JrYyHF9j5uwwzrM7fOUMWtnl7VJPWY2lRpNSR+7v5vMOF/yRC9 A9QoW3HbYS124txYEOSoeR1Zfd84cXHVHkbTBLUdX0bFqp84HGpKoy0wHiNdDr9Hx9rm96 Sus9MyG6nu8PDfv32KHGMQzGqi8gE+SJGzYAQJ3y5s788kmjcADfTe8LKqmOTUs9G9Uh/+ zDISVNMamWXILHCD8ot9OwIyfhAh9VAZAUwbBOc/7b/jhhMAzY35qFUqwIQjp4hepBWaLk B9kZpz0kKvbML6j/U93sUKnprn2bQvzPxRkeQvFCWWRQZM7WcBqC11hfMdMQfQ== From: Andrew Tropin In-Reply-To: <87a5uqwvva.fsf@spork.org> References: <877cpuernh.fsf@gmail.com> <87a5uqwvva.fsf@spork.org> Date: Tue, 05 Sep 2023 16:00:25 +0400 Message-ID: <87o7igzv6u.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-GND-Sasl: andrew@trop.in X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2023-08-16 16:55, Brian Cully wrote: > The largest issue I see with this patch is that it doesn't correlate the > X11 socket with the session being used in cases where there's more than > one X11 display. > > If, for instance, I start an X session on the console, allocating the > first display (:0), everything will start up correctly. If I then log in > from a remote host with SSH using X forwarding, I'll get another display > allocated (:1), but this isn't accounted for. If I do these operations > in reverse, first starting my X-forwarded SSH session, then logging in > via console, it will almost certainly not do what just about anyone > wants. > > This does presume the Shepherd can be started multiple times for a given > user, and run concurrently, though this does not appear to actually be > the case, since there's a single global location for the socket, which > isn't differentiated by session. But that's a separate issue. > > This also doesn't handle the case of the X11 server going away, either > by crash or user request. If we're starting stuff on behalf of users > when it comes up, it seems to me we should also be stopping stuff on > users' behalf when it comes down. The lack of handling this could easily > lead to resource-churning loops where X11 goes away, but Shepherd > services continuously restart themselves trying to connect to a display > that no longer exists. > > If this is only meant to be used when using a display manager, a la gdm, > then it might be ok. I'm not sure, since I don't use them. When logging > out of an X session started from gdm, is the user's shepherd process > stopped? Is it stopped gracefully? What about sddm? lightdm? I have been seeking for the solution for this for some time and also tried similiar thing as Ludo's patch does and I'm agree with concerns mentioned above by Brian. At the end in rde we decided to start shepherd by Sway (wayland compositor), so all the services have proper environment variables. It has other downsides, but overall works well for usual desktop use cases. I don't have a complete generic answer to this problem yet. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmT3GFkACgkQIgjSCVjB 3rCvVA/+JGJaNzrKRqcALzPNx7KmRH2GWzuKAg704S2arHZ+wyJ8wfTiWnxXM+lE sb7Y5WLFNHHTO6DbE9DyHFX2IMpkjE939JeP7FJhcOWzlALlisPCmXd2FQDgYgNk R/97aACHhT+dxXF0M7BaWXX0bf4yeYoU0i2/zD1n6yuuGTCFPB23PFidQnd2TMuF Z8ou8kcOhh+JeZPA3PNeqsvcSRu0MXbzFroliXjkPK0szpTiXNwW/2g5X/kreP46 WCoH7AQ6hjdOqaqkIHZJdgCt5JaCDPmlPUJdyL34Xn8NXjro4XtoOW8z2l/LIg68 gwg7H6cxTSV2CCXieAFpWw7VQjZKHymWMbaxjaSCmZLOQ9KgQ1ZRNyMgyiY/eh8D a7MzCAJ323qbQQk/30YZYZA5u/QFyUfFaVtBgn5LLrS0m2BG5IBFGGnQIuC/Zrve tfYCsR/6BQ8YtcZTH6w6KL14OQh2A5x25k3yKG50mrj7fQa+lCcB8Kn1rCK+zlgl VuT7uXVaNcaUmroujy+pqHSJnufqmD2YHe9JZtVmfP2T1ve+KJiCyCa7vFSM3Jxw zVF7otTI0PyLvK8hRAGnOiNA95o8TIzCYbpp9VgS1bqUntggUiw5ooOaI32k3FT9 21fXKbJ8DmRAssTLAGTcn53MkJLdMK/JDGU5wcWVOSbjnRwIrss= =dQjN -----END PGP SIGNATURE----- --=-=-=-- From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH] home: services: Add 'x11-display' service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Sep 2023 20:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Brian Cully Cc: Oleg Pykhalov , Andrew Tropin , 65343@debbugs.gnu.org, paren@disroot.org Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169472394815862 (code B ref 65343); Thu, 14 Sep 2023 20:40:01 +0000 Received: (at 65343) by debbugs.gnu.org; 14 Sep 2023 20:39:08 +0000 Received: from localhost ([127.0.0.1]:41253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgt7D-00047m-Ib for submit@debbugs.gnu.org; Thu, 14 Sep 2023 16:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgt7B-00046M-1G for 65343@debbugs.gnu.org; Thu, 14 Sep 2023 16:39:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgt6z-0005DA-2L; Thu, 14 Sep 2023 16:38:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=eP9t8lwgvduY1UDpYJv409zxnCx2kRikV2618dbucKQ=; b=osTicVsG0xbSvAKk3JOF xIU9cn5h4ubIAsTK93p6dhB+rl+458ury2CLgqbAx8txD5CaaBpL7k1qdlHBDufS+hbLyLa+X1x1c K6i8kJXqKMqE0ydvDiI63IN71ZwHB8s99hyIadSNvHUdZhJYcT5ZqHB2TUlSiM2kyfG/HYadde6E3 HkDZ9zjkp4x/+EwADN+lOKtPzefpigfvk0BQUBd6HdjhfkiToC5a/1W0rBfmwfwmNuaSuDx1qYIyz qRKm0352TbVKKbMWAKu2rwvVL/Oo8XkDdtuhtsFWQcKNIsevVjaHePXyV0OM3YCEjbNP/hTsVcvKp DYbvj2Id0RamuQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <877cpuernh.fsf@gmail.com> <87a5uqwvva.fsf@spork.org> Date: Thu, 14 Sep 2023 22:38:46 +0200 In-Reply-To: <87a5uqwvva.fsf@spork.org> (Brian Cully's message of "Wed, 16 Aug 2023 16:55:05 -0400") Message-ID: <87msxo5w2x.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Brian & Oleg, Brian Cully skribis: > If, for instance, I start an X session on the console, allocating the > first display (:0), everything will start up correctly. If I then log in > from a remote host with SSH using X forwarding, I'll get another display > allocated (:1), but this isn't accounted for. If I do these operations > in reverse, first starting my X-forwarded SSH session, then logging in > via console, it will almost certainly not do what just about anyone > wants. Yeah, and similarly with the scenario Oleg describes. > This does presume the Shepherd can be started multiple times for a given > user, No no, but it assumes simple scenarios: when you first login locally, X is not running yet, but you eventually start it and that=E2=80=99s the disp= lay you want your services to use. Anything beyond that won=E2=80=99t work, as= you point out. A simple improvement would be to stop the service when the relevant /tmp/.X11-unix socket disappears. As for which display to use when several are available (the SSH example above), I don=E2=80=99t know. Apparently elogind doesn=E2=80=99t know whic= h display corresponds to a =E2=80=9Cseat=E2=80=9D. Maybe we shouldn=E2=80=99t try to= guess and instead let users specify it, for instance with =E2=80=98herd start x11-display :42= =E2=80=99? Now, without this service the situation is even worse: shepherd and its sub-processes inherit whatever =E2=80=98DISPLAY=E2=80=99 value was in its e= nvironment, if any, and that=E2=80=99s it. This service is a hack, but might still do = more good than harm? Ludo=E2=80=99. From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH] home: services: Add 'x11-display' service. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Sep 2023 22:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: paren@disroot.org, Andrew Tropin , 65343@debbugs.gnu.org, Brian Cully Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169473117026895 (code B ref 65343); Thu, 14 Sep 2023 22:40:02 +0000 Received: (at 65343) by debbugs.gnu.org; 14 Sep 2023 22:39:30 +0000 Received: from localhost ([127.0.0.1]:41400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qguzi-0006zj-0i for submit@debbugs.gnu.org; Thu, 14 Sep 2023 18:39:30 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:38258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qguze-0006zQ-Gk for 65343@debbugs.gnu.org; Thu, 14 Sep 2023 18:39:28 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5008c19d97fso468992e87.1 for <65343@debbugs.gnu.org>; Thu, 14 Sep 2023 15:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694731154; x=1695335954; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=cAW0qIlxm/HKNPmWlOA4tIw8OrKJzOdEF2EK/CxvYx0=; b=Y88T5eFOz4gLvaCVJaOINmppCTI/6QOHlKjlv+84z5RCjt71cPhOOavYeDXZ5QXT9b p+xQfceSCmT0daRFXLNQjpcGHlxlsLC2DIZhr2oN41RBPSdAPH4/y9aXweklqz/VMbGY 3Y6mx0yUJIPEyu1Ep/mmoUfNBSsIcfyyarhDGfQ8Y5UTZv7pgFCmIrzOg3ZYg9UTPT3k 3TvSwyiL6HpyO8Ybwa53Zf+ARb4dBu0dJb7ToWE2lwWUkI2lStAFug1+BfCegVcqf2om suKQfZLGExyZLFh7k3nEK7H4PZXkyK5v45yhnSTtD5aERA86gZZD1iB6ZXl05C4fNodA BuUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694731154; x=1695335954; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cAW0qIlxm/HKNPmWlOA4tIw8OrKJzOdEF2EK/CxvYx0=; b=YzfLl48RrrUaW31tHleV6uNyXWi2rYQIiv1LvDg0zky2nSCNT9wMc+UTRJia8hhUBv On9xNVbHdFofFQCcFJDTGa3So2kFbL8TdCYxYBG16nKobGdAhzU0XzorYS8TA6YmWDhM +ELf4Ai25FBxM/1TICYwVdC9VmK3ehagMiuhg+ijJNb3wZj5DrVhKdDMgKOkFBak9hXZ nn/cCYFiBKHdRGU9ZHf7O+soxqcnPQl7zL5Z0q62J2bLQXmqc2Tpny6i13UL7vnoJ/js 6iVv/OhO0gPSYgwOf6qRScROD4eCQZKZlRPAR91HQW5fbdOi0354JOQk/74dkBqu0oNA ZDvw== X-Gm-Message-State: AOJu0YwMF/xkUKlh/wy/0tIh8oUPPmE3nv710YZQ5FR1Y/Xd14e6zv/B xoVQ4k7jGrGFtiy6SToFUdg= X-Google-Smtp-Source: AGHT+IEtPT0oJ3P8WqJ6iku/8MTkvAyyieafFdSLZkQq4Cy/TQ+CH7XtPvYHzMvZRgQE6sg+BZq7+Q== X-Received: by 2002:ac2:5e8b:0:b0:502:e042:ca40 with SMTP id b11-20020ac25e8b000000b00502e042ca40mr22119lfq.6.1694731153684; Thu, 14 Sep 2023 15:39:13 -0700 (PDT) Received: from localhost ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id x9-20020ac24889000000b004f764716afdsm423177lfc.257.2023.09.14.15.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 15:39:13 -0700 (PDT) From: Oleg Pykhalov References: <877cpuernh.fsf@gmail.com> <87a5uqwvva.fsf@spork.org> <87msxo5w2x.fsf_-_@gnu.org> Date: Fri, 15 Sep 2023 01:39:10 +0300 In-Reply-To: <87msxo5w2x.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 14 Sep 2023 22:38:46 +0200") Message-ID: <87il8c2xdd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: [=E2=80=A6] > Now, without this service the situation is even worse: shepherd and its > sub-processes inherit whatever =E2=80=98DISPLAY=E2=80=99 value was in its= environment, > if any, and that=E2=80=99s it. This service is a hack, but might still d= o more > good than harm? Inheriting environment variable is under the user's controll. Finding a readable file by the user is less (requires to start x11 sessions in a specific order). By more controll I mean the user could stop Shepherd on a DISPLAY :0 and start it on DISPLAY :1 without stopping x11 sessions. In any case, current patch with or without specification of files order (or =E2=80=98herd start x11-display :42=E2=80=99) will change current behav= iour. So, I think a small entry in =E2=80=98news.scm=E2=80=99 could save somebody a day. Regards, Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmUDi44UHGdvLndpZ3Vz dEBnbWFpbC5jb20ACgkQFn+OpQAa+pwnGg/7BLWmjPt8h3iVa3PMCaRFNwzx3fT9 W9RG8ww3ilfcbIYHPrvyWtZyBYdEQqblylpXs3IJCPbD0hz8X5Vr3FLOOnFg9kLA RuW+yKMj9akEro/GHQXni0jadP6hIt8LPArz/p2sw8timsPJ37y3kGITX67bSh4D g502n+WDqSPPyU5YMWQgzCtItd3iWCfCZqkTaa558wwZxABTCBEsbFxblUwikK6d Bqxve/IWqvU75n8xksjLgFHe8ImQamP1zsWjEgICOsycNN1CKp5GP0jhoAJ9vHca X/LgxS00LJBOBHHjP8cqva035ai+gSOqmVkpmW49JspR/+xRF2OCx3QwSg6w6gyZ OSR29nYDuuNuV+Gk7P6vLUJeFfwQyetkrUV65Z0w2967M2kyBla/7w8wJp4shSk2 ciI9XjEb7LmhKEv2Na+wl+dFvy7RrC0JybAPaM8D7hHnTKoZVfc0urP8O0Pwzyo2 XaugdOHjq8DHioVz3Xa9crK08k0l7jcnr4omvigCvfZeFVHn48n/JmvFssjQ3caR 52K1kn1xwRn7IWt8TI1d5uHWKcfpQ3NHT3NaA8Rj8EhLo3re8vflT1AFlRGRgCRX VD0X73Bs9tfrrO8mCS3xt9Pnj0PuS3bqWRH7tVr5UxQgm0sdYHHmdnRqIcuDPGfq uRmr3mzKsxdtqpU= =WdRH -----END PGP SIGNATURE----- --=-=-=-- From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH v2] home: services: Add 'x11-display' service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Fri, 20 Oct 2023 21:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65343@debbugs.gnu.org Cc: Oleg Pykhalov , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Brian Cully , ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169783626423933 (code B ref 65343); Fri, 20 Oct 2023 21:12:02 +0000 Received: (at 65343) by debbugs.gnu.org; 20 Oct 2023 21:11:04 +0000 Received: from localhost ([127.0.0.1]:41757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtwls-0006Dw-5u for submit@debbugs.gnu.org; Fri, 20 Oct 2023 17:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtwlp-0006DP-6N for 65343@debbugs.gnu.org; Fri, 20 Oct 2023 17:11:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtwlH-0006k3-3B; Fri, 20 Oct 2023 17:10:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=PqCAUuuY3G2gvAsky9TsbGcQq2I+zhc24r/dUAoy9Ho=; b=lEXYDQGYbIv366dw1gA/ 0R6bxkRabNQEgfkkcd1klraLNcF91VUx6bcOn18kkDUnM2zAMLfV3rZ4cCQ6KKa22cHHf1HwwD4YT VU4yEXIlwaI2ayMd+pp2WD6RpE3KhCUhdPXnL0WN3J1pALeVIQbNSuRV28sWnkmX1ZpG844ugF3Z0 EUvou14uoNVl48avJhgAir6/aMxoFmxnOpcwAtEMf3qNec5ipQ7VXWYGgbY6CH0pYM1aZvhO4liH3 RHa7DCSTvU42D030KRXTJvbxeG8yt3RelUQ8ef8hMygZ2IjlrZRVjsXE/1iwFiF74T6c+MZC2W3jz 0xFFjTXLMlJplA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 20 Oct 2023 23:09:57 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <87il8c2xdd.fsf@gmail.com> References: <87il8c2xdd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/desktop.scm (x11-shepherd-service): New procedure. (home-x11-service-type): New variable. (redshift-shepherd-service): Add 'requirement' field. (home-redshift-service-type): Extend 'home-x11-service-type'. * doc/guix.texi (Desktop Home Services): Document it. --- doc/guix.texi | 34 ++++++++++++++ gnu/home/services/desktop.scm | 87 +++++++++++++++++++++++++++++++++-- 2 files changed, 116 insertions(+), 5 deletions(-) Hi! Changes in this version: 1. ‘x11-display’ defaults to the ‘DISPLAY’ value of the ‘shepherd’ process, if any. This makes it fully compatible with what we have now (processes basically inherit environment variables of the ‘shepherd’ process). 2. One can specify a display: ‘herd start x11-display :42’. WDYT? Thanks, Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index 91408b8e62..7984673b6a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44455,6 +44455,40 @@ Desktop Home Services may find useful on ``desktop'' systems running a graphical user environment such as Xorg. +@cindex X Window, for Guix Home services +@cindex X11, in Guix Home +@defvar home-x11-service-type +This is the service type representing the X Window graphical display +server (also referred to as ``X11''). + +X Window is necessarily started by a system service; on Guix System, +starting it is the responsibility of @code{gdm-service-type} and similar +services (@pxref{X Window}). At the level of Guix Home, as an +unprivileged user, we cannot start X Window; all we can do is check +whether it is running. This is what this service does. + +As a user, you probably don't need to worry or explicitly instantiate +@code{home-x11-service-type}. Services that require an X Window +graphical display, such as @code{home-redshift-service-type} below, +instantiate it and depend on its corresponding @code{x11-display} +Shepherd service (@pxref{Shepherd Home Service}). + +When X Window is running, the @code{x11-display} Shepherd service starts +and sets the @env{DISPLAY} environment variable of the +@command{shepherd} process, using its original value if it was already +set; otherwise, it fails to start. + +The service can also be forced to use a given value for @env{DISPLAY}, +like so: + +@example +herd start x11-display :3 +@end example + +In the example above, @code{x11-display} is instructed to set +@env{DISPLAY} to @code{:3}. +@end defvar + @defvar home-redshift-service-type This is the service type for @uref{https://github.com/jonls/redshift, Redshift}, a program that adjusts the display color temperature diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index c4da116100..45a319c0f8 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2022-2023 Ludovic Courtès ;;; Copyright © 2022 ( ;;; Copyright © 2023 conses ;;; Copyright © 2023 Janneke Nieuwenhuizen @@ -30,7 +30,9 @@ (define-module (gnu home services desktop) #:use-module (guix gexp) #:use-module (srfi srfi-1) #:use-module (ice-9 match) - #:export (home-redshift-configuration + #:export (home-x11-service-type + + home-redshift-configuration home-redshift-configuration? home-redshift-service-type @@ -43,6 +45,74 @@ (define-module (gnu home services desktop) home-xmodmap-configuration home-xmodmap-service-type)) + +;;; +;;; Waiting for X11. +;;; + +(define (x11-shepherd-service delay) + (list (shepherd-service + (provision '(x11-display)) + (modules '((ice-9 ftw) + (ice-9 match) + (srfi srfi-1))) + (start + #~(lambda* (#:optional (display (getenv "DISPLAY"))) + (define x11-directory + "/tmp/.X11-unix") + + (define (find-display delay) + ;; Wait for an accessible socket to show up in X11-DIRECTORY, + ;; up to DELAY seconds. + (let loop ((attempts delay)) + (define socket + (find (match-lambda + ((or "." "..") #f) + (name + (let ((name (in-vicinity x11-directory + name))) + (access? name O_RDWR)))) + (or (scandir x11-directory) '()))) + + (if (and socket (string-prefix? "X" socket)) + (let ((display (string-append + ":" (string-drop socket 1)))) + (format #t "X11 display server found at ~s.~%" + display) + display) + (if (zero? attempts) + (begin + (format (current-error-port) + "X11 display server did not show up; \ +giving up.\n") + #f) + (begin + (sleep 1) + (loop (- attempts 1))))))) + + (let ((display (or display (find-display #$delay)))) + (when display + (setenv "DISPLAY" display)) + display))) + (stop #~(lambda (_) + (unsetenv "DISPLAY") + #f)) + (respawn? #f)))) + +(define home-x11-service-type + (service-type + (name 'home-x11-display) + (extensions (list (service-extension home-shepherd-service-type + x11-shepherd-service))) + (default-value 10) + (description + "Create a @code{x11-display} Shepherd service that waits for the X +Window (or ``X11'') graphical display server to be up and running, up to a +configurable delay, and sets the @code{DISPLAY} environment variable of +@command{shepherd} itself accordingly. If no accessible X11 server shows up +during that time, the @code{x11-display} service is marked as failing to +start."))) + ;;; ;;; Redshift. @@ -169,8 +239,11 @@ (define (redshift-shepherd-service config) (list (shepherd-service (documentation "Redshift program.") (provision '(redshift)) - ;; FIXME: This fails to start if Home is first activated from a - ;; non-X11 session. + + ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is + ;; available, and fails to start otherwise. + (requirement '(x11-display)) + (start #~(make-forkexec-constructor (list #$(file-append (home-redshift-configuration-redshift config) "/bin/redshift") "-c" #$config-file))) @@ -181,7 +254,11 @@ (define home-redshift-service-type (service-type (name 'home-redshift) (extensions (list (service-extension home-shepherd-service-type - redshift-shepherd-service))) + redshift-shepherd-service) + ;; Ensure 'home-x11-service-type' is instantiated so we + ;; can depend on the Shepherd 'x11-display' service. + (service-extension home-x11-service-type + (const #t)))) (default-value (home-redshift-configuration)) (description "Run Redshift, a program that adjusts the color temperature of display base-commit: 6b0a32196982a0a2f4dbb59d35e55833a5545ac6 -- 2.41.0 From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH v2] home: services: Add 'x11-display' service. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Nov 2023 17:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 65343@debbugs.gnu.org, Brian Cully Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169903075610613 (code B ref 65343); Fri, 03 Nov 2023 17:00:02 +0000 Received: (at 65343) by debbugs.gnu.org; 3 Nov 2023 16:59:16 +0000 Received: from localhost ([127.0.0.1]:59687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyxVr-0002l7-Te for submit@debbugs.gnu.org; Fri, 03 Nov 2023 12:59:16 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]:40202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyxVp-0002kr-PD for 65343@debbugs.gnu.org; Fri, 03 Nov 2023 12:59:15 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2c504a51a18so5676351fa.1 for <65343@debbugs.gnu.org>; Fri, 03 Nov 2023 09:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699030712; x=1699635512; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=RfaLIkxhxcQGSo9gaIGl4OHtq3/ZAp8/y7nQSZGMqCo=; b=FHJ22zSKNeKXEJQDHVb2nU15Kb30J+odxkuWm2ujFDvrL4XjI6kI6uZzIFgUfE0JaJ onUf/x4JDWLYrLXwVtCW6TUxrLF7FHkGNfh0Mg7k27LFRHsGGQKZYaN73/DYQDsC62e4 vqzG4eJqEw2CtIqOzbFvztQHJtZI7ZzeIIdZ8J+kpl+XLMwbaeobWyKNyv09yG+nFs6S rAM5NKBxzKQV59xjLqnLR2sdRo/YCbwbVx+BnajMdHeW4UFRnDu6VBsH4rvnCDwf5jqr QV1kx1zdj7YH6Q7PSI8nGxJJbhxl1mX+qdFMN06jVeE8b+FUc8e4oackJ8radia1OCM1 XMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699030712; x=1699635512; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RfaLIkxhxcQGSo9gaIGl4OHtq3/ZAp8/y7nQSZGMqCo=; b=Vm5D2b26c+22H3y+qKRt5GS4LMAh+lGOEONShnvyKTGmOKzBcu7mhtEebX085Cd1c6 /aL5gx8K63MipNIAXRxkT11j1Q3u0Olah7iaKZeC0H97xDrhVRuJxr3RAwcZuEALNwBs z98+7JaGB2pERg/gBMAXHWwzHsD9k1Vkyyk84CR5Qv/NtXeK+fMX9/E6r+S8WYDNX1AU U9bQWs/7n43Z5VGycqEOhs4v6+I81uwJkMOSA7cx78YpQ7BND49wwjE/blxzb0cnaMdH yEjVRbrurxXBvGwd66ZtzOt+2/sKGwS7ez6ZZnAn/EnXBL9yoEnfAJFKmer866n8HPO0 2gFw== X-Gm-Message-State: AOJu0YzbPc/K6WiZA6IaZuXJrlqUAwPs0lkFEDXFHbKEeGCwfC1X3Ogf NHmJzySzbwEHhiiQEIkJG7AyUERAAJY= X-Google-Smtp-Source: AGHT+IEThWcO3KUw/37h0YTW/zjkalzVdPaHIqxaZynOjKoYwawGBNrDqwE5g61Gy1CmYpJQKpKRjQ== X-Received: by 2002:a05:651c:1a25:b0:2c0:1959:fe59 with SMTP id by37-20020a05651c1a2500b002c01959fe59mr20832452ljb.3.1699030711691; Fri, 03 Nov 2023 09:58:31 -0700 (PDT) Received: from localhost ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id x6-20020a2e8386000000b002b6e77e87fcsm269159ljg.68.2023.11.03.09.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 09:58:30 -0700 (PDT) From: Oleg Pykhalov References: <87il8c2xdd.fsf@gmail.com> Date: Fri, 03 Nov 2023 19:58:29 +0300 In-Reply-To: ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Fri, 20 Oct 2023 23:09:57 +0200") Message-ID: <87lebekc3u.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludovic, apologize for the slow response. I had some minor issues with setting a 'home shepherd' instance in a fresh testing virtual machine (not related to the current issue). Ludovic Court=C3=A8s writes: > * gnu/home/services/desktop.scm (x11-shepherd-service): New procedure. > (home-x11-service-type): New variable. > (redshift-shepherd-service): Add 'requirement' field. > (home-redshift-service-type): Extend 'home-x11-service-type'. > * doc/guix.texi (Desktop Home Services): Document it. > --- > doc/guix.texi | 34 ++++++++++++++ > gnu/home/services/desktop.scm | 87 +++++++++++++++++++++++++++++++++-- > 2 files changed, 116 insertions(+), 5 deletions(-) > > Changes in this version: > > 1. =E2=80=98x11-display=E2=80=99 defaults to the =E2=80=98DISPLAY=E2=80= =99 value of the =E2=80=98shepherd=E2=80=99 > process, if any. This makes it fully compatible with what we > have now (processes basically inherit environment variables of > the =E2=80=98shepherd=E2=80=99 process). > > 2. One can specify a display: =E2=80=98herd start x11-display :42=E2=80= =99. > > WDYT? I think we are going in the right direction, thank you for the implementation! During testing in a virtual machine I found an issue, which could be reproduced with the steps bellow. It's not an emergency issue which blocks the patch from merging, because we still have a workaround in our pocket (stop and start =E2=80=98shepherd=E2=80=99 manually on a specific = =E2=80=98DISPLAY=E2=80=99). =2D start =E2=80=98shepherd=E2=80=99 manually on =E2=80=98127.0.0.1:5=E2=80= =99 by typing =E2=80=98shepherd=E2=80=99 in a GUI terminal; =2D stop =E2=80=98x11-display=E2=80=99 with =E2=80=98herd stop x11-display= =E2=80=99; =2D start =E2=80=98x11-display=E2=80=99 with =E2=80=98herd start x11-displa= y :1=E2=80=99; =2D start =E2=80=98redshift=E2=80=99 with =E2=80=98herd start redshift=E2= =80=99. The =E2=80=98redshift=E2=80=99 service starts a =E2=80=98redshift=E2=80=99 = process. The /proc/REDSHIFT_PID/environ file has a =E2=80=98DISPLAY=E2=80=99 variable se= tted to =E2=80=98127.0.0.1:5=E2=80=99. I expect that in /proc/REDSHIFT_PID/environ file the value of =E2=80=98DISP= LAY=E2=80=99 environment variable should be =E2=80=98:1=E2=80=99, as in =E2=80=98x11-dis= play=E2=80=99 service started right before the =E2=80=98redshift=E2=80=99 service. Following services could be used to get =E2=80=98:1=E2=80=99 and =E2=80=981= 27.0.0.1:5=E2=80=99: =2D-8<---------------cut here---------------start------------->8--- (service lxqt-desktop-service-type) (service xvnc-service-type (xvnc-configuration (display-number 5) (localhost? #f) (xdmcp? #t) (inetd? #t))) (modify-services %desktop-services (gdm-service-type config =3D> (gdm-configuration (inherit config) (auto-suspend? #f) (xdmcp? #t)))) =2D-8<---------------cut here---------------end--------------->8--- A workaround for this issue to stop =E2=80=98shepherd=E2=80=99 with =E2=80= =98herd stop root=E2=80=99, and start it on =E2=80=98:1=E2=80=99 with =E2=80=98shepherd=E2=80=99 in a G= UI terminal. Regards, Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmVFJrYUHGdvLndpZ3Vz dEBnbWFpbC5jb20ACgkQFn+OpQAa+pz3pxAAqmUNlpqPUxbA7v7Uxe/Z2flWfjRA HKesq8kCTQEP3XHAo6QTh/9W3FhWKOsk5Rs7votNLCsaB5ILylHXU2TpsQEB7f/L vMsm4DOZ5tK1lXqAW4hG8hMSE8b2Sax2aZE+mldNwyZ6g3AV53ydryQGiZbj4K2Z 4/Ph7BkjTqzWSXI1MKskAvHG4aGdQQ0QLcq91ML7laLuecFOi3Q59SStuI/NoAMG fMs1H6xKSzaCy2mnsIOjmlDgiJMZ6UACXXY+k4rvtlJsPUxU30ZoFRaIPoilVdnq N+fFPaCt1v6QMALqqMkuqUIJOJC+/soWevyK0Fbg2p/UJTiG48y34tGpRAv8NJvw /+vB55dfIMCtJ6Tc5P7l2hiLD6lfKZwAi6ufO/lT4EsK6jlV09azYHn74nU4hRIq N2SgvR1EYyhWFqUBf+lAvS9Mrvt3OKlueFZzG1PxqmRfyyUb1ANBpcWAMc3oEC7o 1Fl9xtWQrwVIkgsTXreDfCcreUamRL0Rad83xm7IXZ5m1+jOic/gfL8V1K3ibyQF yx0tDcT9YwETfrU3/smb3oKJo4hauRwzG6Xrxo4elfiJxV2BNcNROSsntLFzWgwl pMVIqI5WaQ8cn3dkSJ/RA3j3uNzV3cfnw72dY+LXe8PlaupjctSSGY7c49azS0MK /tJdGgHlfAaol8o= =bLOA -----END PGP SIGNATURE----- --=-=-=-- From unknown Sun Jun 22 07:46:11 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH v2] home: services: Add 'x11-display' service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Nov 2023 22:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 65343@debbugs.gnu.org, Brian Cully Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169922348713424 (code B ref 65343); Sun, 05 Nov 2023 22:32:02 +0000 Received: (at 65343) by debbugs.gnu.org; 5 Nov 2023 22:31:27 +0000 Received: from localhost ([127.0.0.1]:38315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzleR-0003US-Cn for submit@debbugs.gnu.org; Sun, 05 Nov 2023 17:31:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzleQ-0003UE-El for 65343@debbugs.gnu.org; Sun, 05 Nov 2023 17:31:26 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qzldY-0000kf-Fp; Sun, 05 Nov 2023 17:30:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=j8FxZkeeXD/0/5pp3FmjZC1k0IQ6m+ALpWDhzAwDZs4=; b=fI7xb8Fzsw/Vj9jB5a5z uUYvQnw5tD/3YsraYEggtV2eQaA4IPWfra2TIWj1g64PEpK6vy+3RC0oJ8IKf3zzIL93W0nQStsph I7x9ME7jgNotvwyHqo30w4ZFKdrDcTyGdxvch7NI3Ft00CBMu+OCBCf0fZa7iCbrIs1RiX0iaHP1I KxNQDQE8Si7u4Xnt9eN0nZ07/TQGB6Z1mpaMV0O3r8abvr3tw7B4ne3BVeCXkaij0Oe1kA3EEG0DD 8Bk7duy4Xf4Qqbh6f8/iYOstkoZlmEbOkoSZq4n3F/5FweESxshhvdqth6A5E9dhuQ3hZoS3l8svT OrWFZ5+dQG78ag==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87lebekc3u.fsf@gmail.com> (Oleg Pykhalov's message of "Fri, 03 Nov 2023 19:58:29 +0300") References: <87il8c2xdd.fsf@gmail.com> <87lebekc3u.fsf@gmail.com> Date: Sun, 05 Nov 2023 23:30:30 +0100 Message-ID: <87wmuvygs9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Oleg Pykhalov skribis: > During testing in a virtual machine I found an issue, which could be > reproduced with the steps bellow. It's not an emergency issue which > blocks the patch from merging, because we still have a workaround in our > pocket (stop and start =E2=80=98shepherd=E2=80=99 manually on a specific = =E2=80=98DISPLAY=E2=80=99). > > - start =E2=80=98shepherd=E2=80=99 manually on =E2=80=98127.0.0.1:5=E2=80= =99 by typing =E2=80=98shepherd=E2=80=99 in a > GUI terminal; > - stop =E2=80=98x11-display=E2=80=99 with =E2=80=98herd stop x11-display= =E2=80=99; > - start =E2=80=98x11-display=E2=80=99 with =E2=80=98herd start x11-displa= y :1=E2=80=99; > - start =E2=80=98redshift=E2=80=99 with =E2=80=98herd start redshift=E2= =80=99. > > The =E2=80=98redshift=E2=80=99 service starts a =E2=80=98redshift=E2=80= =99 process. The > /proc/REDSHIFT_PID/environ file has a =E2=80=98DISPLAY=E2=80=99 variable = setted to > =E2=80=98127.0.0.1:5=E2=80=99. Indeed, good catch! There was a bug: it=E2=80=99s not enough to call =E2= =80=98setenv=E2=80=99 because =E2=80=98make-forkexec-constructor=E2=80=99 & co. have an explicit #:environment-variables parameter, which defaults to the environment of =E2=80=98shepherd=E2=80=99 when it was started. (On top of that, setting t= he =E2=80=98default-environment-variables=E2=80=99 SRFI-39 parameter from the = =E2=80=98start=E2=80=99 method of =E2=80=98x11-display=E2=80=99 wouldn=E2=80=99t work because each = fiber has its own dynamic environment=E2=80=A6) I had to make the change below. Result pushed as commit 08d94fe20eca47b69678b3eced8749dd02c700a4. Thank you for reviewing and testing! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index 45a319c0f8..91465bf168 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -92,6 +92,11 @@ (define (x11-shepherd-service delay) (let ((display (or display (find-display #$delay)))) (when display + ;; Note: 'make-forkexec-constructor' calls take their + ;; default #:environment-variables value before this service + ;; is started and are thus unaffected by the 'setenv' call + ;; below. Users of this service have to explicitly query + ;; its value. (setenv "DISPLAY" display)) display))) (stop #~(lambda (_) @@ -244,9 +249,20 @@ (define (redshift-shepherd-service config) ;; available, and fails to start otherwise. (requirement '(x11-display)) - (start #~(make-forkexec-constructor - (list #$(file-append (home-redshift-configuration-redshift config) "/bin/redshift") - "-c" #$config-file))) + (modules '((srfi srfi-1) + (srfi srfi-26))) + (start #~(lambda _ + (fork+exec-command + (list #$(file-append + (home-redshift-configuration-redshift config) + "/bin/redshift") + "-c" #$config-file) + + ;; Inherit the 'DISPLAY' variable set by 'x11-display'. + #:environment-variables + (cons (string-append "DISPLAY=" (getenv "DISPLAY")) + (remove (cut string-prefix? "DISPLAY=" <>) + (default-environment-variables)))))) (stop #~(make-kill-destructor)) (actions (list (shepherd-configuration-action config-file)))))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 05 17:31:33 2023 Received: (at control) by debbugs.gnu.org; 5 Nov 2023 22:31:33 +0000 Received: from localhost ([127.0.0.1]:38319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzleW-0003Uj-Sl for submit@debbugs.gnu.org; Sun, 05 Nov 2023 17:31:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzleV-0003UK-6U for control@debbugs.gnu.org; Sun, 05 Nov 2023 17:31:31 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qzldo-0000oP-U5 for control@debbugs.gnu.org; Sun, 05 Nov 2023 17:30:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=5VPewc5ulYHeCwOC8qf2C6Uug4/X0zPXwCRuNQiFJd8=; b=B2iQ1PL6Dk0bOS WFgQgkZZjtPzQj+iZipTJTlT1luT7fJPZ4q6TumRC9YMRTqmU0kmFpNT8syQP7/nNFs1mXKuNn0lJ 3Yfb44BRsyn5+pBXvZ40vW3jv6dM3McvXv4w/RWVvqB2Oz1eoPCzskatJHHYoVsDAKXanpqpEBM54 3fp+uiYkvng/gXExfFH0DtewdPrByPwHGPZPmSt6wlaUujoUiIn8/L52y0QhVmEgeUE8pcQQUTrQj wQW0u9PH6S4TZvYhFIXuCcNYKaLo5S1s4fvJP4cX0b1cGhqYFmSwUPAmcZ9ZK3YZSnCYNLdCLzZVX A7SYqpsjuehYlWui+gLQ==; Date: Sun, 05 Nov 2023 23:30:46 +0100 Message-Id: <87v8afygrt.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #65343 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 65343 quit