From 201ea4662bc18e07065755913134660f4c2a0e78 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 17 Mar 2023 00:33:19 -0700 Subject: [PATCH] Automatically reload stumpwm if any changes are made to its config --- oni/home/services/stumpwm.scm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/oni/home/services/stumpwm.scm b/oni/home/services/stumpwm.scm index b6ba4fd..ebda987 100644 --- a/oni/home/services/stumpwm.scm +++ b/oni/home/services/stumpwm.scm @@ -3,14 +3,18 @@ #:select (serialize-package define-configuration)) #:use-module ((gnu packages wm) - #:select (stumpwm)) + #:select (stumpwm + stumpish)) #:use-module ((gnu home services) #:select (service-type service-extension home-profile-service-type - home-xdg-configuration-files-service-type)) + home-xdg-configuration-files-service-type + home-run-on-change-service-type)) #:use-module ((guix gexp) - #:select (local-file)) + #:select (local-file + gexp + file-append)) #:use-module ((guix packages) #:select (package?)) @@ -20,14 +24,22 @@ (define-configuration home-stumpwm-configuration (package (package stumpwm) - "Package to use for setting Stumpwm")) + "Package to use for setting Stumpwm") + (stumpish-package + (package stumpish) + "Package to use for setting Stumpish")) (define (add-stumpwm-packages config) - (list (home-stumpwm-configuration-package config))) + (list (home-stumpwm-configuration-package config) + (home-stumpwm-configuration-stumpish-package config))) (define (home-stumpwm-config-files config) `(("stumpwm/config" ,(local-file "stumpwm/config")))) +(define (reload-stumpwm-config-gexp _) + `(("files/.config/stumpwm/config" + ,#~(system* #$(file-append stumpish "/bin/stumpish") "reload")))) + (define home-stumpwm-service-type (service-type (name 'home-stumpwm) @@ -37,7 +49,10 @@ add-stumpwm-packages) (service-extension home-xdg-configuration-files-service-type - home-stumpwm-config-files))) + home-stumpwm-config-files) + (service-extension + home-run-on-change-service-type + reload-stumpwm-config-gexp))) (compose identity) (default-value (home-stumpwm-configuration)) (description "Install and configure stumpwm.")))