@@ -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))))))