Send desktop notification to other user
Main workflow
Here are some notes about sending desktop notifications to a different user, perhaps even on a different system.
ssh destinationhostname
Find something with the dbus session bus address.
eval $( /bin/grep -sozZe '^DBUS_SESSION_BUS_ADDRESS=[a-zA-Z0-9:=,/-]*$' /proc/*/environ | tr '\0' '\n' | sort -u | grep -i dbus_session_ )
On my desktops, I know the session is using fluxbox (except for that one XFCE system).
eval $( sudo /bin/grep -sozZe '^DBUS_SESSION_BUS_ADDRESS=[a-zA-Z0-9:=,/-]*$' /proc/$( pidof fluxbox )/environ ) export DISPLAY=:0
Find the user running fluxbox, and merge in to current user the xauth.
sudo su - "$( stat -c '%U' "/proc/$( pidof fluxbox )" )" -c "xauth extract - :0" | xauth merge -
Technically this next command makes a new notification-daemon process, but that is acceptable to me.
notify-send "Hello world"
References
Weblinks
- Use su with ssh X-forwarding | Knowledge Base (this blog)
- ubuntu - notify-send to other user on the same system - Super User
Additional reading
I cannot remember for sure if I used any commands from here, but this is fantastic reading, as always: Desktop notifications - ArchWiki
Comments