31

I have two screens on my Windows 10 machine, and find it cumbersome to change the mouse cursor from one screen to another. The only way I know is to drag the mouse cursor from one screen to another, but that requires travelling some distance and going through the unblocked corner.

Is there a shortcut that would allow my mouse cursor to jump from one screen to another?

4 Answers4

17

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
harrymc
  • 498,455
3

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.

1

I felt the same and also I found quite frustrating that the cursor is not bounded to the sides of the display anymore. For example trying reach the "close window" button needs precise muscle control not to go over the edges. Whereas before you could simply crash again the top & right screen border and smash that window.

So I created a AutoHotKey script I refined overtime, today I'm pretty happy with the solution so I figured it could help some fellow Windows user:

  • Swiftly calculate the extend of both Display using a menu where you choose any Maximized window for each display.
  • Then on a press of a button it can determined on which display the cursor currently is and move it to the other one.
  • It saves the last position for each display and move it back to that position.
  • To avoid redoing the calibration every time it stores the display extends to %UserProfile%\display_shifter.ini
  • Highlight the arrival position of the cursor for easier spotting

More details and script file is available on the gist I created: https://gist.github.com/codekoriko/f9f2738afd253fe70c7ebc0843df3c91

note: updated the gist url

1

One solution to "move the mouse to the window that currently has keyboard focus" , which doesn't need any macro or hotkey software installed (and has existed since windows 1.0) is the the following key sequence:

[alt]+[space] 
[M]
[any arrow key] 

you can then move the mouse and the window will in be drag mode - press then release the left mouse button to exit drag mode.

this is a somewhat cumbersome solution, however if your really can't find the mouse, due to weird monitor placement, it will recover it for you.