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?

Toggle window between screen 1 and 2

Description
Created with the help of ChatGPT (I'm not a programmer, but it works well).
Language
C#.net
Minimum Version
Created By
Yirg
Contributors
-
Date Created
4d ago
Date Last Modified
4d ago

Scripted Function (Macro) Code

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)
	{
		// Get the currently focused window
		IntPtr window = BFS.Window.GetFocusedWindow();

		// Get the screen that the window is currently on
		uint currentScreen = BFS.Monitor.GetMonitorIDByWindow(window);

		// Check if the window is on Screen 1 or Screen 2 and move accordingly
		if (currentScreen == 3)
		{
			// Keep window to Screen 3
			BFS.Window.MoveToMonitor(3, window);
		}

		if (currentScreen == 1)
		{
			// Move window to Screen 2
			BFS.Window.MoveToMonitor(2, window);
		}
		else if (currentScreen == 2)
		{
			// Move window to Screen 1
			BFS.Window.MoveToMonitor(1, window);
		}

	}
}