<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>DisplayFusion RSS: Move window and mouse to specific monitor split?</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2</link>
<description>DisplayFusion RSS: Move window and mouse to specific monitor split?</description>
<lastBuildDate>Fri, 08 May 2026 09:46:41 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2</generator>
<item>
<title>RE: Move window and mouse to specific monitor split?</title>
<link>https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2#4</link>
<pubDate>Wed, 10 Apr 2024 14:29:06 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2#4</guid>
<category>DisplayFusion</category>
<description><![CDATA[I don't think there's a way to do what you're looking for all in one script. You'll need to separate them into 4 scripts, with your hotkey for each attached to each direction.]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I don't think there's a way to do what you're looking for all in one script. You'll need to separate them into 4 scripts, with your hotkey for each attached to each direction.
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=018e9ec9-0941-770a-8de2-4865c540af9a"/>
</item>
<item>
<title>RE: Move window and mouse to specific monitor split?</title>
<link>https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2#3</link>
<pubDate>Thu, 04 Apr 2024 14:18:47 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thanks! See attached for updated function.
Is there a way to pass a parameter to a function? So I have hotkeys for moving the window up,down,left, or right, but for now, I need to duplicate the same function for all four actions and modify a variable to tell the function which direction is invok...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks! See attached for updated function.<br/>
<br/>
Is there a way to pass a parameter to a function? So I have hotkeys for moving the window up,down,left, or right, but for now, I need to duplicate the same function for all four actions and modify a variable to tell the function which direction is invoked.<br/>
<br/>
But perhaps I'm pointlessly over-complicating a simple system. Last thing I want is to reduce responsiveness. I've noticed that if I haven't used a hotkey recently, it takes a few seconds for it to react. Maybe it gets unloaded from memory to reduce memory usage? Maybe all functions with hotkeys should always be in memory?<br/>
<br/>
I'm using this function with an Apple Magic Trackpad on Win10 via github drivers that implement the Windows Precision Touch Protocol. Windows lets me assign custom gestures to keystrokes so now I have four-finger swipe up/down/left/right to match the DF hotkeys of crtl-alt-up/down/left/right to move windows between splits.<br/>
<br/>
Neat thing I just found out is that I can use the SHIFT key to modify the above gestures. So in DF, I have ctrl-alrt-SHIFT-up/down/left/right run functions that expand the window size to include the split in the chosen direction. So without changing the four-finger swipe settings in windows, I can use the same gestures with the SHIFT button to expand a window.<br/>
<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019e06fb6d89764a8ebd54ed1c55dd7e" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019e06fb6d89764a8ebd54ed1c55dd7eJs'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019e06fb6d89764a8ebd54ed1c55dd7eJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

// move window under mouse up split

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
    
    public static void Run(IntPtr windowHandle)
    {
        string direction = "up";
        
        // Get the window under the mouse
        IntPtr windowUnderMouse = BFS.Window.GetWindowUnderMouse();

        uint sourceMonitor = BFS.Monitor.GetMonitorIDByWindow(windowUnderMouse);    
        uint targetMonitor = 1;
        
        switch(direction){
            case "up":
                switch(sourceMonitor){
                    case 201:
                        targetMonitor = 202;
                        break;
                    case 202:
                        targetMonitor = 201;
                        break;    
                    case 203:
                        targetMonitor = 1;
                        break;
                    case 204:
                        targetMonitor = 203;
                        break;
                    case 205:
                        targetMonitor = 1;
                        break;
                    case 206:
                        targetMonitor = 205;
                        break;
                    case 207:
                        targetMonitor = 208;
                        break;
                    case 208:
                        targetMonitor = 207;
                        break;
                    case 1:
                        targetMonitor = 206;
                        break;
                }
                break;
            case "down":
                switch(sourceMonitor){
                    case 201:
                        targetMonitor = 202;
                        break;
                    case 202:
                        targetMonitor = 201;
                        break;    
                    case 203:
                        targetMonitor = 204;
                        break;
                    case 204:
                        targetMonitor = 1;
                        break;
                    case 205:
                        targetMonitor = 206;
                        break;
                    case 206:
                        targetMonitor = 1;
                        break;
                    case 207:
                        targetMonitor = 208;
                        break;
                    case 208:
                        targetMonitor = 207;
                        break;
                    case 1:
                        targetMonitor = 205;
                        break;
                }
                break;
            case "right":
                switch(sourceMonitor){
                    case 201:
                        targetMonitor = 203;
                        break;
                    case 202:
                        targetMonitor = 204;
                        break;    
                    case 203:
                        targetMonitor = 205;
                        break;
                    case 204:
                        targetMonitor = 206;
                        break;
                    case 205:
                        targetMonitor = 207;
                        break;
                    case 206:
                        targetMonitor = 208;
                        break;
                    case 207:
                        targetMonitor = 201;
                        break;
                    case 208:
                        targetMonitor = 202;
                        break;
                    case 1:
                        targetMonitor = 1;
                        break;
                }
                break;
            case "left":
                switch(sourceMonitor){
                    case 201:
                        targetMonitor = 207;
                        break;
                    case 202:
                        targetMonitor = 208;
                        break;    
                    case 203:
                        targetMonitor = 201;
                        break;
                    case 204:
                        targetMonitor = 202;
                        break;
                    case 205:
                        targetMonitor = 203;
                        break;
                    case 206:
                        targetMonitor = 204;
                        break;
                    case 207:
                        targetMonitor = 205;
                        break;
                    case 208:
                        targetMonitor = 206;
                        break;
                    case 1:
                        targetMonitor = 1;
                        break;
                }
                break;                
        }
                
        BFS.Window.MoveToMonitor(targetMonitor, windowUnderMouse);
        BFS.Window.Maximize(windowUnderMouse);
        Rectangle targetMonitorBounds = BFS.Monitor.GetMonitorBoundsByID(targetMonitor);
        Point targetMousePosition = new Point(targetMonitorBounds.X + (targetMonitorBounds.Width / 2), targetMonitorBounds.Y + (targetMonitorBounds.Height / 2));
        BFS.Input.SetMousePosition(targetMousePosition.X, targetMousePosition.Y);        
    }
}</pre><textarea id="code019e06fb6d89764a8ebd54ed1c55dd7e" name="code019e06fb6d89764a8ebd54ed1c55dd7e" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=018e9ec9-0941-770a-8de2-4865c540af9a"/>
</item>
<item>
<title>RE: Move window and mouse to specific monitor split?</title>
<link>https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2#2</link>
<pubDate>Wed, 03 Apr 2024 14:34:28 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[We don't have a built in function for moving the mouse to a target monitor. Try this:
Line 53:
BFS.Window.MoveToMonitor(targetMonitor, windowUnderMouse);
Line 54-57:
uint targetMonitor = 1;
Rectangle targetMonitorBounds = BFS.Monitor.GetMonitorBoundsByID(targetMonitor);
Point targetMousePos...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
We don't have a built in function for moving the mouse to a target monitor. Try this: <br/>
<br/>
Line 53: <br/>
<br/>
BFS.Window.MoveToMonitor(targetMonitor, windowUnderMouse);<br/>
<br/>
Line 54-57: <br/>
<br/>
uint targetMonitor = 1;<br/>
Rectangle targetMonitorBounds = BFS.Monitor.GetMonitorBoundsByID(targetMonitor);<br/>
Point targetMousePosition = new Point(targetMonitorBounds.X + (targetMonitorBounds.Width / 2), targetMonitorBounds.Y + (targetMonitorBounds.Height / 2));<br/>
BFS.Input.SetMousePosition(targetMousePosition.X, targetMousePosition.Y);
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=018e9ec9-0941-770a-8de2-4865c540af9a"/>
</item>
<item>
<title>Move window and mouse to specific monitor split?</title>
<link>https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2</link>
<pubDate>Tue, 02 Apr 2024 12:22:29 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/move-window-and-mouse-to-specific-monitor-split/?ID=018e9ec2-c68e-76a9-ab62-a4b6776d83a2</guid>
<category>DisplayFusion</category>
<description><![CDATA[I'm trying to create hotkeys to move the window under the mouse to an adjacent split. I don't want just move to next/prev but support up and down. Up and down is a bit harder to do so I just hardcode the destination split dpending on the current split.
But I can't seem to get it to do anything. ...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I'm trying to create hotkeys to move the window under the mouse to an adjacent split. I don't want just move to next/prev but support up and down. Up and down is a bit harder to do so I just hardcode the destination split dpending on the current split.<br/>
<br/>
But I can't seem to get it to do anything. Maybe I'm using function "Move Window to Monitor X#" wrong?<br/>
<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019e06fb6da4721b82091c5f49716601" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019e06fb6da4721b82091c5f49716601Js'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019e06fb6da4721b82091c5f49716601Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

// move window under mouse "up"

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
    
    public static void Run(IntPtr windowHandle)
    {
        
        // Get the window under the mouse
        IntPtr windowUnderMouse = BFS.Window.GetWindowUnderMouse();

        uint sourceMonitor = BFS.Monitor.GetMonitorIDByWindow(windowUnderMouse);    
        uint targetMonitor = 1;
        switch(sourceMonitor){
            case 201:
                targetMonitor = 202;
                break;
            case 202:
                targetMonitor = 201;
                break;    
            case 203:
                targetMonitor = 1;
                break;
            case 204:
                targetMonitor = 203;
                break;
            case 205:
                targetMonitor = 1;
                break;
            case 206:
                targetMonitor = 205;
                break;
            case 207:
                targetMonitor = 208;
                break;
            case 208:
                targetMonitor = 207;
                break;
            case 1:
                targetMonitor = 204;
                break;
        }
        
        BFS.DisplayFusion.RunFunction("Move Window to Monitor {targetMonitor}");
        BFS.DisplayFusion.RunFunction("Move Mouse Cursor to Monitor {targetMonitor}");
    }
}</pre><textarea id="code019e06fb6da4721b82091c5f49716601" name="code019e06fb6da4721b82091c5f49716601" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=018e9ec9-0941-770a-8de2-4865c540af9a"/>
</item>
</channel>
</rss>