I am trying to build a hotscript (ctrl-alt-x) that runs a function to move a window to my left monitor. However, I have different monitors when at work and when at home. I created multiple monitor profiles to handle this and want the move coordinates modified depending on which monitor is selected. However the GetCurrentMonitorProfile() function only returns a value if the first monitor function is selected. To verify this is happening in my function I added a "BFS.Dialog.ShowMessageError(BFS.DisplayFusion.GetCurrentMonitorProfile());" to my script to show me which monitor profile is selected. If I pick the first monitor profile, run the function, the dialog box shows the name of the selected first monitor profile. If I pick any other monitor profile then the dialog box is empty. This is causing the if else statement to fail to trigger. I am running Display Fusion 11.2 on Windows 11. I have tried renaming the monitor profiles, but that does not seem to matter. I am not even sure if it is just the first one that works but in my case only that one works.
The monitor profiles I have are
HOME (Center Monitor Center) This one works
HOME (Center Monitor Low) Not work if selected
Laptop + Portable Monitor (Left) Not work if selected
Laptop + Portable Monitor (Right) Not work if selected
WORK3 Not work if selected
using System;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
BFS.Dialog.ShowMessageError(BFS.DisplayFusion.GetCurrentMonitorProfile());
if (BFS.DisplayFusion.GetCurrentMonitorProfile() == "HOME (Center Monitor Center)")
{
BFS.Window.SetSize(windowHandle, 2160, 2100);
BFS.Window.SetLocation(windowHandle, -2160, 0);
}
else if (BFS.DisplayFusion.GetCurrentMonitorProfile() == "WORK 3")
{
BFS.Window.SetSize(windowHandle, 1440, 1572);
BFS.Window.SetLocation(windowHandle, -1440, 1572);
}
}
}
Any ideas what is going on?