From 6e39b312c8779ad7031f10017424fce38ea96dd2 Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Sun, 14 Apr 2024 11:29:17 +0200 Subject: [PATCH] feat(home-manager): allow dark and light accents for gtk cursors --- modules/home-manager/gtk.nix | 4 +++- modules/lib/default.nix | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index 0bad6fc0..27f0a8fe 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -7,6 +7,8 @@ let inherit (lib) ctp mkOption types; cfg = config.gtk.catppuccin; enable = cfg.enable && config.gtk.enable; + # "dark" and "light" can be used alongside the regular accents + cursorAccentType = ctp.mergeEnums (ctp.types.accentOption) (lib.types.enum [ "dark" "light" ]); in { options.gtk.catppuccin = @@ -26,7 +28,7 @@ in cursor = ctp.mkCatppuccinOpt "gtk cursors" // { - accent = ctp.mkAccentOpt "gtk cursors"; + accent = ctp.mkBasicOpt "accent" cursorAccentType "gtk cursors"; }; }; diff --git a/modules/lib/default.nix b/modules/lib/default.nix index 272ce9f8..235a2f06 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -100,4 +100,9 @@ in assertion = config.xdg.enable; message = "Option xdg.enable must be enabled to apply Catppuccin theming for ${name}"; }; + + # see https://nlewo.github.io/nixos-manual-sphinx/development/option-types.xml.html + # by default enums cannot be merged, but they keep their passed value in `functor.payload`. + # `functor.binOp` can merge those values + mergeEnums = a: b: lib.types.enum (a.functor.binOp a.functor.payload b.functor.payload); }