Somewhere during the recent months I wrote a shell script where I needed to send the current user a popup notification. The script runs as root. After much weeping and gnashing of teeth, I resolved the problem by learning I needed to grab the currently logged on user’s DBUS_SESSION_BUS_ADDRESS environment variable.
Recently I wrote another shell script and encountered the same corner case of the script running as root but wanting to send a popup to non-root users. The script is nominally unique in that I need to only run the script while in Ubuntu MATE and not in Slackware.
Nothing I tried worked. Something changed with how notify-send functions. I tried several ideas, such as hard-coding other environment variables. Searching the web indicates other Ubuntu users have problems too with recent Ubuntu releases.
Hard to believe Linux does not have a notification system made for humans rather than only geeks.