waybar: add addCss option (#804)
Closes: https://github.com/danth/stylix/issues/429 Link: https://github.com/danth/stylix/pull/804 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
6103431cd2
commit
e81bd0cffa
1 changed files with 51 additions and 44 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
with config.lib.stylix.colors.withHashtag;
|
with config.lib.stylix.colors.withHashtag;
|
||||||
with config.stylix.fonts;
|
with config.stylix.fonts;
|
||||||
let
|
let
|
||||||
|
cfg = config.style.targets.waybar;
|
||||||
colorlessModules = place: ''
|
colorlessModules = place: ''
|
||||||
.modules-${place} #workspaces button {
|
.modules-${place} #workspaces button {
|
||||||
border-bottom: 3px solid transparent;
|
border-bottom: 3px solid transparent;
|
||||||
|
|
@ -15,6 +16,11 @@ in
|
||||||
{
|
{
|
||||||
options.stylix.targets.waybar = {
|
options.stylix.targets.waybar = {
|
||||||
enable = config.lib.stylix.mkEnableTarget "Waybar" true;
|
enable = config.lib.stylix.mkEnableTarget "Waybar" true;
|
||||||
|
addCss = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "adds fully functional css (otherwise just adds colors and fonts)";
|
||||||
|
};
|
||||||
enableLeftBackColors = lib.mkOption {
|
enableLeftBackColors = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
@ -32,51 +38,52 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = lib.mkIf (config.stylix.enable && cfg.enable) {
|
||||||
lib.mkIf (config.stylix.enable && config.stylix.targets.waybar.enable)
|
programs.waybar.style =
|
||||||
{
|
''
|
||||||
programs.waybar.style =
|
@define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03};
|
||||||
''
|
@define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07};
|
||||||
@define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03};
|
|
||||||
@define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07};
|
|
||||||
|
|
||||||
@define-color base08 ${base08}; @define-color base09 ${base09}; @define-color base0A ${base0A}; @define-color base0B ${base0B};
|
@define-color base08 ${base08}; @define-color base09 ${base09}; @define-color base0A ${base0A}; @define-color base0B ${base0B};
|
||||||
@define-color base0C ${base0C}; @define-color base0D ${base0D}; @define-color base0E ${base0E}; @define-color base0F ${base0F};
|
@define-color base0C ${base0C}; @define-color base0D ${base0D}; @define-color base0E ${base0E}; @define-color base0F ${base0F};
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family: "${sansSerif.name}";
|
font-family: "${sansSerif.name}";
|
||||||
font-size: ${builtins.toString sizes.desktop}pt;
|
font-size: ${builtins.toString sizes.desktop}pt;
|
||||||
}
|
}
|
||||||
|
''
|
||||||
|
+ lib.optionalString cfg.addCss (
|
||||||
|
''
|
||||||
|
window#waybar, tooltip {
|
||||||
|
background: alpha(@base00, ${
|
||||||
|
with config.stylix.opacity; builtins.toString desktop
|
||||||
|
});
|
||||||
|
color: @base05;
|
||||||
|
}
|
||||||
|
|
||||||
window#waybar, tooltip {
|
tooltip {
|
||||||
background: alpha(@base00, ${
|
border-color: @base0D;
|
||||||
with config.stylix.opacity; builtins.toString desktop
|
}
|
||||||
});
|
''
|
||||||
color: @base05;
|
+ (builtins.readFile ./base.css)
|
||||||
}
|
+ (
|
||||||
|
if cfg.enableLeftBackColors then
|
||||||
tooltip {
|
(import ./colors.nix "left")
|
||||||
border-color: @base0D;
|
else
|
||||||
}
|
colorlessModules "left"
|
||||||
''
|
)
|
||||||
+ (builtins.readFile ./base.css)
|
+ (
|
||||||
+ (
|
if cfg.enableCenterBackColors then
|
||||||
if config.stylix.targets.waybar.enableLeftBackColors then
|
(import ./colors.nix "center")
|
||||||
(import ./colors.nix "left")
|
else
|
||||||
else
|
colorlessModules "center"
|
||||||
colorlessModules "left"
|
)
|
||||||
)
|
+ (
|
||||||
+ (
|
if cfg.enableRightBackColors then
|
||||||
if config.stylix.targets.waybar.enableCenterBackColors then
|
(import ./colors.nix "right")
|
||||||
(import ./colors.nix "center")
|
else
|
||||||
else
|
colorlessModules "right"
|
||||||
colorlessModules "center"
|
)
|
||||||
)
|
);
|
||||||
+ (
|
};
|
||||||
if config.stylix.targets.waybar.enableRightBackColors then
|
|
||||||
(import ./colors.nix "right")
|
|
||||||
else
|
|
||||||
colorlessModules "right"
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue