14.5 DBus service

DBus is a message-bus system for GNU/Linux and some other systems, which allows for communications between programs using a binary protocol; see (dbus)Top for further details.

mu4e uses Emacs’ DBus-support to implements a service for making some of its information visible to external programs. This information includes the current context (mu4e-context-name) and the read/unread counts for various bookmarked queries (mu4e-query-items)- the same information that is used for the new mail notifications and the read/unread counts, see Bookmarks and Maildirs.

An external program could use this information display such status information.

14.5.1 mu4e-dbus-mode

Enabling and disabling the service is through a minor-mode mu4e-dbus-mode. M-x mu4e-dbus-mode.

This starts a DBus service with the name nl.djcbsoftware.nl on the session-bus, and at object-path nl.djcbsoftware.Mu4e, exposes the interface /nl/djcbsoftware/Mu4e.

The interface is described as an XML string, in a constant mu4e-dbus-intrspection-xml. This currently looks like:

  <node>
  <interface name='org.freedesktop.DBus.Introspectable'>
    <method name='Introspect'>
      <arg name='xml_data' type='s' direction='out'/>
    </method>
  </interface>
  <interface name='org.freedesktop.DBus.Properties'>
    <method name='Get'>
      <arg type='s' name='interface_name' direction='in'/>
      <arg type='s' name='property_name' direction='in'/>
      <arg type='v' name='value' direction='out'/>
    </method>
    <method name='GetAll'>
      <arg type='s' name='interface_name' direction='in'/>
      <arg type='a{sv}' name='properties' direction='out'/>
    </method>
    <method name='Set'>
      <arg type='s' name='interface_name' direction='in'/>
      <arg type='s' name='property_name' direction='in'/>
      <arg type='v' name='value' direction='in'/>
    </method>
    <signal name='PropertiesChanged'>
      <arg type='s' name='interface_name'/>
      <arg type='a{sv}' name='changed_properties'/>
      <arg type='as' name='invalidated_properties'/>
    </signal>
  </interface>
  <interface name='nl.djcbsoftware.Mu4e'>
    <property name='Version' type='s' access='read'/>
    <property name='DatabasePath' type='s' access='read'/>
    <property name='RootMaildir' type='s' access='read'/>
    <property name='Context' type='s' access='readwrite'/>
    <property name='QueryInfo' type='aa{sv}' access='readwrite'/>
  </interface>
</node>