-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(home-manager): add support for waybar (#133)
* feat(home-manager): add support for waybar * feat(home-manager/waybar): add prependImport & createLink options * fix(home-manager/waybar): inline styleFile * fix(home-manager/waybar): make prependImport and createLink mutually exclusive * feat(home-manager/waybar): warn if prependImport has no effect * style(waybar): use mkMerge * fix(waybar): update description for mode option * refactor(home-manager/waybar): remove warning
- Loading branch information
1 parent
f46dffa
commit 2788bec
Showing
5 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ config | ||
, options | ||
, lib | ||
, sources | ||
, ... | ||
}: | ||
let | ||
cfg = config.programs.waybar.catppuccin; | ||
enable = cfg.enable && config.programs.waybar.enable; | ||
styleFile = "${sources.waybar}/themes/${cfg.flavour}.css"; | ||
in | ||
{ | ||
options.programs.waybar.catppuccin = (lib.ctp.mkCatppuccinOpt "waybar") // { | ||
mode = lib.mkOption { | ||
type = lib.types.enum [ | ||
"prependImport" | ||
"createLink" | ||
]; | ||
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). | ||
- `createLink`: Creates a symbolic link `~/.config/waybar/catppuccin.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}"; | ||
''; | ||
}) | ||
(lib.mkIf (cfg.mode == "createLink") { | ||
xdg.configFile."waybar/catppuccin.css".source = styleFile; | ||
}) | ||
] | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters