User:Ermine/D-Bus: Difference between revisions

From Alpine Linux
(→‎Installation: Use Pkg template)
(→‎Installation: mention dbus-x11)
Line 3: Line 3:
== Installation ==
== Installation ==


Install {{Pkg|dbus}} package
Install {{Pkg|dbus}} package. Also install {{Pkg|dbus-x11}} package for <code>dbus-launch</code> program.


== Running ==
== Running ==

Revision as of 19:05, 15 November 2022

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

Installation

Install dbus package. Also install dbus-x11 package for dbus-launch program.

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, ...