Skip to main content

DBus

DBus stands for Desktop Bus. It's a message bus system in Linux. It lets different processes talk to each other.

DBus

Built on top of Unix Domain Sockets

The DBus daemon uses Unix Domain Sockets for this. The producer and consumer processes connect to the daemon through these sockets.

Unix Domain Sockets are fully duplex

Each connection to the DBus daemon socket creates two file descriptors. One is for reading. One is for writing.

As we saw in file descriptors, each connection to a file creates a file descriptor. That's how each connection becomes full duplex.

See sockets for more details.

Use cases

For example, you connect to a new WiFi network. The Network Manager daemon must tell the user. It uses DBus for this. The network manager sends the result to the DBus daemon. The daemon forwards it to the Desktop app. The app then shows the notification.

DBus also handles hardware controls, such as volume and brightness.

Types of DBus

  1. System DBus - This is used for system level services such as Network Manager, Bluetooth, etc.
  2. Session DBus - This is used for user level services such as desktop notifications, media control, etc.
Multiple session DBus

For each user session, there is a separate session DBus daemon running. The daemon is started when the user logs in and is stopped when the user logs out.