aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-06-16 19:09:43 -0700
committerGravatar Tom Willemse2022-06-16 19:10:01 -0700
commit5cd91c77e0240fe991128b82fe0e56b440e5185e (patch)
tree2893519fac6762a350d8e87814f388e50c42fc49 /oni/home/services
parent46259edd2d39e2513b77eea1b9ce83a2c5b826c7 (diff)
downloadnew-dotfiles-5cd91c77e0240fe991128b82fe0e56b440e5185e.tar.gz
new-dotfiles-5cd91c77e0240fe991128b82fe0e56b440e5185e.zip
Add unclutter configuration for guix home
Diffstat (limited to 'oni/home/services')
-rw-r--r--oni/home/services/unclutter.scm81
1 files changed, 81 insertions, 0 deletions
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.")))