Use shepherd to start xmodmap rather than on first startup

This commit is contained in:
Tom Willemse 2022-04-12 21:33:15 -07:00
parent 13baec4666
commit 00f51af69d

View file

@ -2,6 +2,7 @@
#:use-module (gnu services configuration) #:use-module (gnu services configuration)
#:use-module (gnu packages xorg) #:use-module (gnu packages xorg)
#:use-module (gnu home services) #:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu home services utils) #:use-module (gnu home services utils)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix gexp) #:use-module (guix gexp)
@ -39,12 +40,17 @@
(define (add-xmodmap-packages config) (define (add-xmodmap-packages config)
(list (home-xmodmap-configuration-package config))) (list (home-xmodmap-configuration-package config)))
(define (launch-xmodmap-gexp config) (define (home-xmodmap-shepherd-service config)
(let ((xmodmap (home-xmodmap-configuration-package config))) (list
(if (home-xmodmap-configuration-auto-start? config) (shepherd-service
#~(system* #$(file-append xmodmap "/bin/xmodmap") (documentation "Start Xmodmap")
#$(xmodmap-home-config-file config)) (provision '(xmodmap))
#~""))) (auto-start? (home-xmodmap-configuration-auto-start? config))
(one-shot? #t)
(start
#~(make-forkexec-constructor
'(#$(file-append xmodmap "/bin/xmodmap")
#$(xmodmap-home-config-file config)))))))
(define home-xmodmap-service-type (define home-xmodmap-service-type
(service-type (service-type
@ -54,8 +60,8 @@
home-profile-service-type home-profile-service-type
add-xmodmap-packages) add-xmodmap-packages)
(service-extension (service-extension
home-run-on-first-login-service-type home-shepherd-service-type
launch-xmodmap-gexp))) home-xmodmap-shepherd-service)))
(compose identity) (compose identity)
(default-value (home-xmodmap-configuration)) (default-value (home-xmodmap-configuration))
(description "Install and configure Xmodmap."))) (description "Install and configure Xmodmap.")))