diff options
author | John Ankarström <john@ankarstrom.se> | 2021-08-24 23:28:46 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-08-24 23:28:46 +0200 |
commit | 3222073596b250410e557807404d188ae355e945 (patch) | |
tree | b01d12f608cc4318f4a6f9fe4e86269ae7074734 | |
parent | f877ecf77c05f5f849bdfa495b104e09ef58562c (diff) | |
download | ahk-3222073596b250410e557807404d188ae355e945.tar.gz |
windows: Add hotkeys to raise and hide application windows
-rw-r--r-- | tt.windows.ahk | 37 |
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) |