Stop Google Chrome from stealing focus on opening

google-chrome

Is there any way of preventing Google Chrome from stealing the focus when it is opening?

When I open an application, I often do the following:

  1. Click on the application icon in the dock.
  2. ⌥ Option⇥ Tab away from the application while it has not yet finished opening.
  3. Continue working in another application while the first application is opening.
  4. Eventually ⌥ Option⇥ Tab back to the first application after it has completed its opening process and is ready for use.

Now Google Chrome misbehaves in step 3. When I have ⌥ Option⇥ Tabed away from it for working in another application, it will steal focus as soon as it has finished drawing its browser window. Instead of letting me decide to ⌥ Option⇥ Tab back to it at my own free will, it hijacks the process and interrupts any work I am doing.

I think this is an extremely annoying and intrusive behaviour and I would like to stop it. I do not want Google Chrome to always open in the background. It should just behave like any other app and not interfere with the choice I make by ⌥ Option⇥ Tabbing to another application.

I can replicate the focus stealing behaviour of Google Chrome in yet another way. When issuing the open command on the Terminal, the -g flag is supposed to tell the application to open in the background:

open -g /Applications/Google\ Chrome.app/

Yet again, Google Chrome does not honour this choice. It begins opening in the background all right, but it steals focus as soon as it has finished drawing its browser window. Compare this to the normal behaviour of any other application:

open -g /Applications/Firefox.app/

This does exactly what it is supposed to do: The application opens in the background and stays in the background until I choose to ⌥ Option⇥ Tab to it. Is there any way to make Google Chrome behave in this way, too?

Best Answer

Open Google Chrome in the background using Terminal

  1. Open System Preferences > Security & Privacy > Privacy > Accessibility
  2. Add Google Chrome to the list

Security & Privacy Accessibility pane

  1. Open Terminal and enter the command:

open -j -a "Google Chrome" 'https://www.google.com/'

Adding accessibility permissions for Chrome disables the "Hold command-Q to quit" feature and allows other apps to control the window (e.g. shell script). Using the -j option launches the app hidden as opposed to -g that is meant to prevent the app launching in the foreground.