Function: dbus-init-bus

dbus-init-bus is a byte-compiled function defined in dbus.el.gz.

Signature

(dbus-init-bus BUS &optional PRIVATE)

Documentation

Establish the connection to D-Bus BUS.

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

The function returns the number of connections this Emacs session has established to the BUS under the same unique name (see dbus-get-unique-name). It depends on the libraries Emacs is linked with, and on the environment Emacs is running. For example, if Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware environment like GNOME, another connection might already be established.

When PRIVATE is non-nil, a new connection is established instead of reusing an existing one. It results in a new unique name at the bus. This can be used, if it is necessary to distinguish from another connection used in the same Emacs process, like the one established by GTK+. If BUS is the keyword :system or the keyword :session, the new connection is identified by the keywords :system-private or :session-private, respectively.

Probably introduced at or before Emacs version 24.3.

Source Code

;; Defined in /usr/src/emacs/lisp/net/dbus.el.gz
(defun dbus-init-bus (bus &optional private)
  "Establish the connection to D-Bus BUS.

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

The function returns the number of connections this Emacs session
has established to the BUS under the same unique name (see
`dbus-get-unique-name').  It depends on the libraries Emacs is
linked with, and on the environment Emacs is running.  For
example, if Emacs is linked with the GTK+ toolkit, and it runs in
a GTK+-aware environment like GNOME, another connection might
already be established.

When PRIVATE is non-nil, a new connection is established instead
of reusing an existing one.  It results in a new unique name at
the bus.  This can be used, if it is necessary to distinguish
from another connection used in the same Emacs process, like the
one established by GTK+.  If BUS is the keyword `:system' or the
keyword `:session', the new connection is identified by the
keywords `:system-private' or `:session-private', respectively."
  (or (featurep 'dbusbind)
      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
  (prog1
      (dbus--init-bus bus private)
    (dbus-register-signal
     bus nil dbus-path-local dbus-interface-local
     "Disconnected" #'dbus-handle-bus-disconnect)))