diff --git a/modules/home/desktop/niri/default.nix b/modules/home/desktop/niri/default.nix index 644c647..041b3ab 100644 --- a/modules/home/desktop/niri/default.nix +++ b/modules/home/desktop/niri/default.nix @@ -94,6 +94,7 @@ in { libnotify playerctl wl-clipboard-rs # wl-clipboard in rust + xfce.xfconf ]; xdg = { @@ -161,6 +162,9 @@ in { Service.TimeoutStopSec = mkForce "1"; Service.Restart = mkForce "always"; }; + xfce4-notifyd = mkGraphicalService { + Service.ExecStart = pkgs.xfce.xfce4-notifyd + "/lib/xfce4/notifyd/xfce4-notifyd"; + }; # xwayland-satellite = mkGraphicalService { # Service = { # Type = "simple"; diff --git a/modules/home/desktop/niri/programs/waybar/default.nix b/modules/home/desktop/niri/programs/waybar/default.nix index 19d3530..933d31a 100644 --- a/modules/home/desktop/niri/programs/waybar/default.nix +++ b/modules/home/desktop/niri/programs/waybar/default.nix @@ -173,11 +173,34 @@ in { dnd-none = "󰂛"; }; return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "swaync-client -t -sw"; - on-click-right = "swaync-client -d -sw"; + exec = + pkgs.writeShellApplication { + name = "xfce-notifyd-waybar"; + runtimeInputs = with pkgs; [sqlite xfce.xfconf coreutils]; + text = + # bash + '' + is_dnd=$(xfconf-query -c xfce4-notifyd -p /do-not-disturb) + notifications_count=$(sqlite3 ~/.cache/xfce4/notifyd/log.sqlite "SELECT count(*) FROM notifications WHERE NOT is_read") + + if [[ "$notifications_count" -ne 0 ]]; then + icon="notification" + else + icon="none" + fi + + if [[ "$is_dnd" == "true" ]]; then + icon="dnd-$icon" + fi + + printf '{"text": "%s", "alt": "%s"}' "$notifications_count" "$icon" + ''; + } + + "/bin/xfce-notifyd-waybar"; + on-click = "xfconf-query -c xfce4-notifyd -p /do-not-disturb -T"; + on-click-right = lib.getExe pkgs.xfce.xfce4-notifyd; escape = true; + signal = 1; }; "privacy" = { icon-spacing = 0; diff --git a/modules/home/desktop/niri/services/default.nix b/modules/home/desktop/niri/services/default.nix index 5f77a0c..66ab062 100644 --- a/modules/home/desktop/niri/services/default.nix +++ b/modules/home/desktop/niri/services/default.nix @@ -14,7 +14,7 @@ lib.attrsets.recursiveUpdate { kanshi = import ./kanshi; network-manager-applet.enable = true; playerctld.enable = true; - swaync = import ./swaync; + # swaync = import ./swaync; swayosd.enable = true; udiskie.enable = true; wpaperd.enable = true;