DBus on OS X: reintroducing "classical" X11 (auto-)start as a fall-back

Thiago Macieira thiago at kde.org
Fri May 22 11:02:35 PDT 2015


On Thursday 21 May 2015 10:53:20 René J.V. Bertin wrote:
> 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.

Is there any other way than hardcoding "Aqua" in the source code? What in the 
.plist file makes launchctl restrict it to Aqua sessions? And what would happen 
if the user modified the .plist file?

> 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?

>From the .conf file, I'd say. Since the plist file launches the bus with the --
session option, it would be from session.conf, which in turn gets the default 
set by the configure script. On my Linux system:

  <listen>unix:tmpdir=/tmp</listen>

Whereas on my Mac:

  <listen>launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET</listen>

I'm not sure you can add a ; to specify fallback options to listen on. I don't 
think that makes sense for dbus_server_listen(), but it might for 
bus_context_new().

> 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.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the dbus mailing list