Automatically start xmodmap when I first log in

This commit is contained in:
Tom Willemse 2022-04-06 21:13:44 -07:00
parent 8d5eb70a19
commit fde6941d93

View file

@ -13,6 +13,9 @@
(package (package
(package xmodmap) (package xmodmap)
"Package to use for setting Xmodmap") "Package to use for setting Xmodmap")
(auto-start?
(boolean #t)
"Should xmodmap be started automatically")
(pointer (pointer
(list '()) (list '())
"List of numbers indicating the order of numbers") "List of numbers indicating the order of numbers")
@ -28,24 +31,31 @@
"") "")
(string-join (home-xmodmap-configuration-extra config) "\n" 'suffix)))) (string-join (home-xmodmap-configuration-extra config) "\n" 'suffix))))
(define (xmodmap-home-files config) (define (xmodmap-home-config-file config)
`(("Xmodmap" ,(mixed-text-file (mixed-text-file
"Xmodmap" "Xmodmap"
(serialize-xmodmap-config config))))) (serialize-xmodmap-config config)))
(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)
(let ((xmodmap (home-xmodmap-configuration-package config)))
(if (home-xmodmap-configuration-auto-start? config)
#~(system* #$(file-append xmodmap "/bin/xmodmap")
#$(xmodmap-home-config-file config))
#~"")))
(define home-xmodmap-service-type (define home-xmodmap-service-type
(service-type (service-type
(name 'home-xmodmap) (name 'home-xmodmap)
(extensions (extensions
(list (service-extension (list (service-extension
home-files-service-type
xmodmap-home-files)
(service-extension
home-profile-service-type home-profile-service-type
add-xmodmap-packages))) add-xmodmap-packages)
(service-extension
home-run-on-first-login-service-type
launch-xmodmap-gexp)))
(compose identity) (compose identity)
(default-value (home-xmodmap-configuration)) (default-value (home-xmodmap-configuration))
(description "Install and configure Xmodmap."))) (description "Install and configure Xmodmap.")))