Dbus (again)
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Jun 8 18:51:53 UTC 2017
Hi,
some more thoughts on D-Bus:
1. The KF5-ports still say "Don't forget that dbus needs to be started
[...] before any KDE programs will launch." This is - fortunately - no
longer quite accurate, as KF5 programs will generally launch, indeed,
although some may be lacking some functionality.
2. This new robustness makes the problem much less severe, but also
much easier to overlook. And so I'm again thinking about a way to
auto-start dbus, if needed.
As you (René), know, in RKWard we had been working around this, by
adding our own unconditional
launchctl load
-w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
during startup. Now, this wasn't a good approach, in particular for
using the "-w" option.
So now I tried replacing this with:
if (!QDBusConnection::sessionBus().isConnected()) {
QProcess::execute ("launchctl", QStringList () << "load" <<
"/Library/LaunchAgents/org.freedesktop.dbus-session.plist");
}
However, this did not work as expected: Qt will only try to connect to
the session bus, once, and if that fails, launching dbus will not help,
anymore (not for the running process, anyway).
I've looked around a bit, but could not find any other trivial way to
check for a running session bus. But then, isn't that one of the
reasons for launchctl, starting daemons exactly once? So right now I'm
testing a plain
#ifdef Q_OS_MAC
QProcess::execute ("launchctl", QStringList () << "load" <<
"/Library/LaunchAgents/org.freedesktop.dbus-session.plist");
#endif
early on in the startup sequence (before anything tries using DBus).
This seems to work, nicely. Is there any obvious drawback (other than
whatever impact it has on startup time)?
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20170608/aeb2cec8/attachment.sig>
More information about the kde-mac
mailing list