Files
nixy/home/swaync/default.nix
T
Hadi 082de49ca4 init
Signed-off-by: Hadi <hadi@example.com>
2026-06-23 13:53:08 +02:00

332 lines
8.6 KiB
Nix

{ config, ... }: let
c = config.lib.stylix.colors;
font = config.stylix.fonts.sansSerif.name;
in {
services.swaync = {
enable = true;
settings = {
positionX = "right";
positionY = "top";
cssPriority = "user";
"control-center-width" = 450;
"fit-to-screen" = true;
"notification-window-width" = 400;
"notification-icon-size" = 40;
"notification-body-image-height" = 500;
"notification-body-image-width" = 500;
"notification-inline-replies" = true;
"notification-2fa-action" = false;
timeout = 3;
"timeout-low" = 2;
"timeout-critical" = 6;
"keyboard-shortcuts" = true;
"image-visibility" = "when-available";
"transition-time" = 200;
"hide-on-clear" = false;
"hide-on-action" = false;
"script-fail-notify" = true;
widgets = [ "mpris" "dnd" "buttons-grid" "notifications" ];
"widget-config" = {
dnd.text = "Do not disturb";
mpris = {
"image-size" = 100;
"image-radius" = 10;
autohide = false;
blacklist = [ "org.mpris.MediaPlayer2.playerctld" ];
};
"buttons-grid" = {
actions = [
{
label = "󰌪";
type = "toggle";
command = "powerprofilesctl set power-saver";
"update-command" = "powerprofilesctl get | grep -q power-saver && echo true || echo false";
}
{
label = "";
type = "toggle";
command = "wpctl set-mute @DEFAULT_SOURCE@ toggle";
"update-command" = "wpctl get-volume @DEFAULT_SOURCE@ | grep -q MUTED && echo true || echo false";
}
{
label = "";
command = "ghostty -- htop ; swaync-client -cp";
}
{
label = "";
command = "nwg-look ; swaync-client -cp";
}
{
label = "";
command = "swaync-client -cp ; hyprlock";
}
{
label = "";
command = "swaync-client -cp ; systemctl poweroff";
}
];
};
};
};
style = ''
@define-color center-bg #${c.base00}cc;
@define-color notification-bg #${c.base00}e5;
@define-color center-notification-bg #${c.base01};
@define-color background #${c.base00}e5;
@define-color background-alt #${c.base01};
@define-color text #${c.base05};
@define-color text-alt #${c.base03};
@define-color selected #${c.base03}66;
@define-color hover #${c.base03}28;
@define-color urgent #${c.base08};
* {
font-family: "${font}";
font-weight: 700;
all: unset;
--border-radius: 16px;
--border-radius-s: 8px;
--border-radius-xl: 18px;
--shadow: 2px 4px 10px rgba(0,0,0,0.15);
}
.notification { padding: 5px; }
.notification-background {
background: @notification-bg;
border-radius: var(--border-radius);
margin: 8px;
padding: 0;
}
.notification-background .close-button {
margin: 6px;
padding: 2px;
border-radius: 6px;
background: transparent;
color: @text;
}
.notification-background .close-button:hover { background: @hover; }
.notification.critical {
border: 2px solid @urgent;
border-radius: var(--border-radius);
}
.notification-content {
color: @text;
margin: 10px;
font-weight: 700;
}
.notification-content .text-box { margin: 0 0 0 15px; }
.notification-content .time {
padding: 2px;
font-size: 0.95rem;
font-weight: 800;
}
.notification-content .summary {
font-size: 1rem;
font-weight: 800;
padding: 2px 0;
margin-bottom: 2px;
}
.notification-content .body {
color: @text-alt;
font-size: 0.8rem;
}
.notification-row .inline-reply-entry,
.notification-row .inline-reply-button {
margin: 5px -5px -5px -5px;
padding: 10px 15px;
border-radius: var(--border-radius);
background: @background-alt;
}
.notification-row .inline-reply-entry { margin-right: 10px; }
.notification-row .inline-reply-button:hover { background: @selected; }
.notification-alt-actions { padding: 5px 0; }
.notification-action {
font-weight: 700;
border-radius: var(--border-radius);
background: @hover;
color: @text;
margin: 0 5px;
padding: 10px 0;
}
.notification-action:hover,
.notification-action:active { background: @selected; }
.control-center {
background: @center-bg;
border-radius: var(--border-radius);
margin: 5px;
padding: 5px 5px 0 5px;
}
.control-center .notification-background {
background: @center-notification-bg;
box-shadow: var(--shadow);
}
.control-center .notification-background .close-button,
.notification-group-close-button { opacity: 0; }
.notification-group { transition: 200ms; }
.notification-group:not(.collapsed) { margin: 8px; }
.notification-group-headers,
.notification-group-buttons {
color: @text;
font-weight: bold;
background: @background;
border-radius: var(--border-radius);
padding: 4px 8px;
}
.notification-group-headers > label {
margin: 0 3px;
font-size: 1rem;
}
.notification-group-icon { color: @text; }
.notification-group-buttons .image-button {
background: transparent;
color: @text;
padding: 4px;
border-radius: var(--border-radius);
}
.notification-group-buttons .image-button:hover { background: @hover; }
.widget {
margin: 5px;
color: @text;
}
.widget-mpris-album-art {
border-radius: var(--border-radius);
margin: 6px 4px;
}
.widget-mpris-title {
font-weight: 700;
font-size: 1.2rem;
margin: 0 3px;
}
.widget-mpris-subtitle {
color: @text-alt;
font-weight: 700;
font-size: 0.9rem;
margin: 0 3px;
}
.mpris-background { border-radius: 14px; margin: 3px; }
.widget-mpris {
border-radius: var(--border-radius);
box-shadow: var(--shadow);
}
.mpris-overlay {
border-radius: var(--border-radius);
padding: 10px;
background: @background;
}
.mpris-overlay > box:last-child {
border-radius: var(--border-radius-xl);
padding: 0 5px;
background: alpha(@hover, .6);
}
.widget-mpris-player button {
padding: 5px;
margin: 0 2.5px;
}
.widget-mpris-player button:hover {
border-radius: var(--border-radius-s);
background: @hover;
}
.widget-dnd {
padding: 10px 15px;
border-radius: var(--border-radius);
background: @background-alt;
box-shadow: var(--shadow);
color: @text;
}
.widget-dnd > label {
font-size: 1rem;
font-weight: 700;
}
.widget-dnd switch {
background: @hover;
border-radius: var(--border-radius-s);
box-shadow: none;
padding: 2px;
transition: 200ms;
}
.widget-dnd switch slider {
background: @text;
border-radius: var(--border-radius-s);
}
.widget-dnd switch:hover,
.widget-dnd switch:checked { background-color: @selected; }
.widget-notifications { margin: 0; }
.widget-buttons-grid {
border-radius: var(--border-radius);
padding: 5px 15px;
margin-bottom: 5px;
background: @background-alt;
box-shadow: var(--shadow);
}
.widget-buttons-grid button {
padding: 10px;
margin: 3px;
min-width: 2rem;
background: @hover;
border-radius: var(--border-radius);
transition: 200ms;
}
.widget-buttons-grid button > label {
font-family: "Maple Mono NF";
font-size: 16px;
color: @text;
}
.widget-buttons-grid button:hover { background: @selected; }
.widget-buttons-grid button:checked { background-color: @text; }
.widget-buttons-grid button:checked > label { color: @background; }
.control-center-list-placeholder { color: @text; }
.blank-window { background: transparent; }
'';
};
}