Mailing Lists: Apple Mailing Lists

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

Re: 2.1.1 and xterm



On Dec 16, 2007, at 11:59, John Koren wrote:

Here is a very simple example:
#! /bin/sh
# *** get POSIX path ***
thepath=`/usr/bin/osascript /Users/john/sw/src/Xterm/getPath.app 2>/dev/null | sed 's|[^/]*$||'`
#cd "$thepath"; /opt/local/bin/rxvt -tcw -display :0 &
cd "$thepath"; /opt/local/bin/rxvt -tcw &
# *** bring X11 to the front ***
/usr/bin/osascript -e 'tell application "/Applications/Utilities/ X11.app" to activate'


This script opens rxvt in the directory which is currently being examined by the Finder. I bundle it using Platypus and place the bundle's icon in the Finder toolbar.

Try this instead:

# Support Tiger
if [ -z $DISPLAY ] ; then
DISPLAY=:0
/usr/bin/osascript -e 'tell application "/Applications/Utilities/ X11.app" to activate'
fi
cd `/usr/bin/osascript /Users/john/sw/src/Xterm/getPath.app 2>/dev/ null | sed 's|[^/]*$||'`
/opt/local/bin/rxvt -tcw &


You shouldn't set the display, you should let it inherit $DISPLAY from the environment.

The original script had '-display :0' in the rxvt call. The script works correctly when I leave '-display :0' out. With '-display :0' in it also works well except during the first launch of X11 it pops up two windows, the one that I selected and the xterm from the launchd.

launchd doesn't start an xterm. Launchd just starts the server. Starting an X client (like xterm or X11.app) triggers launchd to start the server.


You shouldn't be seeing an extra xterm. xterm is not started in this case. Do you have xterm starting in your ~/.xinitrc? I don't know osascript. What does that 'to activate' command do? Launch X11.app if it's not running or bring it to the foreground? If it launches it if not running, then it might just be a race where X11.app runs (starting xterm) before rxvt runs. Try adding a 'sleep 1' after your rxvt &. Also, X11 now starts in the foreground as of 2.1.1.

When I asked if the launcher could be made a bit smarter (or less finicky) is that it would not launch the extra xterm in the situation when the application that triggered it (in this case rxvt - display :0) has display set to the 'local' screen (:0, local :0, my_computer:0). In other words it would work as if the display variable was not set.

Eh... By launcher, I'm guessing you mean X11.app? X11.app is pretty straightforward. Running it just runs 'xterm'. So if you're relying on X11.app to start the server in your scripts, you're doing it wrong. Just assume the server is running already. Also, the local screen is not :0 by default. It's a socket in /tmp. Right now, there is a regression that also allows you to use :0, but that is a bug and will be removed.


--Jeremy

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >Re: 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.