[Interest] Using QDBusConnection::sessionBus()

Bernhard Lindner private at bernhard-lindner.de
Sun Dec 20 11:01:56 CET 2015


Thanks Thiago that you actually responded to that confusing question. I was 
exhausted and didn't add the most important information. Let me try again 
after getting some sleep:

I intended to use QDBusConnection::sessionBus() (Kubuntu 15.10 running 
Qt5.4.2) to access the systemd user session bus like this:

QDBusConnection dBus = QDBusConnection::sessionBus();
QDBusInterface systemDManagerInterface("org.freedesktop.systemd1", "/org/
freedesktop/systemd1", "org.freedesktop.systemd1.Manager", dBus);

That creates an invalid interface. Using systemBus() my code works fine but I 
need to access the user session bus not the system bus.

I tried a lot of things and this is what I could observe:

1 ."busctl --user | grep systemd" lists "org.freedesktop.systemd1" as 
"(activatable)"

2. "qdbusviewer" does not list something that contains "systemd" in its 
"Session Bus" tab.

3. "systemctl --user list-units" works and prints a long list of devices.

4. I installed the systemd settings panel in KDE and the "user units" tab is 
ghosted and can not be selected while the "units" tab works fine.

5. I was able to create a .service file in the "~/.config/systemd/user/" 
folder, and I was able to enable, start and dsiable that daemon using 
"systemctl --user"

I am pretty new to linux and totally new to systemd and D-Bus. And confused.
Any ideas why the above code does not return a valid systemd bus interface 
using sessionBus()?

-- 
Regards
Bernhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151220/44c9da17/attachment.sig>


More information about the Interest mailing list