summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSisiutl <sisiutl@egregore.fun>2025-06-15 21:05:56 +0200
committerSisiutl <sisiutl@egregore.fun>2025-06-15 21:05:56 +0200
commitcb800d51debb172c569ee9c6457f386c9b2df464 (patch)
treec1a9c66e63efac982017a87abb27cfe5a671730c
parentb22712ca6ff001dbdfaf5958673e02e885d3ba75 (diff)
make swww wallpapers into one-shots
-rw-r--r--sigils/home/services/wayland.scm51
1 files changed, 23 insertions, 28 deletions
diff --git a/sigils/home/services/wayland.scm b/sigils/home/services/wayland.scm
index 53b69a0..a80a5bd 100644
--- a/sigils/home/services/wayland.scm
+++ b/sigils/home/services/wayland.scm
@@ -164,31 +164,9 @@ Install and configure kanshi, output profile manager.")))
(list-of-swww-wallpaper '())
"List of wallpapers to apply."))
-(define (swww-img-gexp config)
- (receive (with-outputs without-outputs)
- (partition
- swww-wallpaper-output
- (home-swww-configuration-wallpapers config))
- (let ((swww (home-swww-configuration-swww config))
- (sorted-imgs
- (map
- swww-wallpaper-img
- (append with-outputs without-outputs)))
- (sorted-outputs
- (map
- swww-wallpaper-output
- (append with-outputs without-outputs))))
- #~(begin
- (use-modules (ice-9 threads))
- (par-for-each
- (lambda (img output)
- (apply system* (string-append #+swww "/bin/swww") "img" img
- (if output `("-o" ,output) '())))
- '#$sorted-imgs '#$sorted-outputs)))))
-
(define (home-swww-shepherd-service config)
(let ((swww (home-swww-configuration-swww config)))
- (list
+ (cons
(shepherd-service
(provision '(swww))
(requirement '(wayland-display))
@@ -206,7 +184,27 @@ Install and configure kanshi, output profile manager.")))
(remove (cut string-prefix? "WAYLAND_DISPLAY=" <>)
(default-environment-variables))))))
(stop #~(make-kill-destructor))
- (documentation "Run the Swww daemon.")))))
+ (documentation "Run the Swww daemon."))
+ (map
+ (lambda (wallpaper i)
+ (shepherd-service
+ (provision (list (string->symbol (format #f "swww-~a" i))))
+ (requirement '(swww))
+ (one-shot? #t)
+ (start
+ #~(make-forkexec-constructor
+ (append
+ (list
+ #$(file-append swww "/bin/swww") "img"
+ #$(swww-wallpaper-img wallpaper)
+ #$@(let ((output (swww-wallpaper-output wallpaper)))
+ (if output (list "-o" output) '()))))))
+ (stop #~(make-kill-destructor))
+ (documentation "Set the wallpapers for Swww.")))
+ (receive (with-outputs without-outputs)
+ (partition swww-wallpaper-output (home-swww-configuration-wallpapers config))
+ (append without-outputs with-outputs))
+ (iota (length (home-swww-configuration-wallpapers config)) 1)))))
(define home-swww-service-type
(service-type
@@ -220,10 +218,7 @@ Install and configure kanshi, output profile manager.")))
(home-swww-configuration-swww config))))
(service-extension
home-shepherd-service-type
- home-swww-shepherd-service)
- (service-extension
- home-activation-service-type
- swww-img-gexp)))
+ home-swww-shepherd-service)))
(compose identity)
(default-value (home-swww-configuration))
(description "Install and configure swww, animated wallpaper daemon.")))