How to restrict mouse to current display?
Here is my solution for my dual monitor set up - I Arranged the virtual monitors diagonally like this:
When moving the mouse slowly the cursor will not leave the current screen.
Moving the mouse fast through the gap works fine.
This works in Windows 10, I don't know if older/newer versions of windows (will) have a restriction to this.
There is a program called Dual Monitor Tools that will allow you to do this. You can download the whole set of tools or just the DMT Cursor portion that will allow you to control cursor behavior.
This image shows the options you'll want to access to set whatever behavior you need. The sticky cursor option will help prevent accedental movement between screens.
You can try the utilities like Mouse Trapper to restrict free mouse movement between the multiple monitors/screens and trap the mouse inside one display. You can still move the cursor over onto other screens by pressing a pre-selected key. Cursor Lock is another similar type of program that confines the mouse cursor to a selected area on the screen.
I made a program that addresses this: https://github.com/Eliasyoussef47/LockCursorInMonitor. You can find the latest version here
With this, holding the Ctrl key prevents the cursor from leaving the monitor it's currently on.
Why I made this:
Windows has a feature where if you drag a window to an edge of the screen (right or left) and let go it will make that window cover the half of the screen. I use this feature often and I like that I can perform it very quickly and without moving my hands from where they normally are (right hand on the mouse and the left hand on the left side of the keyboard). The problem is if you have multiple monitors you have to move the window slowly to the edge that's between monitors for this feature to work, otherwise the cursor will pass over to the next screen.
That's why I wanted a solution that allows me to very quickly and temporarily restrict the cursor on the current monitor.
How this program is different from the other solution:
The main difference is that other programs always restrict the cursor until some user input (shortcut hotkey or holding a key/button), I wanted a program that only restrict the cursor at the user's command (the opposite).
This is different from the virtual monitors arrangement option (as Stubenraupe suggested) where:
- You have to change the arrangement of your virtual monitors, so you lose the freedom of the virtual monitors and it's a hacky solution.
This is different from Dual Monitor Tools (as BrainRenticus suggested) where your options are to:
- Restrict the cursor from crossing over until a specified resistance is applied.
- Completely restrict the cursor until this feature is disabled by a shortcut, after that you'd need to turn the restriction on again with a shortcut or press and hold a key/button to allow the cursor to move freely as long as that key/button is still pressed.
The first option wasn't good enough because it's hit or miss and if you move the cursor quickly you will overpower the resistance. I want to still be able to move freely between monitors and only restrict the cursor at certain and specific time so the second option is not what I'm looking for.
This program is different from Mouse Trapper (as Sairana suggested) where your options are (I wasn't able to download this program so I'm going off of the screenshot on the website):
- Always restrict the cursor except when a key is pressed.
This program is different from Cursor Lock (as Sairana suggested) where your options are:
- Limit the cursor to a program.
- Always restrict the cursor until a shortcut is pressed. (like option 2 in Dual Monitor Tools)