Skip to content

Commit

Permalink
feat(home-manager/waybar): add prependImport & createLink options
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichthagel committed Apr 22, 2024
1 parent b9156bc commit 29699c8
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions modules/home-manager/waybar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,33 @@ let
enable = cfg.enable && config.programs.waybar.enable;
in
{
options.programs.waybar.catppuccin = lib.ctp.mkCatppuccinOpt "waybar";
options.programs.waybar.catppuccin = (lib.ctp.mkCatppuccinOpt "waybar") // {
styleFile = lib.mkOption {
type = lib.types.path;
default = "${sources.waybar}/themes/${cfg.flavour}.css";
description = "Path to CSS file containing color variable definitions";
};

config.programs.waybar = lib.mkIf enable {
style = lib.mkBefore ''
@import "${sources.waybar}/themes/${cfg.flavour}.css";
'';
prependImport = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to prepend `@import \"$${styleFile}\";` when `programs.waybar.style` is set to a string.";
};

createLink = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to create a symlink `~/.config/waybar/catppuccin.css` pointing to `styleFile`.";
};
};

config = lib.mkIf enable {
programs.waybar.style = lib.mkIf cfg.prependImport (
lib.mkBefore ''
@import "${cfg.styleFile}";
''
);

xdg.configFile."waybar/catppuccin.css" = lib.mkIf cfg.createLink { source = cfg.styleFile; };
};
}

0 comments on commit 29699c8

Please sign in to comment.