Add unclutter configuration for guix home

This commit is contained in:
Tom Willemse 2022-06-16 19:09:43 -07:00
parent 46259edd2d
commit 5cd91c77e0
2 changed files with 89 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#:use-module (gnu packages admin) #:use-module (gnu packages admin)
#:use-module (gnu packages shellutils) #:use-module (gnu packages shellutils)
#:use-module (gnu packages wm) #:use-module (gnu packages wm)
#:use-module (gnu packages xdisorg)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (oni home services xdisorg) #:use-module (oni home services xdisorg)
#:use-module (oni home services xmodmap) #:use-module (oni home services xmodmap)
@ -21,6 +22,7 @@
#:use-module (oni home services kdeconnect) #:use-module (oni home services kdeconnect)
#:use-module (oni home services cmst) #:use-module (oni home services cmst)
#:use-module (oni home services syncthing) #:use-module (oni home services syncthing)
#:use-module (oni home services unclutter)
#:use-module (oni packages hlwm-run-or-raise) #:use-module (oni packages hlwm-run-or-raise)
#:use-module (oni packages pick-random-wallpaper)) #:use-module (oni packages pick-random-wallpaper))
@ -372,4 +374,9 @@
(service home-cmst-service-type) (service home-cmst-service-type)
(service home-syncthing-service-type)))) (service home-syncthing-service-type)
(service home-unclutter-service-type
(home-unclutter-configuration
(package unclutter-xfixes)
(exclude-root #t))))))

View file

@ -0,0 +1,81 @@
(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 (lambda (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.")))