Exploring D-Bus with Emacs APIs


  • Finish your taxes!
  • I’ve started working on a book about building a modern desktop environment with Sway in Guix (and Linux)!

    Keep an eye out here for early access: https://ko-fi.com/SystemCrafters

Exploring D-Bus with Emacs APIs

D-Bus is a standard part of the Linux desktop environment! Emacs provides a nice set of functions for interacting with system-level and user-level D-Bus services.

We’ll be exploring D-Bus with these functions in the M-x ielm REPL!

(dbus-call-method :session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" "SystemCrafters" 0 "" "Summary" "Body" '(:array) '(:array :signature "{sv}") :int32 -1)

Listing known D-Bus services in the user session

(dbus-list-known-names :session)

Finding all “nodes” (object paths) for a service

(dbus-introspect-get-all-nodes "org.freedesktop.portal.Documents" "/")

List all interfaces for a given node

(dbus-introspect-get-interface-names :session "org.freedesktop.portal.Documents" "/org/freedesktop/portal/documents")

Describe a particular interface

(dbus-introspect-get-interface :session "org.freedesktop.portal.Documents" "/org/freedesktop/portal/documents" "org.freedesktop.portal.Documents")

Call a simple method

(dbus-call-method :session "org.freedesktop.portal.Documents" "/org/freedesktop/portal/documents" "org.freedesktop.portal.Documents" "GetMountPoint")
Subscribe to the System Crafters Newsletter!
Stay up to date with the latest System Crafters news and updates! Read the Newsletter page for more information.
Name (optional)
Email Address