feat(waybar): Catpuccin -> Rose Pine

This commit is contained in:
punkfairie 2024-10-20 13:22:20 -07:00
parent 782ae10718
commit 6c4555e06d
Signed by: punkfairie
GPG key ID: 01823C057725C266
2 changed files with 38 additions and 26 deletions

View file

@ -352,13 +352,13 @@
"type": "Git", "type": "Git",
"repository": { "repository": {
"type": "GitHub", "type": "GitHub",
"owner": "catppuccin", "owner": "rose-pine",
"repo": "waybar" "repo": "waybar"
}, },
"branch": "main", "branch": "main",
"revision": "ee8ed32b4f63e9c417249c109818dcc05a2e25da", "revision": "1b118bd60d1c5778dc8a82b919069eeb8a834604",
"url": "https://github.com/catppuccin/waybar/archive/ee8ed32b4f63e9c417249c109818dcc05a2e25da.tar.gz", "url": "https://github.com/rose-pine/waybar/archive/1b118bd60d1c5778dc8a82b919069eeb8a834604.tar.gz",
"hash": "0q4mzqx3w6cywfifs7ij8qzhzvj59dfdzpvqx76vpnhd2zm35bfd" "hash": "0yl8yjcdkq9442g31zl9ckkh99p9hnmq60ap3f91q7bwx5x5rg66"
}, },
"yazi": { "yazi": {
"type": "Git", "type": "Git",
@ -398,4 +398,4 @@
} }
}, },
"version": 3 "version": 3
} }

View file

@ -1,26 +1,36 @@
{ config, lib, ... }:
let
inherit (config.catppuccin) sources;
cfg = config.programs.waybar.catppuccin;
enable = cfg.enable && config.programs.waybar.enable;
styleFile = "${sources.waybar}/themes/${cfg.flavor}.css";
in
{ {
options.programs.waybar.catppuccin = lib.ctp.mkCatppuccinOpt { name = "waybar"; } // { config,
mode = lib.mkOption { lib,
type = lib.types.enum [ ...
"prependImport" }: let
"createLink" inherit (config.rose-pine) sources;
];
default = "prependImport";
description = ''
Defines how to include the catppuccin theme css file:
- `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority). cfg = config.programs.waybar.rose-pine;
- `createLink`: Creates a symbolic link `~/.config/waybar/catppuccin.css`, which needs to be included in the waybar stylesheet. enable = cfg.enable && config.programs.waybar.enable;
'';
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 ( config = lib.mkIf enable (
lib.mkMerge [ lib.mkMerge [
@ -29,7 +39,9 @@ in
@import "${styleFile}"; @import "${styleFile}";
''; '';
}) })
(lib.mkIf (cfg.mode == "createLink") { xdg.configFile."waybar/catppuccin.css".source = styleFile; }) (lib.mkIf (cfg.mode == "createLink") {
xdg.configFile."waybar/rose-pine.css".source = styleFile;
})
] ]
); );
} }