Shortcut to jump mouse cursor from one screen to another in Windows 10

Solution 1:

Many sources can be found for Windows 10 shortcuts. For example, Gizmodo's The Ultimate Guide to Windows 10 Keyboard Shortcuts that includes:

Windows Key+Shift+Left (or Right) — move a window to your next monitor.


If your problem is moving the mouse rather than a window, you need a tool such as AutoHotKey.

Here is a script (untested) that assumes your two monitors are of the same size, that uses Ctrl+Space for this:

^Space::
  CoordMode, Mouse, Screen ; mouse coordinates relative to the screen
  MouseGetPos, MouseX, MouseY
  if (MouseX > A_ScreenWidth) {
    MouseMove, -A_ScreenWidth, 0, 0, R
  } else {
    MouseMove, A_ScreenWidth, 0, 0, R
  }
return

Solution 2:

I modified Arnaud Weil's script to make it work with my setup. First time using AutoHotKey for me.

My #1 monitor has negative Y coordinates, while #2 has positive. So I'm checking MouseY instead of MouseX. I used the debugging feature in AutoHotKey in order to determine the coordinates near the middle of each screen, and simply hard-coded those into the script.

Here's what my monitor setup looks like: Multi-monitor arrangement with small intersection at corners

Here's the code. My "what" and "huh" variables were mainly to figure out which branch of the if was executing in the debug output. Whichever variable had a value, that was the branch I was in.

^Space::
  CoordMode, Mouse, Screen ; mouse coordinates relative to the screen
  MouseGetPos, MouseX, MouseY
  if (MouseY > 0) { ; Mouse is on monitor #2
    ;what = %A_ScreenWidth% 
    ;ListVars ; uncomment for debugging
    ;Pause ; uncomment for debugging
    MouseMove, -1071, -753, 0
  } else { ; Mouse is on monitor #1
    ;huh = %A_ScreenWidth%
    ;ListVars ; uncomment for debugging
    ;Pause ; uncomment for debugging
    MouseMove, 1286, 670, 0
  }
return

This could be improved to use a more general way of determining which screen the mouse is in, and to programatically determine the center coordinates for each screen. But this works for me.

EDIT: To new user adams, who messaged me in an answer below, I've suggested in comments to write a new question. (and please upvote if this helps you, or ask a new question)

He asks about what to do with 3 screens. In my code, I simply ask "am I on screen 1" and then, if yes, move the mouse to the middle of screen 2, else move it to the middle of screen 1. That won't work with 3 screens.

For him, the if section will probably look more like this:

  if (MouseY > 0 and MouseY <= 1920) { ; assuming Monitor 1 is 1920 pixels wide
    MouseMove, 2880, 540, 0 ; move to middle of Monitor 2, center screen
  } else if (MouseY > 1920 or MouseY <= 3840 ) { ; Mouse is on monitor #2
    MouseMove, 4800, 540, 0 ; move to middle of monitor 3
  } else { ; Mouse is on monitor #3
    MouseMove, 960, 540 ; move mouse to middle of monitor 1
  }

My code above assumes that your leftmost monitor starts at 0, 0. But, in my case, my left monitor has negative coordinates while my right has positive. You might have a similar situation. The debugging code I have in my first code snippet is what I used to determine the coordinates in my setup.