I have this guix home
service for saving and loading brightness levels using brightnessctl
,
(define-module (apoorv home services brightness)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu packages)
#:use-module (gnu packages linux)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (guix gexp)
#:export (home-brightnessctl-service-type))
(define (home-brightnessctl-profile-service config)
(map specification->package
(list "brightnessctl")))
(define (home-brightnessctl-shepherd-service config)
(list
(shepherd-service
(provision '(brightnessctl))
(documentation "Save and restore brightness.")
(one-shot? #t)
(start #~(lambda rest
(fork+exec-command
(list #$(file-append brightnessctl "/bin/brightnessctl") "--restore"))
#t))
(stop #~(lambda rest
(fork+exec-command
(list #$(file-append brightnessctl "/bin/brightnessctl") "--save"))
#f)))))
(define home-brightnessctl-service-type
(service-type
(name 'home-brightnessctl)
(description "A service for saving and restoring brightness.")
(extensions
(list (service-extension
home-profile-service-type
home-brightnessctl-profile-service)
(service-extension
home-shepherd-service-type
home-brightnessctl-shepherd-service)))
(default-value #f)))
This does nothing when I reboot the system for example, but if I lower the brightness then manually stop, raise or lower brightness and start it again, it does work as expected i.e it restores the brightness to the level I set it to before stopping the service.
What could be causing it not working on system reboot?