aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-12-21 20:37:05 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-12-21 20:37:05 +0100
commitbaddf2ff1b7de2d171af2f4cd935797b887a4424 (patch)
treebf8af11859c4f769c5e6e8dd7fb552f04682b8c8
parent4e474457c14fa2ed98b9bf9a8cbdd8934985d810 (diff)
downloadahk-baddf2ff1b7de2d171af2f4cd935797b887a4424.tar.gz
windows: Improve 'minimze previous window' hotkey
-rw-r--r--tt.windows.ahk11
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