On 11/07/13 15:38, Rob Campbell wrote:
On 2013-05-29, at 18:58 , Justin Dolske <dol...@mozilla.com> wrote:

On 5/29/13 3:09 PM, Ehsan Akhgari wrote:
Typically when you use the terminal to open an application on Mac, the
application is opened in the background.
Mmm, indeed. Someone told me long ago this this was a platform convention, but 
it sure is annoying. Seems like a nice refinement to me.

I'd assume that the most common use-case for launching the browser is to, well, 
use the browser. If people don't want -foreground as a default, I'd like to 
understand why. (Loading a test page and focusing on console output is fair, 
and the -background proposed in the bug would help.)
I'm assuming the convention is so you don't break flow when interacting with 
the Terminal. Stealing focus away from that means you'll need to refocus the 
Terminal and that could be annoying.

That said, running "open ." in an OS X Terminal launches an instance of Finder 
and focuses it, so I think we'd be OK to do the same.

~ rob
The "open" command does quite complicated things:

"open X" uses the LaunchServices framework to determine which application should handle "X" then sends it an "open" AppleEvent, and brings it to the front. There is only one instance of any Mac application, including the Finder. It will receive the AppleEvent and open the requested directory (which in this case is "."). Note that the "open" command has a "-g" option to keep the receiving application in the background.

Also worth mentionning, the "open" command quits and control returns to the calling shell, while the application keeps running and its stdin/out/err are redirected to /dev/null. I don't think this is what we want, because we need console output in the terminal.

Using "open" is very different from typing (for example) "/Applications/Firefox.app/Contents/MacOS/firefox", which is the basic way to launch any executable (including real Mac applications), and doesn't check for already running instances (launched Mac applications are registered through LaunchServices). This is probably what we are doing now, and in that case the launched application stays in the background while its output goes to the terminal. Unless the application brings *itself* to the foreground, which is contrary to Apple's HI guidelines.

Today, if one types "open -g /Applications/Firefox.app" LaunchServices will tell the Finder to open Firefox (an application), and keep it in the background. If we make Firefox bring itself to the foreground when launched, we'll break the expected behavior. Do we care for that?

André
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to