aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorFabio Natali <me@fabionatali.com>2024-10-13 12:45:29 +0100
committerLudovic Courtès <ludo@gnu.org>2024-10-14 14:08:44 +0200
commitb0e3121495f3b24e133c61b42cf40ffa9707cf55 (patch)
treec59a5b0aab9722250572e827b8299d936113d468 /gnu
parent8ff33c398ae92570a7ae0b260cd04da8fc8973c8 (diff)
downloadguix-b0e3121495f3b24e133c61b42cf40ffa9707cf55.tar
guix-b0e3121495f3b24e133c61b42cf40ffa9707cf55.tar.gz
home: services: unclutter: Inherit $DISPLAY.
* 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 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/home/services/desktop.scm38
1 files 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 @@ according to time of day.")))
(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