Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
Parallax Abstraction
34 discussion posts
Hey all. I'm not sure if this can be dealt with or not but I'm hoping so. I'm using DisplayFusion profiles to switch between two configurations: One is both of my monitors on my desk and the other is just my TV, which is plugged into an HDMI port. I switch between them when I'm playing games on the couch or just at my desk. The problem is, when I switch back from the TV, all of the windows that were on the primary display suddenly end up on my second monitor and have to be manually dragged back to my main monitor.

I'm not sure why this is as the monitor these windows normally live on is configured as Primary Display on that profile and obviously, the TV is Primary Display on its profile as it's the only one being used. It's a real pain to have a pile of applications on the wrong monitor when I switch back from the TV.

Anyone potentially know a solution to this? Thanks so much!
Nov 21, 2016  • #1
User Image
Parallax Abstraction
34 discussion posts
I should mention as well that this evening, I tried to see if there was a way I could just move the windows that end up on the wrong screen to the proper screen by using a Monitor Profile Changed trigger. Unfortunately, while you can pick a scripted action to move a window to a screen, you can't specify the process name when using Monitor Profile Changed. I tried creating a custom Manage Window action as well but while I could select an application's window to generate sizing parameters and such, it didn't seem to retain the actual process name.
Nov 22, 2016 (modified Nov 22, 2016)  • #2
User Image
Witchy2
23 discussion posts
Hi,

I had a similar issue with 4 network monitoring screens at work that are HDMI attached so windows would move around if a screen was turned off accidentally. I created 2 monitor profiles (essentially 'all 4 on' and 'none') and with the help of the 'list open window information' script here wrote a browser control script that would detect the required browsers' presence and move the windows back accordingly, starting new instances if any had crashed. I haven't uploaded it to the community yet.

However, if you need things other than browsers you could use this simple one as a start:

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
public static void Run()
{
        // Get all window handles
        IntPtr[] windowHandles = BFS.Window.GetAllWindowHandles();
        
        // Loop through the window handles and if their title contains *all subreddits*Waterfox* or *Inbox*Waterfox*, move them to monitor 3 and maximize
        foreach (IntPtr window in windowHandles)
        {
            string windowTitle = BFS.Window.GetText(window);
            if (windowTitle.Contains("Engineering") && windowTitle.Contains("Summary")) 
                BFS.Window.MoveToMonitorMaximized(3, window);
            if (windowTitle.Contains("Internet") && windowTitle.Contains("Explorer")) 
                BFS.Window.MoveToMonitor(2, window);
            //if (windowTitle.Contains("Current") && windowTitle.Contains("Assignment")) 
            //    BFS.Window.MoveToMonitorMaximized(2, window);
            //if (windowTitle.Contains("Current") && windowTitle.Contains("Support")) 
            //    BFS.Window.MoveToMonitorMaximized(2, window);
            }
}
}


Change the search strings to match your usual active window titles and assign to a trigger that fires on change of monitor profile, eg when the TV turns off.

You can also assign a hotkey sequence to it to run at any time.

Cheers

W
Nov 23, 2016  • #3
User Image
Parallax Abstraction
34 discussion posts
Wow, this is awesome! I'm definitely going to try this out. Thank you!
Nov 30, 2016  • #4
User Image
Parallax Abstraction
34 discussion posts
This was exactly what I needed! I just tried it out and it does exactly what I need. Thanks so much!
Nov 30, 2016  • #5
User Image
Witchy2
23 discussion posts
Glad to be of service :)
Dec 1, 2016  • #6
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)