Files
samfelag/modules/desktop/tools/swaync.nix
T
2026-11-09 11:24:43 +01:00

134 lines
3.2 KiB
Nix

{ inputs, config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.desktop.tools.swaync;
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in {
options.samfelag.modules.desktop.tools.swaync = with lib; {
enable = mkEnableOption "Sway Notification Center";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
libnotify
swaynotificationcenter
];
hm.services.swaync = {
enable = true;
settings = {
widgets = [
"title"
"dnd"
"notifications"
];
widget-config = {
dnd = {
text = "Silence";
};
title = {
text = "Notifications";
clear-all-button = true;
button-text = "󰆴";
};
};
};
style = ''
* {
font-family: Iosevka;
color: #${config.colorScheme.palette.base05};
}
.notification {
border-width: 2px;
padding: 2px 4px;
background-color: #${config.colorScheme.palette.base00};
color: #${config.colorScheme.palette.base05};
}
.notification-content {
background-color: inherit;
color: inherit;
}
.critical.notification {
background-color: #${config.colorScheme.palette.base0C};
}
.image {
margin: 5px;
padding-right: 5px;
}
.control-center {
margin: 30px;
margin-left: 0px;
border-radius: 10px;
border: solid #${config.colorScheme.palette.base05} 1px;
background-color: #${config.colorScheme.palette.base01};
color: #${config.colorScheme.palette.base05};
opacity: 0.95;
}
.control-center-clear-all {
background: #${config.colorScheme.palette.base02};
}
.control-center-dnd:checked {
background: #${config.colorScheme.palette.base08};
}
.close-button {
background: #${config.colorScheme.palette.base08};
}
.notification-group-collapse-button {
margin: 4px;
box-shadow: none;
background: #${config.colorScheme.palette.base0A};
}
.notification-group-close-all-button {
margin: 4px;
box-shadow: none;
background: #${config.colorScheme.palette.base08};
}
'';
};
# - Execute on startup -----------------------
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
exec-once = [
"swaync"
];
layerrule = [
{
name = "animate-swaync-control-center";
match = {
namespace = "swaync-control-center";
};
animation = "slide top";
}
{
name = "animate-swaync-notification-window";
match = {
namespace = "swaync-notification-window";
};
animation = "slide top";
}
];
bind = [
# Notification center
"${hyprCfg.mod}, n, exec, swaync-client -t -sw"
];
};
};
}