feat(home-manager): allow dark and light accents for gtk cursors (#116)

This commit is contained in:
Perchun Pak 2024-04-18 22:10:23 +02:00 committed by GitHub
parent b87e5ee889
commit 4f5d42994c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -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";
};
};

View file

@ -119,4 +119,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);
}