12

I have my laptop (M1, Big Sur 11.3 Build 20E5186d) and a second monitor. I split up my virtual desktops into "topics" so I can better handle the big amount of open windows and applications.

On my laptop, I have virtual Desktops 1,2,3,4,5. On my second monitor, I have 6,7,8,9,10.

The virtual Desktop topics are kind of "paired" with topics, so e.g. when I am working on coding tasks, I use Desktop 1 (on the laptop) and Desktop 6 (on the second monitor), which both have relevant apps and windows open.

Now, when I want to switch to another topic, e.g. to Desktop 2 (where I have coding-related but not task-necessary windows open) I also want the second monitor to simultaneously switch to Desktop 7 (basically one virtual Desktop to the right on each device).

Is there such a possibility/feature?


Update

So far I only tested the solution of changing the Mission Control settings (see the accepted answer). However, it has a quite annoying drawback:

When the Displays do NOT have separate Spaces, every time I start the Mac and it wakes up from sleep mode, all windows are rearranged back on my laptop (not on my second monitor anymore). This is caused due to the Display Port automatically being disconnected every time the Mac goes into sleep mode. This means I have to rearrange my windows every time I start my Mac, which becomes tedious quite fast.

So far, I did not find a satisfying solution that also is relatively simple to do. The second solution to the accepted answer seems like a good workaround, but I do not feel comfortable disabling the system-integrity protection for that. The issue is simply not big enough for me...but this is just my personal cost-benefit calculation. I can imagine, that if someone has more than two monitors and want to switch spaces on specific monitors simultaneously (e.g. when switching spaces on monitor 1, it should also switch on monitor 3, but not on 2) it definitely be worth doing it.

Feel free to add an answer if you find another (more simple) solution.

4
  • Welcome to Ask Different. This is an excellent question. If you want software recommendations to automate this, please edit that tag. I’m guessing you are asking a yes - Apple can do this or no - Apple doesn’t synchronize this, you need a window manager type question.
    – bmike
    Mar 24 at 14:20
  • Can you say what you mean, here, by "simultaneously"? How is it not clear that monitors - two or 37 or 498 of them - can't matter? How you explain "desktops…", real or virtual, is vital. Looking back, either you can explain how "Desktop 2… and Desktop 7" are linked, or your Question trips over its own bootstraps. Here, which is it? Mar 25 at 22:26
  • 1
    @RobbieGoodwin, in my question I am explicitly asking about virtual Desktops. Can you please explain to me how I could have 5 real Desktops on my laptop and 5 real Desktops on my monitor? Also, my questions were answered pretty fast and I am satisfied with the answers... I honestly do not see how my question trips over any bootstraps. I will edit the question and add the word "virtual" for you.
    – Mikhail
    Mar 26 at 10:14
  • @Mikhail It doesn't matter since you've got workable Answers, and still desktops are not virtual desktops are not monitors… s'all. Mar 28 at 19:43
13

Option 1: Mission-Control Setting "Displays have separate Spaces"

I'm not entirely sure if this is what you're looking for:

If you go to "System Preferences" ➝ "Mission Control", then uncheck "Displays have separate Spaces":

System Preferences

This will couple the spaces of all screens. So if you swipe or switch to another space on one screen, the other screens will also switch to the corresponding space.

Option 2: Use a window manager

If you would like to configure the behaviour and the keyboard shortcuts exactly the way you want and you are willing to spend some time to configure it, consider using a window manager. A nice window manager for macOS is yabai.

yabai is a window management utility that is designed to work as an extension to the built-in window manager of macOS. yabai allows you to control your windows, spaces and displays freely using an intuitive command line interface and optionally set user-defined keyboard shortcuts using skhd and other third-party software.

  1. Install the homebrew package manager

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Install yabai

    brew install yabai
    
  3. For switching spaces to work, you might also need to disable the system-integrity protection: https://github.com/koekeishiya/yabai/wiki/Disabling-System-Integrity-Protection -- Maybe have a look at the wikipedia article to decide whether you are ok with that.

  4. Make sure to install and load yabai's scripting addition

    sudo yabai --install-sa
    sudo yabai --load-sa
    
  5. Depending on whether you would like to use window tiling, window-focus features etc., configure yabai in the ~/.yabairc file.

  6. In order to bind window-manager commands to keyboard shortcuts, install skhd:

    brew install koekeishiya/formulae/skhd
    brew services start skhd
    
  7. Configure shortcuts in ~/.skhdrc. For example, to bind Command+Ctrl+1 to switch to spaces 1 (on screen 1) and 6 (on screen 2), and to bind Ctrl+1 to switch to space 1 (on screen 1) only, use this configuration:

    # ~/.skhdrc
    ctrl - 1 : yabai -m space --focus 1
    cmd + ctrl - 1 : yabai -m space --focus 1 && yabai -m space --focus 6
    
5
  • Thanks for the quick reply! I hoped there would be something like a key combination, so I can manually decide if I want to switch both virtual desktops simultaneously or just the one where my focus is, but I guess this solution is good enough for most cases :)
    – Mikhail
    Mar 24 at 15:30
  • 1
    I think, one can configure yabai with skhd to do something like this. Let me give that a try …
    – fiedl
    Mar 24 at 19:28
  • Oh so cool, thank you very much for looking into it :) I am relatively new to coding (self-taught). Only used git for uploading my stuff, but don't have any experience integrating programs from git into anything. So if this works, please let me know what the steps are to implement it! But otherwise, I am already happy that it works "almost" as intended :)
    – Mikhail
    Mar 24 at 20:37
  • I've added some instructions for configuring the yabai window manager. Let me know if it works. As I have yabai already installed on my system, I might have left out some steps, in particular on how to load it automatically on system startup.
    – fiedl
    Mar 24 at 21:43
  • Wow, thank you so much!! For now, I am honestly not sure if I want to go as deep as to disable the system-integrity protection since my biggest issue was solved by the first solution. However, the first solution has little drawbacks: when I wake up my laptop from sleep mode, all my windows are back on the laptop screen and the second screen is empty. I think this is caused, by the fact that the Display Port disconnects when the laptop goes into sleep mode. I just disabled sleep mode and will see how it works out. If I decide to use the second option, I will update here :) Big thanks again!
    – Mikhail
    Mar 25 at 11:55
7

If your 'pairs' are always the same combinations 1&6, 2&7 etc, then switching off 'Displays have separate Spaces' will solve it - though you'll have to set your pairs up again initially as it won't combine your existing screens intelligently.

enter image description here

If you need anything more complex/flexible, then you'd probably be looking at something 3rd party.

1
  • 1
    Thanks for the quick reply! It actually solved my problem. I hoped there would be something like a key combination, so I can manually decide if I want to switch both virtual desktops simultaneously or just the one where my focus is, but I guess this solution is good enough for most cases :)
    – Mikhail
    Mar 24 at 15:28

You must log in to answer this question.

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