nixos-config/modules/services/dunst.nix

78 lines
2.2 KiB
Nix

#
# System notifications
#
{ config, lib, pkgs, ... }:
let
colors = import ../themes/colors.nix; # Import colors theme
dunst-volume-notification = pkgs.writeShellScriptBin "volume-notify" ''
if [ "$(pulsemixer --get-mute)" = "0" ]; then dunstify -u low -r 1 " 🔊 $(pulsemixer --get-volume | awk '{print $1}')%"
else dunstify -u low -r 1 "🔈 Muted"; fi
'';
dunst-brightness-notification = pkgs.writeShellScriptBin "brightness-notify" ''
dunstify -u low -r 1 " $(light -G)%"
'';
in
{
cmds.notifications.volume = "volume-notify";
cmds.notifications.brightness = "brightness-notify";
home.packages = [
dunst-volume-notification
dunst-brightness-notification
pkgs.libnotify
];
services.dunst = {
enable = true;
catppuccin.enable = true;
settings = {
global = {
monitor = 0;
follow = "keyboard";
indicate_hidden = "yes";
shrink = true;
transparency = 0;
origin = "top-center";
offset = "0x20";
seperator_height = 0;
padding = 12;
horizontal_padding = 20;
frame_width = 4;
seperator_color = "auto";
font = "${config.theme.font}";
markup = "full";
format = "<span foreground='#b3cfa7'><b>%s</b>%p</span>\n%b";
alignment = "center";
show_age_threshold = 60;
word_wrap = "yes";
ellipsize = "middle";
ignore_newline = "no";
stack_duplicates = true;
hide_duplicate_count = true;
show_indicators = "yes";
icon_position = "off";
sticky_history = "yes";
history_length = 20;
always_run_script = true;
browser = "/usr/bin/xdg-open";
corner_radius = 12;
force_xinerama = false;
mouse_left_click = "close_current";
mouse_middle_click = "do_action";
mouse_right_click = "close_all";
progress_bar_min_width = "200";
enable_recursive_icon_lookup = true;
};
urgency_low.timeout = 4;
urgency_normal.timeout = 8;
urgency_critical.timeout = 0;
};
};
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
}