3

I want to prevent switching window on other desktop in this case:

  • Open app A background and app B foreground on desktop 2
  • Switch to desktop 1
  • Switch to another window of app A on desktop 1
  • Switch to desktop 2
  • There is a first window of app A foreground for some reason

How to prevent MacOS from switching to app A on all desktops after switching to just one window of the app on one desktop?

MacOS 13.2.1

2
  • I don't have Ventura, but I can't repro this behaviour. How are you switching Spaces? Ctrl[num], trackpad swipe? Default behaviour ought to be that any Space you traverse to should bring forward the last app that was frontmost in that Space. [This doesn't apply if you Cmd/Tab to switch apps, or if any Space is fullscreen].
    – Tetsujin
    Commented Apr 9, 2023 at 6:27
  • A proviso on the above default is that if there is no other app in the Space you traverse to, then the only app in that Space will come to the front, the last resort being Finder.
    – Tetsujin
    Commented Apr 9, 2023 at 8:58

3 Answers 3

6

The Mission Control system setting "When switching to an application, switch to a space…" is misleading and always doesn't work as described. My best guess is that the behavior can be overridden per app, and consequently the system setting sometimes has no effect, but that's merely a guess. For example, ⌘+tabbing to Mail will switch to a desktop with an open mail viewer regardless of the global setting.

There is, however, an under-the-hood Dock preference that can be set via Terminal.

defaults write com.apple.dock workspaces-auto-swoosh -bool FALSE
killall Dock

Note that this disables the behavior entirely, which may not suit everyone. Reverse it with:

defaults write com.apple.dock workspaces-auto-swoosh -bool TRUE
killall Dock
1
  • 1
    killall Dock doesn't restart the Dock in Ventura or Sonoma anymore. Use launchctl stop com.apple.Dock.agent instead.
    – Seth
    Commented Apr 16 at 22:41
2

The document Work in multiple spaces on Mac has this text in the section "Assign apps to spaces":

By default, when switching to an app, the desktop automatically switches to a space that has open windows for the app. For example, if you create a new TextEdit document in Desktop 3, but TextEdit windows are already open in Desktop 2, your new document opens in Desktop 2. To change this setting, choose Apple menu > System Settings, click Desktop & Dock in the sidebar, go to Mission Control on the right, then turn “When switching to an application, switch to a Space with open windows for the application” on or off.

Changing this setting might fix this behavior.

EDIT: This setting had no effect on the poster's problem. I'm leaving this answer here as it might help other users.

10
  • This is kind of the inverse of what the OP seems to be asking. They're switching Spaces, not Apps.
    – Tetsujin
    Commented Apr 9, 2023 at 6:24
  • It's a little different case. Mac does not switch space by itself when I switch to some app on some desktop (space). Mac switches app on all another spaces to foreground instead of switch to window of that app only on current space. Commented Apr 9, 2023 at 7:52
  • So this setting has no effect on the problem?
    – harrymc
    Commented Apr 9, 2023 at 8:15
  • Yep, no effect turned on or off Commented Apr 9, 2023 at 9:43
  • I think your problem is the one discussed in the post Prevent macOS from bringing all windows to front when switching to an app. Let me know if you like any of the answers in this post and I will rewrite my answer accordingly.
    – harrymc
    Commented Apr 9, 2023 at 9:59
0

I fixed this problem by unsetting Desktop assignment to the specific Desktop. Try to set Options->Assign To->None in Dock for application A as on screenshot below.

Screenshot:
Screenshot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .