User:Ermine/D-Bus

From Alpine Linux
Revision as of 18:41, 15 November 2022 by Ermine (talk | contribs) (→‎Installation: Use Pkg template)

D-Bus is a daemon which provides a bus, i.e. many-to-many interprocess communication mechanism.

Installation

Install dbus package

Running

There are two modes of D-Bus operation:

  • system bus: a single system-wide bus. Services connected to this bus are available to processes launched by any user; also it can be used to listen to system events like "new hardware was added" or "printer queue was changed";
  • session bus: one bus per user session for user-local services for general IPC needs.

System bus

System bus can be started with OpenRC:

# rc-service dbus start
# rc-update add dbus default

User bus

The most convenient way to launch session bus is to use dbus-launch

$ export $(dbus-launch)
Note: This weird syntax is used so variable containing D-Bus socket location ($DBUS_SESSION_BUS_ADDRESS) and its PID ($DBUS_SESSION_BUS_PID) get exported as environment variables for application

dbus-launch can be used to launch a program which would use this bus:

$ dbus-launch my-bus-client

To run a window manager, desktop environment or a shell with a bus session address available to it, use dbus-run-session:

$ dbus-run-session sway

This way, dbus session bus will terminate after you finish with your window manager or shell.

Autolaunching mechanism

TODO describe this weirdo.

Configuration

TODO

Troubleshooting

Graphical Tools

D-Feet, QDBusViewer

Command-line tools

dbus-send, dbus-monitor, ...