Call a D-Bus method and inspect available D-Bus services/objects from a shell script using busctl or gdbus

domain: freedesktop.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. List available services on a bus (system or session) to find the target service name, using busctl's list command or gdbus's call/introspection commands.
  2. Introspect the target service's object path with `busctl introspect <service> <object path>` (or `gdbus introspect`) to see its available interfaces, methods, properties, and signals.
  3. Invoke a method non-interactively with `busctl call <service> <object path> <interface> <method> <signature> <args...>` (or the equivalent gdbus call form), matching the exact type signature the introspection output showed.
  4. Read a property's current value with busctl's get-property command rather than calling a getter method, when the interface exposes it as a property.
  5. Choose busctl when scripting in a systemd-centric shell environment (it ships with systemd) and gdbus when the environment is GLib/GNOME-centric, since both talk to the same bus but come from different projects with slightly different invocation syntax.

Known gotchas

Related routes

Understand why GNOME Shell's D-Bus Eval() method is disabled by default and script GNOME Shell state safely instead
gitlab.gnome.org · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans