Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 6509baa

Browse files
🐛 Fix window focus handling
1 parent 60ea275 commit 6509baa

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

scripts/toggleWnd.ahk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ toggleWnd(id, entry := unset) {
7878
try {
7979
DetectHiddenWindows(false)
8080
wndList := WinGetList()
81-
topWnd := wndList[wndList.FindIndex((wnd) => WinGetMinMax(wnd) > -1) + 1]
82-
WinActivate(topWnd)
8381
DetectHiddenWindows(true)
82+
wndIndex := wndList.FindIndex((wnd) => WinGetMinMax(wnd) > -1, 2)
83+
if (wndIndex !== 0) {
84+
WinActivate(wndList[wndIndex])
85+
}
8486
}
8587
}
8688
; Handle exit, try to reuse handler
@@ -129,7 +131,7 @@ toggleWnd(id, entry := unset) {
129131
try {
130132
if (WinGetMinMax(id) == -1)
131133
WinRestore(id)
132-
; WinActivate(id)
134+
WinActivate(id)
133135
activatedWnd := id
134136
}
135137
}

0 commit comments

Comments
 (0)