treewide: partially apply mkTarget

Uses the mkTarget function for Alacritty and Hyprland Home Manager targets
This commit is contained in:
Flameopathic 2025-05-21 09:43:42 -04:00
parent c4fa684471
commit 7c66eda89e
2 changed files with 76 additions and 73 deletions

View file

@ -1,26 +1,16 @@
# Documentation is available at:
# - https://alacritty.org/config-alacritty.html
# - `man 5 alacritty`
{ config, lib, ... }:
let
colors = config.lib.stylix.colors.withHashtag;
in
{
options.stylix.targets.alacritty.enable =
config.lib.stylix.mkEnableTarget "Alacritty" true;
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.alacritty.enable)
{ config, mkTarget, ... }:
mkTarget {
name = "alacritty";
humanName = "Alacritty";
configElements = [
(
{ colors }:
with colors.withHashtag;
{
programs.alacritty.settings = {
font = with config.stylix.fonts; {
normal = {
family = monospace.name;
style = "Regular";
};
size = sizes.terminal;
};
window.opacity = config.stylix.opacity.terminal;
colors = with colors; {
primary = {
@ -60,5 +50,25 @@ in
};
};
};
};
}
)
(
{ fonts }:
{
programs.alacritty.settings.font = {
normal = {
family = fonts.monospace.name;
style = "Regular";
};
size = fonts.sizes.terminal;
};
}
)
(
{ opacity }:
{
programs.alacritty.settings.window.opacity = config.stylix.opacity.terminal;
}
)
];
}

View file

@ -1,59 +1,52 @@
{ config, lib, ... }:
{
options.stylix.targets.hyprland = {
enable = config.lib.stylix.mkEnableTarget "Hyprland" true;
hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" (
config.stylix.image != null
);
};
config =
let
cfg = config.stylix.targets.hyprland;
in
lib.mkIf
(
config.stylix.enable
&& cfg.enable
&& config.wayland.windowManager.hyprland.enable
)
(
lib.mkMerge [
config,
lib,
mkTarget,
...
}:
mkTarget {
name = "hyprland";
humanName = "Hyprland";
extraOptions.hyprpaper.enable = config.lib.stylix.mkEnableTarget "Hyprpaper" (
config.stylix.image != null
);
configElements = [
(
{ colors }:
{
wayland.windowManager.hyprland.settings =
let
rgb = color: "rgb(${color})";
rgba = color: alpha: "rgba(${color}${alpha})";
in
{
wayland.windowManager.hyprland.settings =
let
inherit (config.lib.stylix) colors;
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;
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;
groupbar = {
text_color = rgb colors.base05;
"col.active" = rgb colors.base0D;
"col.inactive" = rgb colors.base03;
};
}
(lib.mkIf cfg.hyprpaper.enable {
services.hyprpaper.enable = true;
stylix.targets.hyprpaper.enable = true;
wayland.windowManager.hyprland.settings.misc.disable_hyprland_logo = true;
})
]
);
};
misc.background_color = rgb colors.base00;
};
}
)
(
{ cfg }:
(lib.mkIf cfg.hyprpaper.enable {
services.hyprpaper.enable = true;
stylix.targets.hyprpaper.enable = true;
wayland.windowManager.hyprland.settings.misc.disable_hyprland_logo = true;
})
)
];
}