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

Double-click X11 applications to open via the Finder Desktop
I'm afraid to submit this hint for fear everyone in the world knows this except for me ... in 10.4, without X11.app launched and without any Terminal open, you can navigate in the Finder to, for example, /usr/X11R6/bin and double-click on a binary icon like xclock or xterm or xeye or xcalc etc., and it will simply launch -- cleanly, without starting a Terminal session or anything.

For years, I have either launched everything from the command line, or made application wrappers with Platypus or AppleScript, and I was stunned to see that 10.4 (which I have used since it became available) offers this feature. The only shortcoming is that it doesn't seem to permit drag and drop, but perhaps there is even a trick to getting that to work.

[robg adds: I also wasn't aware that X apps could be launched via a Finder double-click; I've been launching them from X11's Terminal every since I started playing around with X11...]
    •    
  • Currently 2.00 / 5
  You rated: 2 / 5 (4 votes cast)
 
[11,621 views]  

Double-click X11 applications to open via the Finder | 10 comments | Create New Account
Click here to return to the 'Double-click X11 applications to open via the Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Double-click X11 applications to open via the Finder
Authored by: goatbar on Aug 29, '05 10:08:50AM

That sounds great. In 10.3, I made app bundles that contained one small script that made sure X11 was running (started it if it wasn't) and then launched the app. Lets you put a nice icon on a users desktop for the app.
It worked, but is a lot of effort if there are many apps to wrap.



[ Reply to This | # ]
"First class" X11 apps
Authored by: dkulp on Aug 29, '05 10:24:54AM

I've often thought about your idea. This would be a really nice feature if (1) the icon could be dynamically set (e.g. the print app changes its icon depending on the printer) so that only one underlying program was needed and the .app directories were lightweight wrappers, (2) a daemon could be X11 aware (like any of the X11 window managers) so that a .app would be launched whenever an X11 executable was started, i.e. you could launch an X11 application from the finder/dock OR the finder/dock would start a "shadow" .app program if you launched from a terminal, and (3) icons already created by X11 application programmers would be automatically used.



[ Reply to This | # ]
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 | # ]
Double-click X11 applications to open via the Finder
Authored by: aflegg on Aug 29, '05 11:42:25AM
Hi,

It works in Panther as well. However, I still prefer XDroplets for the flexibility of having:

  • a nice icon
  • drag & drop support
  • ability to set up things like fink etc. before trying to start the app
Would be interested to know how it works as well...

Cheers,

Andrew

[ Reply to This | # ]

Double-click X11 applications to open via the Finder
Authored by: hamarkus on Aug 29, '05 01:08:07PM

Does anybody know whether XDroplets works with Matlab? Matlab has its own launcher but to opening files can only be done from within the program. No double-clicking on .m-files or dragging them on the Matlab dock icon or on the launcher. Could XDroplets provide this functionality?



[ Reply to This | # ]
Double-click X11 applications to open via the Finder
Authored by: hypert on Aug 29, '05 12:56:43PM
I didn't bother to make wrappers for all my X11 apps, but I did have to have one for XEmacs, since it's almost the only editor I use.

I used the wonderful Platypus to make something I call XEmacs Wrapper. It will launch X11 if it's not running and bring it to the forward if it wasn't. The Finder icon is the XEmacs icon - and it's fully drag-and-droppable!

It's free, so use it if you find it, well, useful. :-)

[ Reply to This | # ]