#!/bin/bash
username=
if [ "$(id -u)" != "1000" ] ; then
sudo -u $username DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "$@"
else
notify-send "$@"
fi
For permanent notifications that don't disappear, use the critical urgency:
notify-send -u critical "Hello world 3" -t 2000