Compare commits

...

3 Commits

View File

@ -68,7 +68,8 @@ monitorConfigurations := Map(
"Visual Studio Code", [472, 0, 2085, 1550], "Visual Studio Code", [472, 0, 2085, 1550],
"Mozilla Firefox", [467, 0, 2099, 1557], "Mozilla Firefox", [467, 0, 2099, 1557],
"TickTick", [0, 731, 942, 821], "TickTick", [0, 731, 942, 821],
"Atrium", [983, 0, 1577, 1552] "Atrium", [983, 0, 1577, 1552],
"Plex", [342, 85, 1970, 1300]
) )
) )
IdentifyMonitorConfiguration() { IdentifyMonitorConfiguration() {
@ -86,7 +87,7 @@ IdentifyMonitorConfiguration() {
return "unknown" return "unknown"
} }
ArrangeWindowsInMonitor(monitorIndex, windowConfigs) { ArrangeWindowsInMonitor(windowConfigs) {
for win, params in windowConfigs { for win, params in windowConfigs {
if (WinExist(win)) { if (WinExist(win)) {
WinMove(params[1], params[2], params[3], params[4]) WinMove(params[1], params[2], params[3], params[4])
@ -101,8 +102,34 @@ ArrangeWindows(wParam, lParam, msg, hwnd)
} }
monitorConfig := monitorConfigurations[monitorConfigName] monitorConfig := monitorConfigurations[monitorConfigName]
ArrangeWindowsInMonitor(A_Index, monitorConfig) ArrangeWindowsInMonitor(monitorConfig)
} }
; Listen for the monitor change event
OnMessage(0x007E, ArrangeWindows) OnMessage(0x007E, ArrangeWindows)
ArrangeWindows(0, 0, 0, 0) CapsLock & a:: ; Capslock+a to arrange windows
{
keyArr := []
For Key In monitorConfigurations
keyArr.Push(Key)
selectionGui := Gui()
selectionGui.AddText(, "Please select a window layout:")
selectionGui.AddDropDownList("vLayoutChoice Choose1", keyArr)
selectionGui.AddButton("", "Cancel").OnEvent("Click", Cancel)
selectionGui.AddButton("Default X+", "Submit").OnEvent("Click", Submit) ; Place next previous button.
selectionGui.Show()
WinWaitClose(selectionGui.Hwnd)
Cancel(*)
{
WinClose(selectionGui.Hwnd)
}
Submit(*)
{
Saved := selectionGui.Submit(true)
monitorConfig := monitorConfigurations[Saved.LayoutChoice]
ArrangeWindowsInMonitor(monitorConfig)
}
}