unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#73788] [PATCH] home: services: Fix 'home-unclutter-service-type'.
@ 2024-10-13 11:45 Fabio Natali via Guix-patches via
  2024-10-14 12:06 ` bug#73788: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Natali via Guix-patches via @ 2024-10-13 11:45 UTC (permalink / raw)
  To: 73788; +Cc: Fabio Natali

* gnu/home/services/desktop.scm: Add DISPLAY to the list of environment
variables passed to 'home-unclutter-service-type'. Change
'make-forkexec-construstor' to 'fork+exec-command' as the former did not seem to
pick up the newly defined environment variable. Add 'x11-display' as a
requirement. These changes are consistent to how things are done in
'home-redshift-service-type'.

Change-Id: Ie8b88b30353e76139d354da27aef791036eaa5a0
---
Hi All. 👋

This is to fix an issue with 'home-unclutter-service-type' where the 'DISPLAY'
environment variable was not passed to the service. Without this patch, on my
system the service fails reporting the following error message in the logs:
'unclutter: could not open display'.

This patch mirrors how things are handled in the 'home-redshift-service-type'
service, so hopefully it's fine.

Let me know what you think.

Thanks, cheers, Fabio.


 gnu/home/services/desktop.scm | 38 ++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index 679ba31c0f..dc9de168b7 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -349,21 +349,31 @@ (define (home-unclutter-shepherd-service config)
   (list
    (shepherd-service
     (provision '(unclutter))
-    (requirement '())
+    ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is
+    ;; available, and fails to start otherwise.
+    (requirement '(x11-display))
+    (modules '((srfi srfi-1)
+               (srfi srfi-26)))
     (one-shot? #t)
-    (start #~(make-forkexec-constructor
-              (list
-               #$(file-append
-                  (home-unclutter-configuration-unclutter config)
-                  "/bin/unclutter")
-               "-idle"
-               (number->string
-                #$(home-unclutter-configuration-idle-timeout config)))
-              #:log-file (string-append
-                          (or (getenv "XDG_STATE_HOME")
-                              (format #f "~a/.local/state"
-                                      (getenv "HOME")))
-                          "/log/unclutter.log"))))))
+    (start #~(lambda _
+               (fork+exec-command
+                (list
+                 #$(file-append
+                    (home-unclutter-configuration-unclutter config)
+                    "/bin/unclutter")
+                 "-idle"
+                 (number->string
+                  #$(home-unclutter-configuration-idle-timeout config)))
+                ;; Inherit the 'DISPLAY' variable set by 'x11-display'.
+                #:environment-variables
+                (cons (string-append "DISPLAY=" (getenv "DISPLAY"))
+                      (remove (cut string-prefix? "DISPLAY=" <>)
+                              (default-environment-variables)))
+                #:log-file (string-append
+                            (or (getenv "XDG_STATE_HOME")
+                                (format #f "~a/.local/state"
+                                        (getenv "HOME")))
+                            "/log/unclutter.log")))))))
 
 (define home-unclutter-service-type
   (service-type

base-commit: e4f5eb6c01727ef143e533019e74830e00d6f5d2
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#73788: [PATCH] home: services: Fix 'home-unclutter-service-type'.
  2024-10-13 11:45 [bug#73788] [PATCH] home: services: Fix 'home-unclutter-service-type' Fabio Natali via Guix-patches via
@ 2024-10-14 12:06 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2024-10-14 12:06 UTC (permalink / raw)
  To: Fabio Natali; +Cc: paren, 73788-done, Tanguy Le Carrour, Andrew Tropin

Fabio Natali <me@fabionatali.com> skribis:

> * gnu/home/services/desktop.scm: Add DISPLAY to the list of environment
> variables passed to 'home-unclutter-service-type'. Change
> 'make-forkexec-construstor' to 'fork+exec-command' as the former did not seem to
> pick up the newly defined environment variable. Add 'x11-display' as a
> requirement. These changes are consistent to how things are done in
> 'home-redshift-service-type'.
>
> Change-Id: Ie8b88b30353e76139d354da27aef791036eaa5a0

Good catch.  Applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-14 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13 11:45 [bug#73788] [PATCH] home: services: Fix 'home-unclutter-service-type' Fabio Natali via Guix-patches via
2024-10-14 12:06 ` bug#73788: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).