When I switch desktops in macOS with multiple displays, why is focus switching to another unexpected application (iTerm2 or VSCode in my case)? [closed]
Asked Answered
P

3

14

I have a MacBook Pro running Catalina with an additional display. I typically have my development-related apps on one display (iTerm2, VSCode, etc.) and everything else on the other display (Chrome, Slack, etc.)

Sometimes (not all the time), when I switch desktops (Ctrl+left or Ctrl+right), access an app using Spotlight (Cmd+space and type), or use Cmd+Tab to switch applications, the focus would suddenly jump to iTerm2 or VSCode. This happens even if iTerm2 or VSCode isn't currently showing; for example, if I try to switch to Chrome on display 1 and iTerm2 is on a different hidden desktop on display 2, Chrome would appear on display 1 and then display 2 would show the desktop containing iTerm2 sliding into view (along with focusing iTerm2).

This severely impacts workflow, since this behavior is unpredictable and involves a lot of typing in the wrong application and reaching for the mouse. What is causing this behavior?

Pepperandsalt answered 14/3, 2020 at 17:5 Comment(6)
Do you have any of these apps open in fullscreen? I find that using Cmd+Tab to switch focus works poorly if one of the apps in between is open in fullscreen (it doesn't necessarily bring the fullscreen app into focus).Nath
Yes I specifically have iTerm2 and VSCode in full screen, but my problem is different--I don't want a full-screen app to enter focus, but it does against my will. Let's say that I have Slack not in focus on my left screen (some other app on my left screen is in focus), and Chrome on my right screen (with iTerm2 in full-screen mode on another desktop). When I try to switch my focus to Slack either through Ctrl+left/right or Spotlight, macOS inexplicably makes iTerm2 on the other screen focused.Pepperandsalt
I think I have the same issue. It not only happens using Ctrl+left or Ctrl+right but also with mouse gestures on my Logitech MX Master 3. In my case I have Microsoft Outlook full-screen on the other display, and it gets focus instead of iTerm2 or Firefox or VSCode or whatever is shifted into view. Outlook seems to grab focus even if it is the last app on the Cmd-tab list, and even if there are other apps currently displaying full screen on the other display.Killick
I have same problem with chrome and vscode on separate desktops.Felloe
Exit fullscreen view of the app causing the problem (iTerm 2 in your case) and then make it fullscreen again. This solves the exact problem I have.Hefty
having the same problem for me.... I am using MacOS Catalaina 10.15.3Shull
B
4

I found that it only happens when I have windows of the same app on both screens.

Say I switch desktop on a screen 1 and Chrome should become active there, then if I also have a Chrome window on my screen 2, it's actually the one on screen 2 that becomes active. Very frustrating..

Bethink answered 25/11, 2021 at 22:15 Comment(2)
This. Still happens in Monterey as of Feb. 2022, though. Very frustrating indeed.Danita
I just closed a Finder window in another workspace and that solved the issue for me. Thanks for giving me the idea.Comus
D
2

This bug still exists in macOS Big Sur 11.4. Another symptom is that, after the erroneous focusing happens, manually switching to a space with no windows in it will leave that focused app focused, after briefly focusing Finder, rather than just focusing Finder. It's this last erroneous focusing that causes the space-switching.

Workaround: when it happens, invoke "Show All" from the menu bar (I have a keyboard shortcut for this). Note that switching to an empty space now does a single focusing of Finder, and no further space-switching happens.

Dierdre answered 9/6, 2021 at 22:38 Comment(0)
B
1

I'm ready to throw out my MacBook and go back to the PC. It's extremely unproductive compared to the PC for this sole reason. Half my day is spent trying to get back to what I was working on because the system changes context across all screens, replacing what should be in focus with something related to what was triggered on a separate screen. The screens don't behave mutually exclusively. This laptop is for the single screen user...the coffee shop kids. While using multi-screens, I consider it about as unintuitive as it gets. Running Ventura 13.2.1.

Bonitabonito answered 1/3, 2023 at 20:18 Comment(2)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewAnalects
Upvote for this "answer" because it just perfectly describes my mood right now.Bs

© 2022 - 2024 — McMap. All rights reserved.