diff --git a/scripts/notify-bootc-user.sh b/scripts/notify-bootc-user.sh index b5a6c8a..314f3f1 100755 --- a/scripts/notify-bootc-user.sh +++ b/scripts/notify-bootc-user.sh @@ -17,14 +17,15 @@ TARGET_USER=$(loginctl list-sessions --no-legend | awk '$3 != "root" {print $3; USER_ID=$(id -u "$TARGET_USER") RUNTIME_DIR="/run/user/$USER_ID" -# 4. Benachrichtigung senden -# -a "System-Update" setzt den Namen in der Titelleiste -# --action definiert den Button -# --wait lässt das Skript auf die Reaktion warten -RESPONSE=$(sudo -u "$TARGET_USER" \ - DBUS_SESSION_BUS_ADDRESS="unix:path=$RUNTIME_DIR/bus" \ - XDG_RUNTIME_DIR="$RUNTIME_DIR" \ - notify-send -a "System-Update" "Ein neues System-Update ist bereit." "Der Neustart aktiviert die Änderungen." \ +# 4. Benachrichtigung senden via systemd-run +# Wir nutzen --machine=$TARGET_USER@.host, um in die User-Session zu springen +RESPONSE=$(systemd-run --machine="$TARGET_USER@.host" \ + --user \ + --pipe \ + --wait \ + notify-send -a "System-Update" \ + "Ein neues System-Update ist bereit." \ + "Der Neustart aktiviert die Änderungen." \ --icon=system-reboot-symbolic \ --urgency=critical \ --action="reboot=Jetzt neu starten" \