From 05b3c065f59e7602a86ca3e3c4b933d941f78607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Mon, 15 Sep 2025 20:50:42 +0200 Subject: [PATCH] fix(systemdNotify): fix libnotify implementation --- modules/systemdNotify.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/systemdNotify.nix b/modules/systemdNotify.nix index f988abb..a4c3273 100644 --- a/modules/systemdNotify.nix +++ b/modules/systemdNotify.nix @@ -91,13 +91,12 @@ in // optionalAttrs (cfg.method == "libnotify") { description = "Desktop notifications for %i service failure"; environment = { - DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/${ - toString config.users.users.${cfg.libnotify.user}.uid - }/bus"; + DISPLAY = ":0"; INSTANCE = "%i"; }; script = '' - ${pkgs.libnotify}/bin/notify-send --urgency=critical \ + export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u '${cfg.libnotify.user}')/bus" + ${pkgs.libnotify}/bin/notify-send --app-name="$INSTANCE" --urgency=critical \ "Service '$INSTANCE' failed" \ "$(journalctl -n 6 -o cat -u $INSTANCE)" '';