User:Ermine/D-Bus: Difference between revisions

From Alpine Linux
m (→‎Running: fix english)
m (Use neutral language)
 
Line 26: Line 26:
</pre>
</pre>


{{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 use by other programs.}}
{{Note|This 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 use by other programs.}}


<code>dbus-launch</code> can be used to launch a program which would use this bus:
<code>dbus-launch</code> can be used to launch a program which would use this bus:
Line 44: Line 44:
== Autolaunching mechanism ==
== Autolaunching mechanism ==


TODO describe this weirdo.
TODO describe this.


== Configuration ==
== Configuration ==

Latest revision as of 18:40, 23 December 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 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 use by other programs.

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.

Configuration

TODO

Troubleshooting

Graphical Tools

D-Feet, QDBusViewer

Command-line tools

dbus-send, dbus-monitor, ...