diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index c0cebbf3..d6f4fcd9 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -1,8 +1,7 @@ -{ - config, - lib, - sources, - ... +{ config +, lib +, sources +, ... }: let cfg = config.programs.waybar.catppuccin; @@ -10,16 +9,13 @@ let in { options.programs.waybar.catppuccin = (lib.ctp.mkCatppuccinOpt "waybar") // { - 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`."; + mode = lib.mkOption { + type = lib.types.enum [ + "prependImport" + "createLink" + ]; + default = "prependImport"; + description = "Whether to prepend an `@import` (requires that `programs.waybar.style` is set to a string) or to create a symlink `~/.config/waybar/catppuccin.css` (requires you to import manually)."; }; }; @@ -28,13 +24,15 @@ in styleFile = "${sources.waybar}/themes/${cfg.flavour}.css"; in { - programs.waybar.style = lib.mkIf cfg.prependImport ( + programs.waybar.style = lib.mkIf (cfg.mode == "prependImport") ( lib.mkBefore '' @import "${styleFile}"; '' ); - xdg.configFile."waybar/catppuccin.css" = lib.mkIf cfg.createLink { source = styleFile; }; + xdg.configFile."waybar/catppuccin.css" = lib.mkIf (cfg.mode == "createLink") { + source = styleFile; + }; } ); }