[PATCH] home: services: Fix 'home-unclutter-service-type'.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Fabio Natali
Owner
unassigned
Submitted by
Fabio Natali
Severity
normal

Debbugs page

Fabio Natali wrote 5 months ago
(address . guix-patches@gnu.org)(name . Fabio Natali)(address . me@fabionatali.com)
b337f523b187d7ac4809eb5efc9b7da94d42f064.1728818409.git.me@fabionatali.com
* 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(-)

Toggle diff (54 lines)
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
Ludovic Courtès wrote 5 months ago
(name . Fabio Natali)(address . me@fabionatali.com)
87o73m28ja.fsf@gnu.org
Fabio Natali <me@fabionatali.com> skribis:

Toggle quote (9 lines)
> * 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!
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 73788@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73788
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help