DBus on OS X: reintroducing "classical" X11 (auto-)start as a fall-back
René J.V. Bertin
rjvbertin at gmail.com
Thu May 21 01:53:20 PDT 2015
Hi,
The current DBus implementation for OS X only supports (auto) starting through launchd, when the user is logged in a local, "Aqua" session. On the one hand that certainly caters to the large majority of use cases, but on the other hand DBus is used (mostly?) with applications that weren't written specifically for OS X using native APIs. It doesn't seem far-fetched to assume that users who install gnome/gtk applications or Qt's xcb platform plugin expect to be able to use those applications also on a remote X11 display (I do, and from feedback elsewhere I deduce that I'm not alone). That would require a functional DBus that works and is started just like it would be on a "non-Mac Unix system" (to quote a comment in dbus source code).
After an exchange with Thiago Macieira (started because I was surprised to see Qt5 applications that don't even use DBus give an error when started on a remote X11 connection) I've started looking into modifying the code so that it would start a DBus daemon linked to the X11 connection. I'd need and appreciate some guidance:
I've followed the idea that it would be best to let the OS X default launchd starting mechanism fail gracefully, and then attempt to do the X11 default start as a fallback. It turns out to be rather easy to check if we're running in a context where launchd would allow to start the DBus. The launchd plist instructs it to do this only in Aqua sessions (which makes sense I guess), and one can obtain the current session type from launchctl. That would allow to "punt and fall back" as commented in dbus-sysdeps-unix.c .
With the attached patch (against 1.8.16), I get a failure with the error
%> dbus-launch --csh-syntax
Failed to start message bus: Unknown address type 'launchd'
EOF in dbus-launch reading address from bus daemon
Exit 1
It looks like I'm also going to need to modify dbus_server_listen (dbus-server.c) and/or bus_context_new (bus.c) so that other methods or addresses are tried if the launchd one fails. I haven't yet been able to follow where dbus_server_listen() and bus_context_new() get their list of options to try from. A config file, or something hard-coded?
Is there a better approach to accomplish this than the one I'm following? I'd like this to be as transparent as possible, so that no changes outside of DBus are required, and a daemon is started when needed both in an "Aqua" session (current behaviour) and when logged in from a remote host and displaying over X11 on that host.
Thanks,
René
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-dbus-enable-nonlaunchd-start.diff
Type: text/x-patch
Size: 6700 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20150521/85d1c494/attachment.bin>
More information about the dbus
mailing list