User Tools

Site Tools


linux:notify

This is an old revision of the document!


Notify

To display notifications from scripts running as root for the currently logged in user, use this:

notify-send.sh

#!/bin/bash
username=<your username here>
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
linux/notify.1562062017.txt.gz · Last modified: 2023/05/29 11:53 (external edit)