Task is simple: Send desktop notifications over SSH.

I know for this I have to specify not only DISPLAY=:0 but also the dbus address for the user that is running the GUI. In my case, the uid is 1000.

On debian, this would be my working command:

DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send 'Test'

On ubuntu, this doesn't output anything to both the CLI and the desktop. I've found out that bus is called dbus-session, but replacing that in the command doesn't help either.

In this answer it is suggested to use dbus-launch notify-send 'Test', I've tried that aswell but without success. None of these commands return anything on the CLI.

Weirdly enough, this is what ended up working:

DISPLAY=:0 dbus-launch notify-send 'Test'

Can someone explain why that is? How is dbus-launch different from specifying the DBUS_SESSION address and why does that not work on ubuntu?

From man dbus-launch:

in this case, dbus-launch will launch a session bus instance, set the appropriate environment variables so the specified program can find the bus, and then execute the specified program

Reading further in the man page, all that is mentioned is DBUS_SESSION_BUS_ADDRESS, so I'm curious as to why my attempt of setting that manually failed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.