Emulate LoginWindow behavior in when starting a shell
LoginWindow is responsible for setting up the user session with launchd.
For us, shellspawn serves the same purpose as LoginWindow, so we
initialize the session there. This does require some additional dancing
around with processes and sockets since launchd only expects a single
process to register a session for a given user; this means that we
couldn't just keep the old behavior with each shellspawn connection
getting a new process and simply add-on launchd session initialization.
In the new approach, we introduce a new shellsession daemon that forks-off
instances for a user sessions; shellspawn now becomes a LaunchAgent that gets
started by launchd when the user session starts. We then connect to this
instance of the shellspawn daemon.