Dbus: Difference between revisions
Created page with "Dbus is a messaging system used in Linux display managers such as GNOME. == Accessing Dbus == Dbus is accessed using a socket whose location is defined as an environment var..." |
|||
| (4 intermediate revisions by the same user not shown) | |||
| Line 11: | Line 11: | ||
== Watching For Messages / Events == | == Watching For Messages / Events == | ||
You can watch the dbus for messages using the {{code|dbus-monitor}} utility. A filter can be passed as an argument. For example, to limit only messages sent by the GNOME SessionManager: | You can watch the dbus for messages using the {{code|dbus-monitor}} utility. A filter can be passed as an argument. For example, to limit only messages sent by the GNOME SessionManager: | ||
{{highlight|lang= | {{highlight|lang=terminal|code= | ||
dbus-monitor "type=signal,sender='org.gnome.SessionManager'" | dbus-monitor "type=signal,sender='org.gnome.SessionManager'" | ||
}} | }} | ||
| Line 19: | Line 19: | ||
Eg: | Eg: | ||
{{highlight|lang= | {{highlight|lang=terminal|code= | ||
gdbus call --session --dest org.gnome.SessionManager \ | gdbus call --session --dest org.gnome.SessionManager \ | ||
--object-path /org/gnome/SessionManager/Presence \ | --object-path /org/gnome/SessionManager/Presence \ | ||
| Line 25: | Line 25: | ||
}} | }} | ||
[[Category:Linux]] | == See Also == | ||
* http://dbus.freedesktop.org/doc/dbus-send.1.html | |||
Gnome Presence Key | |||
* https://people.gnome.org/~mccann/gnome-session/docs/gnome-session.html#org.gnome.SessionManager.Presence:status | |||
Gnome Screensaver (doesn't seem to work) | |||
* http://unix.stackexchange.com/questions/107787/how-can-i-trigger-the-screensavers-locking-feature-using-d-bus-from-the-command | |||
{{Navbox Linux}}[[Category:Linux]] | |||
[[Category:LinuxUtilities]] | |||
Latest revision as of 23:24, 14 June 2020
Dbus is a messaging system used in Linux display managers such as GNOME.
Accessing Dbus
Dbus is accessed using a socket whose location is defined as an environment variable named DBUS_SESSION_BUS_ADDRESS. Typically, it will look something like:
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-2L2ZxqLwNR,guid=9bf5b79ea33d45373491174856252e15
This environment variable must be defined in order for Dbus utilities to work properly.
Watching For Messages / Events
You can watch the dbus for messages using the dbus-monitor utility. A filter can be passed as an argument. For example, to limit only messages sent by the GNOME SessionManager:
dbus-monitor "type=signal,sender='org.gnome.SessionManager'"
Sending Messages
Messages can be sent using dbus call or dbus-send.
Eg:
gdbus call --session --dest org.gnome.SessionManager \
--object-path /org/gnome/SessionManager/Presence \
--method org.gnome.SessionManager.Presence.SetStatus 0
See Also
Gnome Presence Key
Gnome Screensaver (doesn't seem to work)