Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: 2.1.1 and xterm



Jeremy,

I do not have any applications launched by .xinitrc. I did more experimentation and I think I can now explain the basis for the odd behaviour. I believe it stems from the fact that X11.app does not like DISPLAY to be set to :0.

Here are three similar scripts that react quite differently. It is assumed that the environment variable DISPLAY is not set prior to executing the scripts.

1)
#! /bin/sh
DISPLAY=:0; export DISPLAY
xterm &
/usr/bin/osascript -e 'tell application "/Applications/Utilities/X11.app" to activate'

In this case no xterms end up being launched. Because DISPLAY set to :0, the xterm from the script and (presumably) the xterm in X11.app time out with an error "xterm Xt error: Can't open display: :0". After that X11 actually starts up and I can launch other applications normally. The applications inherit DISPLAY=:0.

2)
#! /bin/sh
xterm -display :0 &
/usr/bin/osascript -e 'tell application "/Applications/Utilities/X11.app" to activate' 

In this case two xterms are launched. The script xterm probably just sits because of its display :0 flag, however, because the DISPLAY environment  variable is not set, the following line launches X11.app and its own xterm. Once X11 is running the initial xterm also launches and we end up with two xterms.

3)
 #! /bin/sh
xterm &
/usr/bin/osascript -e 'tell application "/Applications/Utilities/X11.app" to activate'

This script follows the latest rules and indeed produces the desired result of launching one xterm. The xterm call goes through launchd/X11.app as expected. The following osascript brings X11.app to the front otherwise, when the script is bundled, the xterm would launch behind the Finder window.

I believe this unusual behaviour could be circumvented if lauchd/X11.app would accept display settings of the form :0, localhost:0. 

Cheers -John

On Dec 16, 2007 3:40 PM, Jeremy Huddleston < email@hidden > wrote:

On Dec 16, 2007, at 12:34, John Koren wrote:

> Thanks Ben for all the details related to launchd and the role of  /
> tmp/.X11-unix/X0. It is much clearer now.
>
> I also asked earlier if launchd could ignore the display variable
> when the trigger application has it set to :0 (or equivalent) so
> that it would not launch the "spurious" xterm. Perhaps it is a bad
> idea but it would avoid the situations where people are searching
> for an extra "xterm" in their own scripts when in fact it is only a
> byproduct of the DISPLAY being set to :0.

Launchd doesn't care about $DISPLAY.  All it does is start the server
upon connection to the /tmp/launchd-xxxxx/:0 socket.  If xterm runs,
it's because either:

1) You have it starting in your ~/.xinitrc
2) You are starting xterm manually by running X11.app or directly.

If you change $DISPLAY to something else, then launchd won't trigger
at all (since nothing will be touching the socket)!

--Jeremy


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/x11-users/email@hidden

This email sent to email@hidden

References: 
 >2.1.1 and xterm (From: "John Koren" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.