aboutsummaryrefslogtreecommitdiffstats
path: root/oni
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-04-05 21:47:45 -0700
committerGravatar Tom Willemse2022-04-05 21:47:45 -0700
commit8d5eb70a195fc6c5348796d25b3d2bcbfada85cc (patch)
tree91e29c01ae1b4e84aa9ed81b2a1db16d1deec12c /oni
parent67c4a901a3f861522d4efa27d0e8ead958f29a6b (diff)
downloadnew-dotfiles-8d5eb70a195fc6c5348796d25b3d2bcbfada85cc.tar.gz
new-dotfiles-8d5eb70a195fc6c5348796d25b3d2bcbfada85cc.zip
Add configuration for picom
Diffstat (limited to 'oni')
-rw-r--r--oni/home/data/config.scm17
-rw-r--r--oni/home/services/compton.scm137
2 files changed, 152 insertions, 2 deletions
diff --git a/oni/home/data/config.scm b/oni/home/data/config.scm
index b95d03e..7f47da0 100644
--- a/oni/home/data/config.scm
+++ b/oni/home/data/config.scm
@@ -11,7 +11,8 @@
#:use-module (oni home services xdisorg)
#:use-module (oni home services xmodmap)
#:use-module (oni home services kitty)
- #:use-module (oni home services xsession))
+ #:use-module (oni home services xsession)
+ #:use-module (oni home services compton))
(home-environment
(packages (list (specification->package+output "glibc-locales")
@@ -218,4 +219,16 @@
"xrdb -cpp m4 -merge \"${HOME}/.config/X11/Xresources\" -I\"${HOME}/.config/X11/Xresources.d\""
"xrandr --setprovideroutputsource modesetting NVIDIA-0"
"xrandr --auto"
- "xrandr --dpi 96")))))))
+ "xrandr --dpi 96"))))
+
+ (service home-picom-service-type
+ (home-picom-configuration
+ (config
+ '((detect-transient . #t)
+ (shadow . #t)
+ (wintypes ((dnd ((shadow . #f)))
+ (dock ((shadow . #f)))))
+ (shadow-radius . 10)
+ (shadow-exclude ("name = 'mowedline'"
+ "class_g = 'trayer'"
+ "bounding_shaped")))))))))
diff --git a/oni/home/services/compton.scm b/oni/home/services/compton.scm
new file mode 100644
index 0000000..6e354fa
--- /dev/null
+++ b/oni/home/services/compton.scm
@@ -0,0 +1,137 @@
+(define-module (oni home services compton)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu packages compton)
+ #:use-module (gnu services xorg)
+ #: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)
+ #:use-module (guix records)
+ #:use-module (guix i18n)
+ #:use-module (guix modules)
+ #:use-module (guix diagnostics)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+
+ #:export (home-picom-service-type
+ home-picom-configuration))
+
+;;; This module has been copied from
+;;; https://github.com/nouun/jayu/blob/92ff6629da686f0ddc96a4d6cb2a657c76795bc6/jayu/home/services/xdisorg.scm
+;;; With some slight modifications to make my configuration work.
+
+(define-configuration/no-serialization home-picom-configuration
+ (package
+ (package picom)
+ "Package to use for setting Picom")
+ (config
+ (alist '())
+ ""))
+
+(define (format-picom-list vals depth)
+ (if (not (eq? vals '()))
+ (let ((is-pair? (pair? (car vals))))
+ (string-append
+ (if is-pair? "{" "[")
+ "\n "
+ (string-join
+ (map (lambda (val)
+ (if (pair? val)
+ (string-append
+ (maybe-object->string (car val))
+ " = " (format-picom-value (cdr val) (+ depth 1))
+ (if (> depth 0) "," ";"))
+ (format-picom-value val (+ depth 1))))
+ vals)
+ (string-append
+ (if is-pair? "" ",")
+ "\n "))
+ "\n"
+ (if is-pair? "}" "]")))
+ "[]"))
+
+(define (format-picom-value val depth)
+ (cond
+ ((list? val)
+ (format-picom-list (car val) (+ depth 1)))
+ ((pair? val)
+ (format-picom-value `(,(car val)) (+ depth 1)))
+ ((boolean? val)
+ (if val "true" "false"))
+ ((or (symbol? val) (number? val))
+ (maybe-object->string val))
+ ((string? val)
+ (string-append "\"" val "\""))
+ (else val)))
+
+(define (format-picom-config key val)
+ (list (string-append (maybe-object->string key)
+ " = "
+ (format-picom-value val 0)
+ ";\n")))
+
+(define (serialize-picom-config config)
+ (generic-serialize-alist append format-picom-config config))
+
+(define (home-picom-config-file config)
+ (apply mixed-text-file
+ "picom.conf"
+ (serialize-picom-config
+ (home-picom-configuration-config config))))
+
+(define (home-picom-files-service config)
+ `(("config/picom/picom.conf"
+ ,(home-picom-config-file config))))
+
+(define (home-picom-profile-service config)
+ (list (home-picom-configuration-package config)))
+
+(define (home-picom-shepherd-service config)
+ (list
+ (shepherd-service
+ (documentation "Start Picom")
+ (provision '(picom))
+ ;; TODO: Figure out how to start when x starts
+ ;(requirement '(xorg-server))
+ (auto-start? #t)
+ (start
+ #~(make-system-constructor
+ (string-join
+ (list #$(file-append (home-picom-configuration-package config) "/bin/picom")
+ "--config" #$(home-picom-config-file config)
+ "-b"))))
+ (stop #~(make-kill-destructor)))))
+
+(define (home-picom-extension old-config extension-configs)
+ (match old-config
+ (($ <home-picom-configuration> _ package* config*)
+ (home-picom-configuration
+ (package package*)
+ (config (append config*
+ (append-map home-picom-configuration-config
+ extension-configs)))))))
+
+(define home-picom-service-type
+ (service-type (name 'home-picom)
+ (extensions
+ (list (service-extension
+ home-files-service-type
+ home-picom-files-service)
+ (service-extension
+ home-profile-service-type
+ home-picom-profile-service)
+ (service-extension
+ home-shepherd-service-type
+ home-picom-shepherd-service)))
+ (compose concatenate)
+ (extend home-picom-extension)
+ (default-value (home-picom-configuration))
+ (description "Configure Picom")))
+
+(define (generate-home-picom-documentation)
+ (generate-documentation
+ `((home-picom-configuration
+ ,home-picom-configuration-fields))
+ 'home-picom-configuration))