Skip to content

Commit

Permalink
hyprland: add hyprpaper.enable option and improve code (#501)
Browse files Browse the repository at this point in the history
Link: #501

Approved-by: Daniel Thwaites <[email protected]>
  • Loading branch information
trueNAHO authored Dec 6, 2024
2 parents eb918db + c6547e2 commit e309d64
Showing 1 changed file with 48 additions and 34 deletions.
82 changes: 48 additions & 34 deletions modules/hyprland/hm.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
{ config, lib, ... }:

with config.lib.stylix.colors;
{
options.stylix.targets.hyprland = {
enable = config.lib.stylix.mkEnableTarget "Hyprland" true;
hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" true;
};

let
rgb = color: "rgb(${color})";
rgba = color: alpha: "rgba(${color}${alpha})";
config = let
cfg = config.stylix.targets.hyprland;
in
lib.mkIf
(
config.stylix.enable
&& cfg.enable
&& config.wayland.windowManager.hyprland.enable
)
(
lib.mkMerge [
{
wayland.windowManager.hyprland.settings = let
inherit (config.lib.stylix) colors;

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;
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 base05;
"col.active" = rgb base0D;
"col.inactive" = rgb base03;
};
};
misc.background_color = rgb base00;
};
groupbar = {
text_color = rgb colors.base05;
"col.active" = rgb colors.base0D;
"col.inactive" = rgb colors.base03;
};
};
misc.background_color = rgb colors.base00;
};
}

in {
options.stylix.targets.hyprland.enable =
config.lib.stylix.mkEnableTarget "Hyprland" true;

config =
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;
};
(
lib.mkIf cfg.hyprpaper.enable {
services.hyprpaper.enable = true;
stylix.targets.hyprpaper.enable = true;
}
)
]
);
}

0 comments on commit e309d64

Please sign in to comment.