From baddf2ff1b7de2d171af2f4cd935797b887a4424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 21 Dec 2020 20:37:05 +0100 Subject: windows: Improve 'minimze previous window' hotkey --- tt.windows.ahk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tt.windows.ahk b/tt.windows.ahk index 87f04e4..e6b93f5 100644 --- a/tt.windows.ahk +++ b/tt.windows.ahk @@ -47,9 +47,14 @@ if (mm = -1) return #c:: ; minimize last window -SendInput, !{Tab} -Sleep, 50 -WinMinimize, A +GW_HWNDNEXT := 2 +hwnd := WinActive("A") +Loop { + hwnd := DllCall("GetWindow", "ptr", hwnd, "uint", GW_HWNDNEXT) + if (DllCall("IsWindowVisible", "ptr", hwnd) = 1) + break +} +WinMinimize, ahk_id %hwnd% return -- cgit v1.2.3