You are assuming that the object path always follows the naming of the service itself. That's not always the case – a service can export many different object paths, and does not strictly need to follow any naming style (i.e. there isn't an enforced rule that all object paths start with the service name, much less that there be one that exactly matches it; both are merely conventions).
KeePassXC is a Qt-based app, and many of those famously do not care to follow the usual D-Bus convention of using the service name as the "base" for object paths; instead, the old KDE3 DCOP (pre-D-Bus) style with all objects rooted directly at /
remains common among Qt programs.
Looking through busctl or D-Spy (or the older D-Feet), it seems that KeePassXC does not follow the D-Bus conventions of object naming, and the only object it exposes is at the path /keepassxc
.
$ busctl --user tree org.keepassxc.KeePassXC.MainWindow
└─ /keepassxc
$ gdbus introspect -e -d org.keepassxc.KeePassXC.MainWindow -o / -r -p
node / {
node /keepassxc {
};
};
So you need to call:
bus.get("org.keepassxc.KeePassXC.MainWindow", "/keepassxc")
Note that since an object can have methods under several interfaces, some D-Bus bindings automatically use introspection to resolve unambiguous method names to the correct interface, but e.g. dbus-python would require you to explicitly use dbus.Interface(obj…).Foo(…)
or obj.Foo(…, dbus_interface=…)
.
(Likewise Likewise the interface names don't need to match the service name;name – although it seems that KeePassXC has used the same string for both, even thoughbut the .MainWindow
suffix is pretty odd for a service name to have when all windows of an app belong to the same process... (while being a perfectly normal name for an interface that holds main window-related methods).
Generally instead of dbus-send I'd suggest the slightly less verbose systemd or GLib2 tools (both of which support showing the introspection XML from the service):
$ busctl --user introspect org.keepassxc.KeePassXC.MainWindow /keepassxc
$ busctl --user call ...
$ gdbus introspect -e -d org.keepassxc.KeePassXC.MainWindow -o /keepassxc
$ gdbus call -e ...