diff options
author | Sisiutl <sisiutl@egregore.fun> | 2024-11-13 17:20:55 +0100 |
---|---|---|
committer | Sisiutl <sisiutl@egregore.fun> | 2024-11-13 17:20:55 +0100 |
commit | 6db319cffb9c68ebb4ed92e54d5810cd8372cd83 (patch) | |
tree | 066e0def10f18fd652ee62e07662f98afac3bc5c | |
parent | c5dd44055009bd81826990415c267ebd5714fbbe (diff) |
hypridle service
-rw-r--r-- | sigils/home/services/hyprland.scm | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/sigils/home/services/hyprland.scm b/sigils/home/services/hyprland.scm index 6bdcfe0..f0c5678 100644 --- a/sigils/home/services/hyprland.scm +++ b/sigils/home/services/hyprland.scm @@ -2,6 +2,7 @@ #:use-module (guix gexp) #:use-module (guix packages) #:use-module (gnu home services) + #:use-module (gnu home services shepherd) #:use-module (gnu services configuration) #:use-module (sigils packages hyprland) @@ -19,7 +20,10 @@ home-hyprpaper-service-type home-hyprlock-configuration - home-hyprlock-service-type)) + home-hyprlock-service-type + + home-hypridle-configuration + home-hypridle-service-type)) (define hypr-config? list?) @@ -251,7 +255,7 @@ (list (home-hyprpaper-configuration-hyprpaper config)))))) (compose identity) (default-value (home-hyprpaper-configuration)) - (description "Configure Hyprpaper by providing @file{~/.config/hypr/hyprpaper.conf}"))) + (description "Configure Hyprpaper by providing @file{~/.config/hypr/hyprpaper.conf}."))) ;;; Hyprlock @@ -283,4 +287,51 @@ (list (home-hyprlock-configuration-hyprlock config)))))) (compose identity) (default-value (home-hyprlock-configuration)) - (description "Configure Hyprlock by providing @file{~/.config/hypr/hyprlock.conf}"))) + (description "Configure Hyprlock by providing @file{~/.config/hypr/hyprlock.conf}."))) + +;;; Hypridle + +(define-configuration/no-serialization home-hypridle-configuration + (hypridle + (file-like hypridle) + "The hypridle package to use.") + (config + (hypr-config '()) + "Hypridle configuration")) + +(define (hypridle-configuration->file config) + `(("hypr/hypridle.conf" + ,(apply mixed-text-file + "hypridle-config" + (serialize-hypr-config + (home-hypridle-configuration-config config)))))) + +(define (home-hypridle-shepherd-service config) + (shepherd-service + (documentation "Hypridle daemon") + (provision '(hypridle)) + (requirement '(dbus)) + (start #~(make-forkexec-constructor + (list #$(file-append + (home-hypridle-configuration-hypridle config) + "/bin/hypridle")))) + (stop #~(make-kill-destructor)))) + +(define home-hypridle-service-type + (service-type + (name 'home-hypridle) + (extensions + (list (service-extension + home-xdg-configuration-files-service-type + hypridle-configuration->file) + ;; (service-extension + ;; home-shepherd-service-type + ;; (lambda (config) + ;; (list (home-hypridle-shepherd-service config)))) + (service-extension + home-profile-service-type + (lambda (config) + (list (home-hypridle-configuration-hypridle config)))))) + (compose identity) + (default-value (home-hypridle-configuration)) + (description "Configure Hypridle by providing @file{~/.config/hypr/hypridle.conf} and start the service."))) |