dbus-launch command examples

dbus-launch command examples

dbus-launch – Utility to start a message bus from a shell script

Distributions running dbus-launch as part of a standard X session should run dbus-launch –exit-with-session after the X server has started and become available, as a wrapper around the “main” X client (typically a session manager or window manager), as in these examples:

#dbus-launch --exit-with-session gnome-session
#dbus-launch --exit-with-session openbox
#dbus-launch --exit-with-session ~/.xsession

If your distribution does not do this, you can achieve similar results by running your session or window manager in the same way in a script run by your X session, such as ~/.xsession, ~/.xinitrc or ~/.Xclients.

To start a D-Bus session within a text-mode session, you can run dbus-launch in the background. For instance, in a sh-compatible shell:

## test for an existing bus daemon, just to be safe

     ## if not found, launch a new one
     eval `dbus-launch --sh-syntax`
     echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"

Note that in this case, dbus-launch will exit, and dbus-daemon will not be terminated automatically on logout.


Leave a Reply

Your email address will not be published. Required fields are marked *