On 17/11/2007, Eric Gouriou <email@hidden> wrote:
On Nov 16, 2007, at 8:50 PM, Ambrose Li wrote:
[...]
$DISPLAY being set means that X is _available_, not that the
user desires to get X clients started or that contacting
the X server is a 0-cost operation. Indeed it can already
be pretty expensive to contact an already running server,
for example when operating over long latency connections.
Thanks to launchd, X is always running on Leopard. It's just
very, very good at consuming no resources as long as it has
no clients. That's similar to traditional network services
started via xinetd, "the ssh server" is available as soon as
it is configured, whether an instance of the sshd executable
is currently running or not.
I would think that this is backwards. Thanks to launchd, X is
always *available*. Certainly when you first log in (unless
you have it set to run in System Preferences) it is *not*
running. On the other hand, on a non-Leopard system, if $DISPLAY
is set, the worst thing that can happen is that it is set to
a crashed server so any X command errors out, but any script
can then trap the error and conclude that X is not really
available. (Ok, this is not the worst; the worst could be
$DISPLAY pointing to another still-running server that is at
somewhere you don't expect. But this is still nowhere near
expectedly *starting up* an X server when all you want is to
check for its existence, for example.)