-
In the borg script you need to set, at least:
# variable from user where notification should be shown, is usually static DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
If it does not work, you may need to set
export DISPLAY=:0
. -
In some cases (e.g. when using Wayland) you may additionally need to allow the user to access your Xorg server. Note that only root should be allowed to do that or a user, who is really only running borg. As the user where the notification should be shown execute:
xhost +SI:localuser:<user running borg>
This has to be done at each login, as the setting does not persist. Alternatively use su to execute zenity as the user, where the notification should be shown. For this azenityProxy
function is built-in:zenityProxy() { if [ -z "$1" ]; then # let script verify this proxy is there return 0 # (true) fi # execute command as different user su <notification user> -c "zenity $*" }
As this makes use of su, it of course only works for
root
. If you want to do it in a complicated way, you could usesudo
and edit your sudoers file to allow a different user to use sudo. Just make sure, you keep your system secure.Or try to get and set the XAUTHORITY variable. In older versions this is been
/home/<notification user>/.Xauthority
.This has been tested with a systemd-enabled distro. Further tests and adjustions are very much appreciated. If you do not want to hardcode the user you can use this function to get all active users. Note that however, in this case, the
DBUS_SESSION_BUS_ADDRESS
address may be different and you may need to get the correct one for the user. If you want to include all users you can just use the commandusers
. But you may also need to adjust theDBUS_SESSION_BUS_ADDRESS
variable (tryDBUS_SESSION_BUS_ADDRESS=$( su <notification user> -c 'echo $DBUS_SESSION_BUS_ADDRESS' )
).
Created
January 1, 2019 18:41
-
-
Save rugk/af78c111267fb41e86259c0b46fb4a87 to your computer and use it in GitHub Desktop.
old manual notification zenity proxy method for borbbackup-cron-helper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment