Getting well-known-name from unique-name?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Tue Feb 26 21:40:26 UTC 2019


On Tue, 26 Feb 2019 10:13:06 -0500, Fabián Orccón wrote:

> Is there a way or some hack to get a well-known-name from a
> unique-name? I saw that there is a org.freedesktop.DBus.GetNameOwner
> but this gets the unique-name from a well-known name.

The only way I can think of is to list all the names on the bus, and
when you see a well-known name, use GetNameOwner to look for the unique
name that it maps to. Basically you build your own inverse mapping
table, then see what entry or entries match the unique name you are
interested in.

This example script
<https://github.com/ldo/dbussy_examples/blob/master/list_bus_names>
may be helpful: it can list the owners of all well-known names on a
bus, using e.g.

    list_bus_names --owners session


More information about the dbus mailing list