Next: , Previous: Version, Up: Inspection

2.2 Bus names.

There are several basic functions which inspect the buses for registered names. Internally they use the basic interface ‘org.freedesktop.DBus’, which is supported by all objects of a bus.

— Function: dbus-list-activatable-names &optional bus

This function returns the D-Bus service names, which can be activated for bus. It must be either the symbol :system (the default) or the symbol :session. An activatable service is described in a service registration file. Under GNU/Linux, such files are located at /usr/share/dbus-1/system-services/ (for the :system bus) or /usr/share/dbus-1/services/. An activatable service is not necessarily registered at bus at already.

The result is a list of strings, which is nil when there are no activatable service names at all. Example:

          ;; Check, whether the document viewer can be accessed via D-Bus.
          (member "org.gnome.evince.Daemon"
                  (dbus-list-activatable-names :session))
— Function: dbus-list-names bus

All service names, which are registered at D-Bus bus, are returned. The result is a list of strings, which is nil when there are no registered service names at all. Well known names are strings like ‘org.freedesktop.DBus’. Names starting with ‘:’ are unique names for services.

bus must be either the symbol :system or the symbol :session.

— Function: dbus-list-known-names bus

Retrieves all registered services which correspond to a known name in bus. A service has a known name if it doesn't start with ‘:’. The result is a list of strings, which is nil when there are no known names at all.

bus must be either the symbol :system or the symbol :session.

— Function: dbus-list-queued-owners bus service

For a given service, registered at D-Bus bus under the name service, all queued unique names are returned. The result is a list of strings, or nil when there are no queued names for service at all.

bus must be either the symbol :system or the symbol :session. service must be a known service name as string.

— Function: dbus-get-name-owner bus service

For a given service, registered at D-Bus bus under the name service, the unique name of the name owner is returned. The result is a string, or nil when there exist no name owner of service.

bus must be either the symbol :system or the symbol :session. service must be a known service name as string.

— Function: dbus-ping bus service &optional timeout

Check whether the service name service is registered at D-Bus bus. service might not have been started yet, it is autostarted if possible. The result is either t or nil.

bus must be either the symbol :system or the symbol :session. service must be a string. timeout, a nonnegative integer, specifies the maximum number of milliseconds dbus-ping must return. The default value is 25,000. Example:

          (message
             "%s screensaver on board."
             (cond
               ((dbus-ping :session "org.gnome.ScreenSaver" 100) "Gnome")
               ((dbus-ping :session "org.freedesktop.ScreenSaver" 100) "KDE")
               (t "No")))

If it shall be checked whether service is already running without autostarting it, one shall apply

          (member service (dbus-list-known-names bus))
— Function: dbus-get-unique-name bus

The unique name, under which Emacs is registered at D-Bus bus, is returned as string.

bus must be either the symbol :system or the symbol :session.