Skip to content

Instantly share code, notes, and snippets.

@n1crack
Created November 4, 2022 07:51
Show Gist options
  • Save n1crack/1325aa400bc3b2159da30774080235e2 to your computer and use it in GitHub Desktop.
Save n1crack/1325aa400bc3b2159da30774080235e2 to your computer and use it in GitHub Desktop.
AutoHotkey Show/Hide Terminal App with Alt+Space
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
EnvGet, LocalAppData, LocalAppData
!space::ToggleTerminal()
ToggleTerminal()
{
WinMatcher := "ahk_class CASCADIA_HOSTING_WINDOW_CLASS"
if WinExist(WinMatcher)
; Window Exists
{
; Check if its minimize
if (!WinActive(WinMatcher))
{
WinActivate ahk_class CASCADIA_HOSTING_WINDOW_CLASS
}
else
{
; Script sees it without detecting hidden windows, so..
WinMinimize ahk_class CASCADIA_HOSTING_WINDOW_CLASS
}
}
else
{
Run "wt.exe"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment