dotfiles/oni/home/services/autokey.scm

57 lines
1.9 KiB
Scheme

(define-module (oni home services autokey)
#:use-module ((gnu services configuration)
#:select (define-configuration/no-serialization))
#:use-module ((gnu packages python-xyz)
#:select (autokey))
#:use-module ((gnu home services)
#:select (service-type
service-extension
home-profile-service-type))
#:use-module ((gnu home services shepherd)
#:select (home-shepherd-service-type
shepherd-service))
#:use-module ((guix packages)
#:select (package?))
#:use-module ((guix gexp)
#:select (gexp
file-append))
#:export (home-autokey-service-type
home-autokey-configuration))
(define-configuration/no-serialization home-autokey-configuration
(package
(package autokey)
"Package to use for setting autokey")
(auto-start?
(boolean #t)
"Automatically start autokey on startup?"))
(define (add-autokey-packages config)
(list (home-autokey-configuration-package config)))
(define (home-autokey-shepherd-service config)
(list
(shepherd-service
(documentation "Start autokey")
(provision '(autokey))
(auto-start? (home-autokey-configuration-auto-start? config))
(start
#~(make-forkexec-constructor
(list #$(file-append (home-autokey-configuration-package config) "/bin/autokey-gtk"))
#:log-file (format #f "~a/.local/var/log/autokey.log" (getenv "HOME"))))
(stop #~(make-kill-destructor)))))
(define home-autokey-service-type
(service-type
(name 'home-autokey)
(extensions
(list (service-extension
home-profile-service-type
add-autokey-packages)
(service-extension
home-shepherd-service-type
home-autokey-shepherd-service)))
(compose identity)
(default-value (home-autokey-configuration))
(description "Install and configure autokey.")))