81 lines
2.9 KiB
Scheme
81 lines
2.9 KiB
Scheme
(define-module (oni home services unclutter)
|
|
#:use-module (gnu services configuration)
|
|
#:use-module (gnu packages xdisorg)
|
|
#:use-module (gnu home services)
|
|
#:use-module (gnu home services shepherd)
|
|
#:use-module (gnu home services utils)
|
|
#:use-module (guix packages)
|
|
#:use-module (guix gexp)
|
|
|
|
#:export (home-unclutter-service-type
|
|
home-unclutter-configuration))
|
|
|
|
(define-configuration home-unclutter-configuration
|
|
(package
|
|
(package unclutter)
|
|
"Which package to use to provide unclutter.")
|
|
(timeout
|
|
(integer 5)
|
|
"The number of seconds after which the cursor should be hidden.")
|
|
(jitter
|
|
(integer 0)
|
|
"Ignore cursor movements within this radius.")
|
|
(exclude-root
|
|
(boolean #f)
|
|
"Don't hide the cursor if it is over the root window.")
|
|
(ignore-scrolling
|
|
(boolean #f)
|
|
"Don't make the cursor appear when you scroll.")
|
|
(ignore-buttons
|
|
(list '())
|
|
"Don't make the cursor appear when these buttons are used.")
|
|
(hide-on-touch
|
|
(boolean #f)
|
|
"Hide the cursor on touch events.")
|
|
(start-hidden
|
|
(boolean #f)
|
|
"Hide the cursor on startup.")
|
|
(no-serialization))
|
|
|
|
(define (add-unclutter-packages config)
|
|
(list (home-unclutter-configuration-package config)))
|
|
|
|
(define (home-unclutter-shepherd-service config)
|
|
(list
|
|
(shepherd-service
|
|
(documentation "Start unclutter")
|
|
(provision '(unclutter))
|
|
(auto-start? #t)
|
|
(start
|
|
#~(make-forkexec-constructor
|
|
'#$(append
|
|
(delete #f
|
|
(list (file-append (home-unclutter-configuration-package config) "/bin/unclutter")
|
|
"--timeout" (home-unclutter-configuration-timeout config)
|
|
"--jitter" (home-unclutter-configuration-jitter config)
|
|
(and (home-unclutter-configuration-exclude-root config) "--exclude-root")
|
|
(and (home-unclutter-configuration-ignore-scrolling config) "--ignore-scrolling")
|
|
(and (home-unclutter-configuration-hide-on-touch config) "--hide-on-touch")
|
|
(and (home-unclutter-configuration-start-hidden config) "--start-hidden")))
|
|
(let ((buttons (home-unclutter-configuration-ignore-buttons config)))
|
|
(if (> (length buttons) 0)
|
|
(list
|
|
"--ignore-buttons"
|
|
(string-join (map (λ (i) (format #f "~s" i)) buttons) ","))
|
|
'())))
|
|
#:log-file (format #f "~a/.local/var/log/unclutter.log" (getenv "HOME"))))
|
|
(stop #~(make-kill-destructor)))))
|
|
|
|
(define home-unclutter-service-type
|
|
(service-type
|
|
(name 'home-unclutter)
|
|
(extensions
|
|
(list (service-extension
|
|
home-profile-service-type
|
|
add-unclutter-packages)
|
|
(service-extension
|
|
home-shepherd-service-type
|
|
home-unclutter-shepherd-service)))
|
|
(compose identity)
|
|
(default-value (home-unclutter-configuration))
|
|
(description "Install and configure unclutter.")))
|