New paste Repaste Download
(simple-service 'swww-daemon-service
                home-shepherd-service-type
                (list (shepherd-service
                       (provision '(swww-daemon))
                       (start
                        #~(make-forkexec-constructor
                           (list #$(file-append
                                    (@ (gnu packages wm)
                                       swww)
                                    "/bin/swww-daemon"))))
                       (stop #~(make-kill-destructor))
                       (documentation "Run @acronym{swww, a Solution to
your Wayland Wallpaper Woes}, a wallpaper daemon."))))
(simple-service 'swww-background-rotation-service
                home-shepherd-service-type
                (list (let* ((backgrounds
                              '(("https://w.wallhaven.cc/full/e8/wallhaven-e8717l.jpg"
                                 .
                                 "09dks9hc02jqa1hqj0lrxkg8pix9cwi932vvx35draq4pdqxidci")
                                ("https://w.wallhaven.cc/full/qz/wallhaven-qzdo3r.jpg"
                                 .
                                 "11syj6hdradb62l6qqfdlyqfg2ml5kkwl7y5p55f8x8bxkq18g6x")
                                ;; ("https://pbs.twimg.com/media/G1vF8RlaAAI81eP.jpg?name=orig"
                                ;;  .
                                ;;  "1jw28hw3ysfwwyjc2x15fbwignrlzkxz69g2mhhz4a55k1khn3rd")
                                ("https://w.wallhaven.cc/full/9o/wallhaven-9ode5x.jpg"
                                 .
                                 "08bfp5nf82yp4bkbvgmvczrbavnifk54n2lf639gzrxbq9gibrfv")))
                             (_ (set! *random-state* (random-state-from-platform))) ;seed the random state
                             (random-index (random (length backgrounds)))
                             (current-candidate (list-ref backgrounds random-index))
                             (url (car current-candidate))
                             (hash (cdr current-candidate))
                             (background
                              (origin
                               (method url-fetch)
                               (uri url)
                               (sha256
                                (base32 hash)))))
                        (shepherd-timer '(swww-background-rotation)
                                        #~(cron-string->calendar-event
                                           "0 * * * *") ;hourly job
                                        #~(#$(file-append
                                              (@ (gnu packages wm)
                                                 swww)
                                              "/bin/swww")
                                             "img"
                                             #$background)
                                        #:requirement '(swww-daemon)))))
Filename: swww.scm. Size: 3kb. View raw, , hex, or download this file.

This paste expires on 2025-11-08 05:41:20.766433. Pasted through web.