diff options
author | John Ankarström <john@ankarstrom.se> | 2020-12-21 20:37:05 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2020-12-21 20:37:05 +0100 |
commit | baddf2ff1b7de2d171af2f4cd935797b887a4424 (patch) | |
tree | bf8af11859c4f769c5e6e8dd7fb552f04682b8c8 | |
parent | 4e474457c14fa2ed98b9bf9a8cbdd8934985d810 (diff) | |
download | ahk-baddf2ff1b7de2d171af2f4cd935797b887a4424.tar.gz |
windows: Improve 'minimze previous window' hotkey
-rw-r--r-- | tt.windows.ahk | 11 |
1 files 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 |