Make picom restart automatically when the coonfiguration changes

This commit is contained in:
Tom Willemse 2023-03-16 23:09:54 -07:00
parent 9059cec94c
commit 300c22cb56

View file

@ -6,11 +6,14 @@
serialize-package)) serialize-package))
#:use-module ((gnu packages compton) #:use-module ((gnu packages compton)
#:select (picom)) #:select (picom))
#:use-module ((gnu packages admin)
#:select (shepherd))
#:use-module ((gnu home services) #:use-module ((gnu home services)
#:select (home-profile-service-type #:select (home-profile-service-type
home-xdg-configuration-files-service-type home-xdg-configuration-files-service-type
service-extension service-extension
service-type)) service-type
home-run-on-change-service-type))
#:use-module ((gnu home services shepherd) #:use-module ((gnu home services shepherd)
#:select (home-shepherd-service-type #:select (home-shepherd-service-type
shepherd-service)) shepherd-service))
@ -183,6 +186,10 @@
#:log-file (format #f "~a/.local/var/log/picom.log" (getenv "HOME")))) #:log-file (format #f "~a/.local/var/log/picom.log" (getenv "HOME"))))
(stop #~(make-kill-destructor))))) (stop #~(make-kill-destructor)))))
(define (restart-picom-gexp _)
`(("files/.config/picom.conf"
,#~(system* #$(file-append shepherd "/bin/herd") "restart" "picom"))))
(define home-picom-service-type (define home-picom-service-type
(service-type (name 'home-picom) (service-type (name 'home-picom)
(extensions (extensions
@ -194,7 +201,10 @@
home-picom-profile-service) home-picom-profile-service)
(service-extension (service-extension
home-shepherd-service-type home-shepherd-service-type
home-picom-shepherd-service))) home-picom-shepherd-service)
(service-extension
home-run-on-change-service-type
restart-picom-gexp)))
(compose concatenate) (compose concatenate)
(default-value (home-picom-configuration)) (default-value (home-picom-configuration))
(description "Configure Picom"))) (description "Configure Picom")))