hyprland: add hyprpaper.enable option and improve code (#501)

Link: https://github.com/danth/stylix/pull/501

Approved-by: Daniel Thwaites <danthwaites30@btinternet.com>
This commit is contained in:
NAHO 2024-12-06 19:41:16 +01:00 committed by GitHub
commit e309d64fe7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,41 +1,55 @@
{ config, lib, ... }:
with config.lib.stylix.colors;
let
rgb = color: "rgb(${color})";
rgba = color: alpha: "rgba(${color}${alpha})";
settings = {
decoration.shadow.color = rgba base00 "99";
general = {
"col.active_border" = rgb base0D;
"col.inactive_border" = rgb base03;
};
group = {
"col.border_inactive" = rgb base03;
"col.border_active" = rgb base0D;
"col.border_locked_active" = rgb base0C;
groupbar = {
text_color = rgb base05;
"col.active" = rgb base0D;
"col.inactive" = rgb base03;
};
};
misc.background_color = rgb base00;
{
options.stylix.targets.hyprland = {
enable = config.lib.stylix.mkEnableTarget "Hyprland" true;
hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" true;
};
in {
options.stylix.targets.hyprland.enable =
config.lib.stylix.mkEnableTarget "Hyprland" true;
config =
config = let
cfg = config.stylix.targets.hyprland;
in
lib.mkIf
(config.stylix.enable && config.stylix.targets.hyprland.enable && config.wayland.windowManager.hyprland.enable)
{
services.hyprpaper.enable = true;
stylix.targets.hyprpaper.enable = true;
wayland.windowManager.hyprland.settings = settings;
};
(
config.stylix.enable
&& cfg.enable
&& config.wayland.windowManager.hyprland.enable
)
(
lib.mkMerge [
{
wayland.windowManager.hyprland.settings = let
inherit (config.lib.stylix) colors;
rgb = color: "rgb(${color})";
rgba = color: alpha: "rgba(${color}${alpha})";
in {
decoration.shadow.color = rgba colors.base00 "99";
general = {
"col.active_border" = rgb colors.base0D;
"col.inactive_border" = rgb colors.base03;
};
group = {
"col.border_inactive" = rgb colors.base03;
"col.border_active" = rgb colors.base0D;
"col.border_locked_active" = rgb colors.base0C;
groupbar = {
text_color = rgb colors.base05;
"col.active" = rgb colors.base0D;
"col.inactive" = rgb colors.base03;
};
};
misc.background_color = rgb colors.base00;
};
}
(
lib.mkIf cfg.hyprpaper.enable {
services.hyprpaper.enable = true;
stylix.targets.hyprpaper.enable = true;
}
)
]
);
}