Files
Nomarchy/modules/home/swaync.nix
Bernardo Magri d6b5b344fa
All checks were successful
Check / eval (push) Successful in 3m0s
feat(desktop): complete theme UI review
2026-07-08 22:37:25 +01:00

100 lines
2.9 KiB
Nix

# swaync — notification daemon + control centre, themed from
# theme-state.json. Until this shipped, nothing rendered notify-send at
# all: the theme-switch progress toasts, the CLI's font warnings and the
# live ISO's welcome message were all invisible.
{ config, lib, ... }:
let
cfg = config.nomarchy;
t = cfg.theme;
c = t.colors;
r = toString t.ui.rounding;
in
{
config = lib.mkIf cfg.swaync.enable {
services.swaync = {
enable = true;
settings = {
positionX = "right";
positionY = "top";
control-center-margin-top = t.ui.gapsOut;
control-center-margin-right = t.ui.gapsOut;
control-center-width = 420;
notification-window-width = 400;
notification-icon-size = 48;
timeout = 6;
timeout-low = 3;
timeout-critical = 0; # critical stays until dismissed
};
style = ''
/* Palette baked from theme-state.json. Only roles guaranteed to
contrast @base in EVERY palette are used: subtext/surface mean
"on-surface" in some light themes (summer-day: subtext==base,
surface==text body text was invisible on hardware, item 25).
Chips/hovers are alpha(@text) tints contrast by construction.
tools/check-theme-contrast.py guards the hex-on-hex pairings. */
@define-color base ${c.base};
@define-color text ${c.text};
@define-color accent ${c.accent};
@define-color bad ${c.bad};
.notification {
background: alpha(@base, 0.95);
border: ${toString t.ui.borderSize}px solid alpha(@accent, 0.4);
border-radius: ${r}px;
color: @text;
font-family: "${t.fonts.ui}", "${t.fonts.mono}";
font-size: ${toString t.fonts.size}pt;
}
.notification-content .summary {
color: @text;
font-weight: bold;
}
.notification-content .body {
color: @text;
}
.notification.critical {
border-color: @bad;
}
.control-center {
background: alpha(@base, 0.95);
border: ${toString t.ui.borderSize}px solid alpha(@accent, 0.4);
border-radius: ${r}px;
color: @text;
font-family: "${t.fonts.ui}", "${t.fonts.mono}";
font-size: ${toString t.fonts.size}pt;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
background: alpha(@text, 0.1);
border-radius: ${r}px;
}
.widget-title {
color: @text;
font-weight: bold;
}
.widget-title > button {
background: alpha(@text, 0.1);
color: @text;
border: none;
border-radius: ${r}px;
}
.widget-title > button:hover {
background: @accent;
color: @base;
}
'';
};
};
}