using System;
using System.Drawing;
// 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)
{
// Set part of the Window Text to look for in the window title here
string targetWindowText = "*Notepad*";
// Loop forever
while (true)
{
// Get the focused window and the target window
IntPtr focusedWindow = BFS.Window.GetFocusedWindow();
IntPtr targetWindow = BFS.Window.GetWindowByText(targetWindowText);
// If the target window isn't focused and isn't already rolled up, roll it up
if (focusedWindow != targetWindow && !BFS.Window.IsWindowRolledUpToIcon(targetWindow))
{
BFS.Window.RollupWindowToIcon(targetWindow);
}
// Wait 250ms before looping to avoid running up the CPU
BFS.General.ThreadWait(250);
}
}
}