rose-pine-nix/modules/home-manager/waybar.nix

48 lines
1.3 KiB
Nix
Raw Normal View History

{
2024-10-20 13:22:20 -07:00
config,
lib,
...
}: let
inherit (config.rose-pine) sources;
cfg = config.programs.waybar.rose-pine;
enable = cfg.enable && config.programs.waybar.enable;
2024-10-20 13:22:20 -07:00
themeName =
if (cfg.flavor == "main")
then "rose-pine"
else "rose-pine-${cfg.flavor}";
styleFile = "${sources.waybar}/${themeName}.css";
in {
options.programs.waybar.rose-pine =
lib.rp.mkRosePineOpt {name = "waybar";}
// {
mode = lib.mkOption {
type = lib.types.enum [
"prependImport"
"createLink"
];
default = "prependImport";
description = ''
Defines how to include the Rosé Pine theme css file:
- `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority).
- `createLink`: Creates a symbolic link `~/.config/waybar/rose-pine.css`, which needs to be included in the waybar stylesheet.
'';
};
};
config = lib.mkIf enable (
lib.mkMerge [
(lib.mkIf (cfg.mode == "prependImport") {
programs.waybar.style = lib.mkBefore ''
@import "${styleFile}";
'';
})
2024-10-20 13:22:20 -07:00
(lib.mkIf (cfg.mode == "createLink") {
xdg.configFile."waybar/rose-pine.css".source = styleFile;
})
]
);
}