Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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);
}