Btw, for use-cases when you need to keep the "toggled" window opened and do not want to close, minimize or hide it or something and just need the fastest flip to, flip back to previous window "toggle", super useful but (for me) long time forgotten native Windows hotkey is *`Alt + Escape`* - it simply switches to previous focused window without even showing window overview (like Alt+Tab).
So AutoHotkey *v1* boilerplate for such switcher/launcher then could be something like:
; Toggle <...> window using Ctrl + Shift + Win + <key>
^+#<key>::
_bckTMM := A_TitleMatchMode
_bckDHW := A_DetectHiddenWindows
SetTitleMatchMode, 2
DetectHiddenWindows, On
ifWinExist, <... window title fragment>
{
ifWinActive
{
send, !{escape}
}
else
{
WinActivate
}
}
else
{
run, <... launcher>
}
DetectHiddenWindows, %_bckDHW%
SetTitleMatchMode, %_bckTMM%
return
Or if you do not want that window to clobber the taskbar, you can use `WinHide` instead of that Alt+Win `send, !{escape}` and add WinShow to WinActivate, but it does not work well with some kinds of windows. Also for window detection it may sometimes be more suitable to use `ahk_exe` or `ahk_class`.