MacOS – How to navigate spaces in a dual monitor setup

dual-screenkeybindingsmacosspaces

I have multiple spaces setup and can navigate them via ctrl and the arrow keys left and right on the current active monitor.

Now I want to change to a space that sits on the other monitor.

How do I switch there? I am looking for a keyboard only solution.

Best Answer

Here's a shell one-liner that will do what you ask:

cliclick -r m:=-50,300 w:50 kd:ctrl kp:arrow-left ku:ctrl w:50
  • cliclick is a tool to move the mouse and is unfortunately necessary for this
  • -r: When done, move the mouse back to where it was when it started
  • m:=-50,300: move the mouse to the coordinates (-50, 300). The = is to actually do negative x values (for another monitor) rather than relative
  • w:50: wait 50 milliseconds
  • kd:ctrl: Press control key
  • kp:arrow-left: Press and release the left arrow
  • ku:ctrl: Release control key
  • w:50: wait 50 milliseconds

(0,0) is the upper left corner of the primary monitor.