aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-08-24 23:28:46 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-08-24 23:28:46 +0200
commit3222073596b250410e557807404d188ae355e945 (patch)
treeb01d12f608cc4318f4a6f9fe4e86269ae7074734
parentf877ecf77c05f5f849bdfa495b104e09ef58562c (diff)
downloadahk-3222073596b250410e557807404d188ae355e945.tar.gz
windows: Add hotkeys to raise and hide application windows
-rw-r--r--tt.windows.ahk37
1 files changed, 37 insertions, 0 deletions
diff --git a/tt.windows.ahk b/tt.windows.ahk
index e6b93f5..26748a0 100644
--- a/tt.windows.ahk
+++ b/tt.windows.ahk
@@ -12,7 +12,44 @@ Gui, FakeWindow:Show, x0 y%y% AutoSize NA, FakeWindow
;; -> body
+; Raise all windows of the same process
+LWin Up::
+Loop, 2
+{
+ hwnd := WinActive("A")
+ WinGet, exe, ProcessName, A
+ WinGet, L, List, ahk_exe %exe%
+ Loop, % L
+ {
+ DllCall("SetWindowPos"
+ , "UInt", L%A_Index%, "UInt", hwnd
+ , "Int", 0, "Int", 0, "Int", 0, "Int", 0
+ , "UInt", 0x0001|0x0002|0x4000) ; SWP_NOSIZE|SWP_NOMOVE|SWP_ASYNCWINDOWPOS
+ }
+}
+return
+
+; Hide all windows of the same process (except the current one)
++LWin Up::
+Loop, 2
+{
+ hwnd := WinActive("A")
+ WinGet, exe, ProcessName, A
+ WinGet, L, List, ahk_exe %exe%
+ Loop, % L
+ {
+ if (L%A_Index% = hwnd)
+ continue
+ DllCall("SetWindowPos"
+ , "UInt", L%A_Index%, "UInt", 1 ; HWND_BOTTOM
+ , "Int", 0, "Int", 0, "Int", 0, "Int", 0
+ , "UInt", 0x0001|0x0002|0x4000) ; SWP_NOSIZE|SWP_NOMOVE|SWP_ASYNCWINDOWPOS
+ }
+}
+return
+
#t::WinSet, AlwaysOnTop, Toggle, A
+#o::WinSet, AlwaysOnTop, Toggle, A
#f::
WinGet, t, Transparent, A
if (t = OFF)