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

fix(home-manager): link GTK 4.0 files #114

Merged
merged 5 commits into from
Apr 18, 2024
Merged
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
66 changes: 41 additions & 25 deletions modules/home-manager/gtk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,52 @@ in
};
};

config.gtk = lib.mkIf enable {
theme =
let
flavourUpper = ctp.mkUpper cfg.flavour;
accentUpper = ctp.mkUpper cfg.accent;
sizeUpper = ctp.mkUpper cfg.size;
config = lib.mkIf enable {
assertions = [
(lib.ctp.assertXdgEnabled "gtk")
];

# use the light gtk theme for latte
gtkTheme =
if cfg.flavour == "latte"
then "Light"
else "Dark";
in
{
name = "Catppuccin-${flavourUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
package = pkgs.catppuccin-gtk.override {
inherit (cfg) size tweaks;
accents = [ cfg.accent ];
variant = cfg.flavour;
gtk = {
theme =
let
flavourUpper = ctp.mkUpper cfg.flavour;
accentUpper = ctp.mkUpper cfg.accent;
sizeUpper = ctp.mkUpper cfg.size;

# use the light gtk theme for latte
gtkTheme =
if cfg.flavour == "latte"
then "Light"
else "Dark";
in
{
name = "Catppuccin-${flavourUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
package = pkgs.catppuccin-gtk.override {
inherit (cfg) size tweaks;
accents = [ cfg.accent ];
variant = cfg.flavour;
};
};
};

cursorTheme =
cursorTheme =
let
flavourUpper = ctp.mkUpper cfg.cursor.flavour;
accentUpper = ctp.mkUpper cfg.cursor.accent;
in
lib.mkIf cfg.cursor.enable {
name = "Catppuccin-${flavourUpper}-${accentUpper}-Cursors";
package = pkgs.catppuccin-cursors.${cfg.cursor.flavour + accentUpper};
};
};

xdg.configFile =
let
flavourUpper = ctp.mkUpper cfg.cursor.flavour;
accentUpper = ctp.mkUpper cfg.cursor.accent;
gtk4Dir = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0";
in
lib.mkIf cfg.cursor.enable {
name = "Catppuccin-${flavourUpper}-${accentUpper}-Cursors";
package = pkgs.catppuccin-cursors.${cfg.cursor.flavour + accentUpper};
{
"gtk-4.0/assets".source = "${gtk4Dir}/assets";
"gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css";
"gtk-4.0/gtk-dark.css".source = "${gtk4Dir}/gtk-dark.css";
};
};
}