Sublime Forum

Gain focus only once on Sublime Text launch


Understand it might be controlled by the OS, but maybe not
Is it possible for Sublime Text to gain focus only once per launch?

For example, on a Mac:

  1. Launch Sublime Text
  2. ST gains focus as expected
  3. Switch to another app immediately before ST is fully loaded
  4. ST gains focus when fully loaded, now this is unexpected

Is it possible to suppress step 4? I’ve already made an explicit decision to switch away, so I don’t need for the app to regain focus just because it’s loaded



How are you launching ST? Does it happen in safe mode?



The method of launch has no effect, tried using Spotlight or double-click on the app, or via a shortcut — it always gains focus the second time after I’ve alt-tabbed away or switched some other way
Yes, it happens in Safe mode as well



It seems that ST maybe does grab focus, because launching the ST application from a terminal using:

open -g -a 'Sublime Text'

…results in ST having focus even though open's -g flag is used.

-g  Do not bring the application to the foreground.