On 2017-02-05 22:38, Michael Hamilton wrote:
I was looking for an answer to this quite recently, but found nothing inspiring, your question prompted me to revisit the issue.
There is an old question at stackexchange that addresses this issue:
http://unix.stackexchange.com/questions/2881/show-a-notification-across-all-...
None of the answers are truly satisfactory as there seems to be no universally correct, simple, standard, guaranteed equivalent to tty wall for X11. However, I did manage to get a modified solution to one of the suggestions to work on my system when run as root:
--- snip --- #!/bin/bash PATH=/usr/bin
XUSERS=($(who|egrep "\(:[0-9](\.[0-9])*\)"|awk '{print $1$NF}'|sort -u)) for XUSER in $XUSERS; do NAME=(${XUSER/(/ }) DISPLAY=${NAME[1]/)/} sudo -u ${NAME[0]} DISPLAY=${DISPLAY} \ notify-send "$@" done --- snip ---
If saved in notify-send-all, you can then do:
notify-send-all -i 'dialog-information' Warning 'Shutting down shortly.'
How do you tell which user to send to? cer@Telcontar:~> notify-send --help Usage: notify-send [OPTION...] <SUMMARY> [BODY] - create a notification Help Options: -?, --help Show help options Application Options: -u, --urgency=LEVEL Specifies the urgency level (low, normal, critical). -t, --expire-time=TIME Specifies the timeout in milliseconds at which to expire the notification. -a, --app-name=APP_NAME Specifies the app name for the icon -i, --icon=ICON[,ICON...] Specifies an icon filename or stock icon to display. -c, --category=TYPE[,TYPE...] Specifies the notification category. -h, --hint=TYPE:NAME:VALUE Specifies basic extra data to pass. Valid types are int, double, string and byte. -v, --version Version of the package. cer@Telcontar:~> -u is for urgency, not user. Ah, you set the DISPLAY variable and run as that user. Interesting... What about those users that are not running a full desktop, but only a remote app via ssh? Mmm, perhaps on that terminal, via wall. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" at Telcontar)