From 5cd91c77e0240fe991128b82fe0e56b440e5185e Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 16 Jun 2022 19:09:43 -0700 Subject: Add unclutter configuration for guix home --- oni/home/services/unclutter.scm | 81 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 oni/home/services/unclutter.scm (limited to 'oni/home/services') diff --git a/oni/home/services/unclutter.scm b/oni/home/services/unclutter.scm new file mode 100644 index 0000000..2230673 --- /dev/null +++ b/oni/home/services/unclutter.scm @@ -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."))) -- cgit v1.2.3-54-g00ecf