Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'So how does it work?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
So how does it work?
Authored by: dkulp on Aug 29, '05 10:39:07AM

Does anyone know how this clever trick works? My initial guess was that it was related to launchd. Since you can write simple plists that will launch when a port is queried, I first guessed that attempts by X11 applications to contact the DISPLAY port would trigger launchd to run X11.app. But I searched through /System/Library/LaunchDaemons and didn't find anything. Furthermore, DISPLAY isn't set before launching.

Perhaps the Finder checks what linked symbols are in the executable (like XtAppInitialize) and then runs open-x11? That seems like an ugly hack.

Any ideas?



[ Reply to This | # ]
So how does it work?
Authored by: earlshango on Aug 29, '05 12:21:19PM
I'd also like to know how it works. As far as I can tell, it only works for programs in paths that come installed (or can be installed) with OS X - such as
/usr/X11R6/bin
It doesn't work (for me at least) with X11 programs installed by Fink in
/sw/bin


[ Reply to This | # ]
So how does it work?
Authored by: dkulp on Aug 30, '05 12:20:41AM

In my experience X11 apps in /sw/bin DO startup from the finder.



[ Reply to This | # ]
So how does it work?
Authored by: adrianu on Aug 30, '05 09:54:57AM

It works by a bit of a hack that Apple added to Finder back when X11 v1.0 came out with OSX 10.3.

Basically, whenever you try to open an executable, Finder checks to see if it links against the X11 libraries. If so, it changes the file's effective extension to ".x11app" which maps to Apple's X11.app (by default). This means X11.app receives the file as if it is a document to be opened, recognises that it's an X11 executable, and performs the appropriate action.

You'll find that any 'wrapper' around a 'real' X11 executable (e.g. a script that runs the actual X11 binary) will not launch correctly since Finder will not see that it is linked against the X11 libraries (it may well end up going to Terminal or something?)

Unfortunately, the .x11app extension was what I used for OroborOSX (the launch scripts it has which search for X11 apps and figure out how to find and launch within OroborOSX), so having Apple's X11.app 'take over' this extension means OroborOSX does not quite work correctly unless it is changed back. However, I did also update it so that, once pointing back to OroborOSX, it could perform the same 'trick' as Apple's X11.app and recognise X11 executables that were launched from Finder - with the same effect.

Hope that makes sense!

Adrian



[ Reply to This | # ]
So how does it work?
Authored by: wgscott on Aug 30, '05 10:38:23AM

It does, and thanks for the info! Thanks also for OroborOSX. I still use it quite a bit.



[ Reply to This | # ]