I was writing a .sh script for opening a bunch of apps and i was looking for a way to force my apps to launch minimized.
The open
command man page usage prompt, (displayed when you run open
without args) says:
-j, --hide Launches the app hidden.
but some apps are still opening in the foreground (i.e. Chrome and Airmail).
I'm running El Capitain (10.11.6) and using zsh.
Do you know why those apps behave like that or if there's another way to accomplish this in bash?
Thanks.
Best Answer
Google Chrome uses different mechanism to display the app, so the standard
-j
switch does not work as expected in this case. Main process spawns theGoogle Chrome Helper
processes for every tab. If you check the .app bundle, you'll see it resides in/Applications/Google\ Chrome.app/Contents/Versions/XX.X.XXXX.XX/Google\ Chrome\ Helper.app
. You can't launch it directly, because main app has to be running.I couldn't find the other way around than just creating osascript like this:
However this will create 1 sec. delay in your script.