nixos/users/malte/mako.nix

86 lines
2.2 KiB
Nix

{
pkgs,
config,
...
}: let
colDark = name: "#${config.colorsDark.colors.${name}}";
doNotDisturb = pkgs.callPackage ../../pkgs/do-not-disturb.nix {};
in {
services.mako = {
enable = true;
anchor = "top-right";
font = "Hack NF FC Ligatured 11";
backgroundColor = colDark "base05";
textColor = colDark "base00";
borderColor = colDark "base00";
borderSize = 1;
borderRadius = 3;
defaultTimeout = 4000;
width = 400;
height = 500;
format = ''
<span color='${colDark "base01"}'><i>%a</i></span>\n<b>%s</b> %b'';
layer = "overlay";
margin = "5";
padding = "6";
extraConfig = ''
outer-margin=0
[urgency=low]
default-timeout=3000
background-color=${colDark "base04"}
[urgency=normal]
background-color=${colDark "base0E"}
[urgency=high]
default-timeout=10000
background-color=${colDark "base08"}
[actionable]
format=<span color="${colDark "base0D"}"><i>%a</i></span> \n<b>%s</b> %b
[hidden]
background-color=${colDark "base04"}
format=... %h more
[mode=do-not-disturb]
invisible=1
[app-name=fish urgency=normal]
background-color=${colDark "base0B"}
format= <b>%s</b>\n%b
[app-name=fish urgency=critical]
background-color=${colDark "base08"}
format= <b>%s</b>\n%b
'';
};
# This should really use the upstream service file, but I'm too lazy
# https://github.com/emersion/mako/blob/aafbc91da038e5a6ebab67a66a644487db3410d7/contrib/systemd/mako.service
systemd.user.services."mako" = {
Unit = {
Description = "Lightweight Wayland notification daemon";
Documentation = "man:mako(1)";
After = "graphical-session.target";
BindsTo = "graphical-session.target";
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecCondition = "/bin/sh -c '[ -n \"$WAYLAND_DISPLAY\" ]'";
ExecStart = "${pkgs.mako}/bin/mako";
ExecReload = "${pkgs.mako}/bin/makoctl reload";
Restart = "always";
};
Install = {WantedBy = ["graphical-session.target"];};
};
home.packages = [
pkgs.hackNerdLigatures
doNotDisturb
];
}