Change notification method to systemd-run

Updated notification method to use systemd-run for user sessions.
This commit is contained in:
humocs-man
2026-05-11 17:41:14 +02:00
committed by GitHub
parent 3fcb892b62
commit bdaf4bed0b
+9 -8
View File
@@ -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" \