diff options
Diffstat (limited to 'oni/home/services/xmodmap.scm')
-rw-r--r-- | oni/home/services/xmodmap.scm | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/oni/home/services/xmodmap.scm b/oni/home/services/xmodmap.scm new file mode 100644 index 0000000..53df3e5 --- /dev/null +++ b/oni/home/services/xmodmap.scm @@ -0,0 +1,45 @@ +(define-module (oni home services xmodmap) + #:use-module (gnu services configuration) + #:use-module (gnu packages xorg) + #:use-module (gnu home services) + #:use-module (gnu home services utils) + #:use-module (guix packages) + #:use-module (guix gexp) + + #:export (home-xmodmap-service-type + home-xmodmap-configuration)) + +(define-configuration/no-serialization home-xmodmap-configuration + (package + (package xmodmap) + "Package to use for setting Xmodmap") + (pointer + (list '()) + "List of numbers indicating the order of numbers") + (extra + (text-config '()) + "Any other configuration settings.")) + +(define (serialize-xmodmap-config config) + (let ((pointer (home-xmodmap-configuration-pointer config))) + (string-append + (if pointer + (string-append "pointer = " (string-join (map number->string pointer) " ") "\n\n") + "") + (string-join (home-xmodmap-configuration-extra config) "\n" 'suffix)))) + +(define (xmodmap-home-files config) + `(("Xmodmap" ,(mixed-text-file + "Xmodmap" + (serialize-xmodmap-config config))))) + +(define home-xmodmap-service-type + (service-type + (name 'home-xmodmap) + (extensions + (list (service-extension + home-files-service-type + xmodmap-home-files))) + (compose identity) + (default-value (home-xmodmap-configuration)) + (description "Install and configure Xmodmap."))) |