nixos-config/users/simon/modules/sway/swaync.nix

147 lines
3.3 KiB
Nix

{ lib, pkgs, ... }:
let
inherit ((import ../common.nix).colorschemes) solarized;
in
{
systemd.user.services.swaync = {
Unit.PartOf = [ "sway-session.target" ];
Install.WantedBy = [ "sway-session.target" ];
Service = {
# FIXME: use new version (currently system style discovery fails)
ExecStart = "${pkgs._2205.swaynotificationcenter}/bin/swaync";
Restart = "on-failure";
};
};
xdg.configFile = {
"swaync/config.json".text = lib.generators.toJSON { } {
positionX = "right";
positionY = "top";
timeout = 10;
timeout-low = 5;
timeout-critical = 0;
notification-window-width = 480;
fit-to-screen = false;
keyboard-shortcuts = true;
image-visibility = "when-available";
transition-time = 0;
hide-on-clear = true;
hide-on-action = true;
};
"swaync/style.css".text = lib.concatStrings (lib.attrsets.mapAttrsToList (k: v: "@define-color ${k} ${v};\n") solarized) + /* less */ ''
.control-center {
background-color: @base03;
color: #839496;
}
/* if the font is only set for .control-center, notifications do not use it */
window {
font-family: "monospace";
}
.control-center-list {
background: transparent;
}
.control-center-clear-all {
color: @base0;
text-shadow: none;
background: @base03;
box-shadow: none;
border-radius: 0px;
border: 2px solid @base02;
}
.control-center-dnd {
border-radius: 0px;
border: none;
box-shadow: none;
background-color: @base02;
}
.control-center-dnd:checked {
background: @green;
}
.control-center-dnd slider {
background: @base0;
border-radius: 0px;
border: 2px solid @base02;
box-shadow: none;
}
.control-center-dnd slider:checked {
background: @green;
}
.floating-notifications {
background: transparent;
}
.notification-row {
outline: none;
}
.notification {
border-radius: 0px;
box-shadow: none;
margin: 3px 6px;
padding: 0;
}
.notification:first-child {
margin-top: 6px;
}
.low .summary {
color: @base00;
}
.critical .summary {
color: @red;
}
.notification-content {
padding: 6px;
border-radius: 0px;
}
/* hide close button (clicking on the notification does the same) */
.close-button {
opacity: 0;
}
.notification-default-action,
.notification-action {
padding: 4px;
margin: 0;
box-shadow: none;
background: @base03;
border: 2px solid @base02;
border-radius: 0px;
}
.notification-action {
color: @base0;
box-shadow: none;
text-shadow: none;
border-right: none;
border-top: none;
}
/* re-add right border to last action */
.notification-action:last-child {
border-right: 2px solid @base02;
}
.body-image {
margin-top: 6px;
background-color: @base0;
}
.summary,
.time,
.body,
.top-action-title {
color: @base0;
text-shadow: none;
}
'';
};
}