I rewrote the lua scripts. My use case is for the left(vertical) and right(big one) monitors are:
- If swiped left, move the active window to the left monitor and set the width to monitor width and height to 500, and windows top position is pre-configured for some apps.
- If swiped right move the active window to the right monitor and toggle maximize.
- Above 2 configs should not work for my shortcut app(app width change brokes usability).
- If window is already on the left monitor, left swipe does nothing.
- If window is already on the right monitor, right swipe toggles maximization
process_name=acGetExecutableName(acGetForegroundWindow())
if process_name ~= "Turbolaunch.exe" then
current_window=acGetForegroundWindow()
current_window_x=acGetWindowLeft(acGetForegroundWindow(), gsx, gsy)
current_window_y=acGetWindowTop(acGetForegroundWindow(), gsx, gsy)
-- acMessageBox("X: "..tostring(current_window_x).." Y: ".. tostring(current_window_y), "Current Window X Y Coords Is:", nil)
monitor_on_current_window=acGetMonitorFromPoint(current_window_x, current_window_y)
monitor_name=acGetMonitorName(monitor_on_current_window)
-- acMessageBox(monitor_name, "Current Monitor Name Is:", nil)
-- according to the description in acSendWindowToMonitorByName we need to escape the \ chars
left_monitor_name="\\\\.\\DISPLAY1"
right_monitor_name="\\\\.\\DISPLAY2"
monitor_name_to_send = left_monitor_name
monitor_handle_to_send=acGetMonitorFromName(monitor_name_to_send)
if monitor_name ~= left_monitor_name then
acSendWindowToMonitorByName(current_window, nil, nil, monitor_name_to_send)
end
monitor_left=acGetMonitorLeft(monitor_handle_to_send, 1)
monitor_top=acGetMonitorTop(monitor_handle_to_send, 1)
monitor_right=acGetMonitorRight(monitor_handle_to_send, 1)
monitor_bottom=acGetMonitorBottom(monitor_handle_to_send, 1)
-- acMessageBox("Left:"..tostring(monitor_left).." Top:"..tostring(monitor_top).." Right:"..tostring(monitor_right).." Bottom:"..tostring(monitor_bottom), "Monitor Area Coords", nil)
current_window_size_x=math.abs(acGetWindowLeft(acGetForegroundWindow(), nil, nil) - acGetWindowRight(acGetForegroundWindow(), nil, nil))
current_window_size_y=math.abs(acGetWindowBottom(acGetForegroundWindow(), nil, nil) - acGetWindowTop(acGetForegroundWindow(), nil, nil))
monitor_size_x = math.abs(monitor_left-monitor_right)
monitor_size_y = math.abs(monitor_top-monitor_bottom)
local positions = {
["rustdesk.exe"] = 1920 - 690 - 850,
["ApplicationFrameHost.exe"] = monitor_top,
["Teams.exe"] = 1920 - 690 - 350 - 600,
["msedge.exe"] = 1920 - 690 - 350 - 650,
["thunderbird.exe"] = 1920 - 690 - 350 - 650
}
local heights = {
["ApplicationFrameHost.exe"] = 600
}
local y_pos = positions[process_name] or (1920 - 690 - 350 - 850)
local height=heights[process_name] or 600
acRestoreWindow(acGetForegroundWindow(), nil, nil)
-- move window to the top of the monitor
acMoveWindow(acGetForegroundWindow(), nil, nil, monitor_left, y_pos)
-- set the window size with regarding to monitor size
acSetWindowSize(acGetForegroundWindow(), nil, nil, monitor_size_x, height)
end
process_name=acGetExecutableName(acGetForegroundWindow())
if process_name ~= "shortcut.exe" then
current_window=acGetForegroundWindow()
current_window_x=acGetWindowLeft(acGetForegroundWindow(), gsx, gsy)
current_window_y=acGetWindowTop(acGetForegroundWindow(), gsx, gsy)
monitor_on_current_window=acGetMonitorFromPoint(current_window_x, current_window_y)
monitor_name=acGetMonitorName(monitor_on_current_window)
-- acMessageBox(monitor_name, "Current Monitor Name Is:", nil)
-- according to the description in acSendWindowToMonitorByName we need to escape the \ chars
left_monitor_name="\\\\.\\DISPLAY1"
right_monitor_name="\\\\.\\DISPLAY2"
monitor_name_to_send = right_monitor_name
if monitor_name ~= right_monitor_name then
acSendWindowToMonitorByName(current_window, nil, nil, monitor_name_to_send)
end
acMaximizeOrRestoreWindow(acGetForegroundWindow(), nil, nil)
end