I run all of my applications in full screen mode on a laptop without an external monitor. I almost exclusively use Alfred to swap between applications, since I'm frequently moving between more than just two of them. Alfred, for context, uses the
open command to perform its application switching.
Anyway, there are several applications where, when I switch to them (doesn't matter where I'm coming from), the desktop switches to Space 1 (which is the empty space containing only Finder) and the main application actually switches to Finder. I can hit Cmd-Tab once to get to the intended application (note that this means the target application moved in the list order, since tabbing once would otherwise result in returning to where I came from), but obviously that's another step that is undesirable. To make matters worse, it is somewhat nondeterministic (I'd say it happens around 60-70% of the time), so I never really know if I'm going to "make it" when I try to switch apps.
A non-exhaustive list of applications where I've seen this happen (again, swapping to, not from):
- Sublime Text 3
- Calendar (like, the first-party Apple Calendar)
- Mail (very rarely)
I've never (not even once) seen this glitch happen with the following applications:
Put another way, the symptoms here are similar to what happens if you disable the "When switching to an application, switch to a Space…" option in the Mission Control preferences, but not quite the same. Toggling that setting has an effect, but doesn't fix the problem. With the setting off, what happens is the focused application will switch reliably to my target app (I don't get "intercepted" by Finder), but the space doesn't switch. Which is to be expected, since that is the intended behavior of the setting.
To make matters even more confusing… I enabled the hidden "Quit the Finder" menu option and shut down Finder. So that left me in a situation where nothing was active on Space 1 and all of the applications were in fullscreen. I then tried to switch to one of the problematic apps. The results were that I was switched to Space 1, but the focused application was my target (presumably since Finder wasn't available to intercept).
It's almost like what's happening is the window manager is sometimes failing to switch me to the space which contains my target application (e.g. Slack) and instead switches me to Space 1, at which point the default "on switching into a space" behavior takes over and focuses the most-recently used application on that space. And this behavior is independent of what applications are open on Space 1, but is somehow dependent on the application I'm swapping to.
I've been using Alfred (and QuickSilver before it) to switch applications basically since Mac OS X 10.2, and this is the first time I've ever seen anything like this. I've also seen this across two completely distinct laptops with entirely separate user accounts, settings and application setups (modulo some overlap, such as Alfred, Dropbox, etc). I'm basically out of crazy ideas to even debug the issue. Help?
(btw, I actually never use Finder, so I would legitimately accept a solution which kills Finder and removes Space 1 altogether, but I doubt that is possible)
Update The semantics of this problem appear to have changed in 10.12.2. Specifically, now the application deterministically gets focus, but the space still often gets "stuck" on space 1. So it's now almost identical to having the "When switching to an application" setting deactivated.
Even more interestingly, I've now seen it occasionally with Cmd-Tab, but only when the system is under high load.