Skip to content

Commit

Permalink
feat(home-manager): allow dark and light accents for gtk cursors (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
PerchunPak authored Apr 18, 2024
1 parent b87e5ee commit 4f5d429
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/home-manager/gtk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -26,7 +28,7 @@ in

cursor = ctp.mkCatppuccinOpt "gtk cursors"
// {
accent = ctp.mkAccentOpt "gtk cursors";
accent = ctp.mkBasicOpt "accent" cursorAccentType "gtk cursors";
};
};

Expand Down
5 changes: 5 additions & 0 deletions modules/lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 4f5d429

Please sign in to comment.