LinuxCommandLibrary

qdbus

Communicate with D-Bus applications

TLDR

List available service names

$ qdbus
copy

List object paths for a specific service
$ qdbus [service_name]
copy

List methods, signals and properties available on a specific object
$ qdbus [service_name] [/path/to/object]
copy

Execute a specific method passing arguments and display the returned value
$ qdbus [service_name] [/path/to/object] [method_name] [argument1] [argument2]
copy

Display the current brightness value in a KDE Plasma session
$ qdbus [org.kde.Solid.PowerManagement] [/org/kde/Solid/PowerManagement/Actions/BrightnessControl] [org.kde.Solid.PowerManagement.Actions.BrightnessControl.brightness]
copy

Set a specific brightness to a KDE Plasma session
$ qdbus [org.kde.Solid.PowerManagement] [/org/kde/Solid/PowerManagement/Actions/BrightnessControl] [org.kde.Solid.PowerManagement.Actions.BrightnessControl.setBrightness] [5000]
copy

Invoke volume up shortcut in a KDE Plasma session
$ qdbus [org.kde.kglobalaccel] [/component/kmix] [invokeShortcut] "[increase_volume]"
copy

Gracefully log out and then do nothing, reboot or shut down
$ qdbus [org.kde.Shutdown] [/Shutdown] [logout|logoutAndReboot|logoutAndShutdown]
copy

SYNOPSIS

qdbus [--system | --session] [service name] [object path] [method name] [arguments...]

PARAMETERS

--system
    Connect to the system bus.

--session
    Connect to the session bus (default).

[service name]
    The name of the D-Bus service to connect to. Example: org.kde.dolphin

[object path]
    The path to the object within the service. Example: /org/kde/dolphin/window/1

[method name]
    The name of the method to call on the object. Example: openLocation

[arguments...]
    Arguments to pass to the method.

--help
    Show help options.

--version
    Show program version.

DESCRIPTION

qdbus is a command-line tool used to interact with the D-Bus message bus. D-Bus is an inter-process communication (IPC) mechanism that allows different applications running on the same system to communicate with each other.

qdbus enables users to inspect and manipulate D-Bus services, objects, and methods from the command line. This can be useful for debugging, testing, or automating tasks that involve D-Bus. It allows you to list available services, introspect objects to discover their methods and signals, call methods on objects, and monitor signals emitted by objects. It's a powerful tool for understanding and working with D-Bus-based applications and services, especially in environments like KDE where D-Bus is heavily used. The command exposes a wealth of information about the D-Bus system and its connected applications.

CAVEATS

qdbus requires the D-Bus daemon to be running. The exact syntax for arguments can vary depending on the method being called. Correctly interpreting and using qdbus requires understanding the structure and API of the specific D-Bus services and objects you're interacting with. It's designed to function within environments leveraging D-Bus.

INTROSPECTION

Without specifying a method name, qdbus can be used to introspect an object and list its methods, signals, and properties.

ERROR HANDLING

qdbus will typically print error messages to the console if a method call fails or if there are issues connecting to the D-Bus. It's crucial to examine these error messages for debugging.

HISTORY

qdbus is part of the Qt framework and was developed alongside Qt's D-Bus integration features. Its initial versions were closely tied to Qt's evolution, offering a command-line interface to Qt's D-Bus API. Over time, qdbus has matured into a standalone utility, becoming a valuable tool for interacting with D-Bus regardless of the underlying framework (although its Qt origins are evident). It is commonly used in KDE environments and other Linux distributions that utilize D-Bus for inter-process communication.

SEE ALSO

Copied to clipboard