Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
DRoam
7 discussion posts
I would like for DisplayFusion to add a keyboard modifier to keep the cursor from crossing monitor borders. Here's why.

PROBLEM 1: When you add a display to the left, right, or above your main display, you suddenly lose the super handy ability to snap windows to the left or right half of your screen by dragging them to the side edges, or to maximize by dragging to the top edge.

PROBLEM 2: When you add a display to the left, right, or above your main display, you also lose the ability to jam the cursor quickly against an edge, such as the top edge to click internet browser tabs, or into the corner to click the close/restore/minimize buttons, etc. You now have to gently ease the cursor to corners or edges of your screen whenever you need to click these commonly-used buttons.

SOLUTION: If you could hold down a key and prevent the cursor from crossing over to the next display, you could hold the key and get back the ability to snap windows by dragging them to the left, right, or top edge of the screen you're on. You could also hold the modifier key and be able to run the cursor up to your browser tabs or window close/restore/minimize buttons without it shooting past them into the next monitor.

This is similar to another feature request I made here, but that is for automatically sticky edges between specific displays, as opposed to a keyboard modifier to manually activate sticky edges.

Thanks!
Oct 23, 2015 (modified Oct 23, 2015)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Thanks! I've added this to the feature request list as well :)

In the meantime, you can assign a key combination to the "Lock/Unlock Mouse Cursor to Current Monitor" function. It's not quite as seamless, as it's just as straight toggle on/off, but hopefully that will help.

Thanks!
Oct 23, 2015  • #2
User Image
DRoam
7 discussion posts
Thanks!! That is a possibility but it takes a few nano-seconds too long ;)

I'm joking but I'm serious. As you probably know, when you're blazing through a workflow, every keystroke, click, and drag makes a difference. Especially when it comes to common tasks like moving windows around.

On that note, it would be brilliant if instead of holding down a keyboard modifier, we could choose to hold down the right mouse button when dragging a window to activate the screen borders. That way we could get back window snapping just using the mouse, without even needing to use the other hand to hold down a key.

Just an idea. As always thanks for the quick response and for adding the feature request!
Oct 27, 2015  • #3
User Image
DRoam
7 discussion posts
Quote:
Thanks! I've added this to the feature request list as well :)

In the meantime, you can assign a key combination to the "Lock/Unlock Mouse Cursor to Current Monitor" function.

Thanks!


Also, as another note, I tried this and locking the cursor to the current monitor doesn't currently enable window snapping. This is probably a Windows limitation, as Windows still knows that the edge of the screen isn't an edge of the display area. So it would be necessary to include some way to trick Windows into snapping windows when the cursor is right at the seam between two displays, or to add DisplayFusion's own way of mimicking the snap functionality when snapping to a border between two displays. Hope that made sense.
Oct 27, 2015  • #4
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Yeah, that's a Windows limitation unfortunately. That issue is solved in Windows 10 though :)
Oct 28, 2015 (modified Oct 28, 2015)  • #5
User Image
Venryx
2 discussion posts
Regarding your mouse-lock request, I thought I'd mention that I had the same request, and managed to implement it using a custom script function.

Function description: Pressing and releasing this function's hotkey locks the mouse to the current monitor. It's then kept locked until you *press and hold down* the hotkey. While it's held down you can freely move between monitors. Once released, it gets locked again to the new current monitor.

I've submitted it for inclusion to the script repository, but in the meantime, here's the script code:

Code

using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;

public static class DisplayFusionFunction
{
    // update this value to match the hotkey you've assigned to this function -- ignoring ctrl, alt, etc. (I use Alt+A)
    static Keys hotkeyKey = Keys.A;

    [DllImport("user32")]
    static extern bool GetAsyncKeyState(int vKey);
    
    public static void Run(IntPtr windowHandle)
    {
        // if cursor is already unlocked by hotkey, don't start hotkey function again
        if (BFS.ScriptSettings.ReadValueBool("Cursor unlocked")) return;
    
        // unlock the mouse cursor since hotkey has been pressed down
        Cursor.Clip = Rectangle.Empty;
        BFS.ScriptSettings.WriteValueBool("Cursor unlocked", true);
        
        // wait until the hotkey is released
        while (GetAsyncKeyState((int)hotkeyKey)) {
            Thread.Sleep(10);
        }
        
        // then lock the mouse cursor again
        Cursor.Clip = BFS.Monitor.GetMonitorBoundsByMouseCursor();
        BFS.ScriptSettings.WriteValueBool("Cursor unlocked", false);
    }
}
Nov 5, 2018  • #6
Michelle Ellis' profile on WallpaperFusion.com
I'm sorry to add to this old thread but I'm trying to do something verysimilar to this... unfortunately my scripting ability is pretty basic.

I want to have the ability to have my mouse cursor locked to the current monitor only while my left mouse button is held down (then unlocked again on left mouse button up).

I was trying to modify Venryx's code but I just kept failing :| is what I'm trying to do even possible?

I could probly do this in autoit (I'm used to that) but autoit interferes with the program I want to use this on LOL
Dec 22, 2018  • #7
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)