Next: Errors and Events, Previous: Signals, Up: Top

## 8 Alternative buses.

Until now, we have spoken about the system and the session buses, which are the default buses to be connected to. However, it is possible to connect to any bus, from which the address is known. This is a UNIX domain socket. Everywhere, where a bus is mentioned as argument of a function (the symbol `:system` or the symbol `:session`), this address can be used instead. The connection to this bus must be initialized first.

— Function: dbus-init-bus bus

> Establish the connection to D-Bus bus.

> bus can be either the symbol `:system` or the symbol `:session`, or it can be a string denoting the address of the corresponding bus. For the system and session busses, this function is called when loading `dbus.el`, there is no need to call it again.

> Example: You open another session bus in a terminal window on your host:

>               # eval `dbus-launch --auto-syntax`
>               # echo $DBUS_SESSION_BUS_ADDRESS

>               -| unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e

> In Emacs, you can access to this bus via its address:

>               (setq my-bus
>                     "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e")

>               ⇒ "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e"

>               (dbus-init-bus my-bus)

>               ⇒ nil

>               (dbus-get-unique-name my-bus)

>               ⇒ ":1.0"