Compare commits
No commits in common. "4a887dd1e294c09c9287b27d9dd1577d331ec492" and "d7bf2bb1b6ac979065c61f2fbe84ec7235854702" have entirely different histories.
4a887dd1e2
...
d7bf2bb1b6
35
main.ahk
35
main.ahk
@ -68,8 +68,7 @@ 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() {
|
||||||
@ -87,7 +86,7 @@ IdentifyMonitorConfiguration() {
|
|||||||
|
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
ArrangeWindowsInMonitor(windowConfigs) {
|
ArrangeWindowsInMonitor(monitorIndex, 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])
|
||||||
@ -102,34 +101,8 @@ ArrangeWindows(wParam, lParam, msg, hwnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
monitorConfig := monitorConfigurations[monitorConfigName]
|
monitorConfig := monitorConfigurations[monitorConfigName]
|
||||||
ArrangeWindowsInMonitor(monitorConfig)
|
ArrangeWindowsInMonitor(A_Index, monitorConfig)
|
||||||
}
|
}
|
||||||
; Listen for the monitor change event
|
|
||||||
OnMessage(0x007E, ArrangeWindows)
|
OnMessage(0x007E, ArrangeWindows)
|
||||||
|
|
||||||
CapsLock & a:: ; Capslock+a to arrange windows
|
ArrangeWindows(0, 0, 0, 0)
|
||||||
{
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user