Let root query screensaver status for user

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Nov 9 08:42:12 PST 2012


On 09/11/12 16:21, Thiago Macieira wrote:
> Set DBUS_SESSION_BUS_ADDRESS to the address you found, then use --session.

which can conveniently be done by:

sudo -u joe \
    env DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" \
    dbus-send --session ...

(sudo doesn't pass-through most environment variables from its parent by
default, hence the use of env)

Or if you know that the user is in an X11 session, and you know their
X11 display number, you could even unset the session bus address (if
set) and rely on X11 auto-launching:

sudo -u joe \
    env -u DBUS_SESSION_BUS_ADDRESS DISPLAY=:0 \
    dbus-send --session ...

Regards,
    S


More information about the dbus mailing list