From e68fed92777430a5e660ab73e9810874bb83fc2b Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Thu, 17 Nov 2016 00:14:21 +0100 Subject: [PATCH] Fix desktop notification not shown when DBUS_SESSION_BUS_ADDRESS environment variable is not set --- client/usr/bin/rs-backup-run | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/usr/bin/rs-backup-run b/client/usr/bin/rs-backup-run index 90af354..fb4f16c 100755 --- a/client/usr/bin/rs-backup-run +++ b/client/usr/bin/rs-backup-run @@ -251,7 +251,9 @@ desktop_notify() { esac if [[ "$user" != "" ]]; then - sudo -u "$user" DISPLAY=":0.0" notify-send -i "$icon" -u "$urgency" "rs-backup: $2" "$3" + dbus_pid=$(pgrep -u "$user" dbus-daemon | head -n1) + environment=$(xargs --null < /proc/$dbus_pid/environ) + sudo -u "$user" $environment notify-send -i "$icon" -u "$urgency" "rs-backup: $2" "$3" fi }