The Barista Logo

barista

An i3status alternative in golang

Download sample-bar Download i3status example View on GitHub

watchers/DBus

godoc
import dbusWatcher "barista.run/base/watchers/dbus"

The dbus package provides watchers for dbus properties and signals. All watchers must be cleaned up when no longer needed, by calling their Unsubscribe() method.

NameOwnerWatcher

A NameOwherWatcher watches for changes to the owner for a named service. It supports both single name and namespaced wildcard names.

Any updates to relevant service owners will trigger a notification on the .Updates channel, with the name and new owner of the triggering name. Calling GetOwner() will return the service owner, while GetOwners() will return a map of service names to owners (useful in case of multiple services within the namespace active at the same time).

PropertiesWatcher

A PropertiesWatcher watches for changes to the properties of a DBus object. It signals each change to the .Updates channel, in a map that contains both the previous and the current value for each updated property.

It also provides AddSignalHandler(string, func(*Signal, Fetcher) map[string]interface{}) to run custom signal handlers in case there are properties on the object that trigger signals other than PropertiesChanged. The handler function is provided both the received Signal, as well as a Fetcher to query additional properties from the object (even properties that are not marked for updates during construction).

Created using WatchProperties(...):

Properties can be added in different ways depending on how updates to the property are expected: