nix/moduler/programs/confetti/default.nix
2025-11-12 10:12:29 +01:00

27 lines
759 B
Nix

{ config, pkgs, ... }:
let
confettiListener = pkgs.writeShellScript "confetti-listener" ''
#!/usr/bin/env bash
set -euo pipefail
exec dbus-monitor "interface='org.freedesktop.Notifications'" | \
while read -r line; do
if echo "$line" | grep -q "confetti"; then
confetti
fi
done
'';
in {
systemd.user.services.confetti-listener = {
description = "Listen for notifications and trigger confetti";
after = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
path = with pkgs; [ dbus gnugrep coreutils ];
serviceConfig = {
ExecStart = "${confettiListener}";
Restart = "always";
RestartSec = "1s";
};
};
}