I'm working on a bash script which requires root privileges, but which I'd like to give the ability to notify a non-root user of certain alerts via
notify-send in GNOME (or any other desktop shell supporting that command). As expected, simply invoking
notify-send from a root shell doesn't display a notification on the non-root user's desktop.
I've tried to invoke the command via:
su -c "notify-send 'my message'" -s /bin/sh someuser
(as well as using
/usr/zsh), but neither of these has had any effect.
How can I invoke
notify-send from a root shell so that it shows a notification on a (specified) non-root user's desktop?