Skip to content

Instantly share code, notes, and snippets.

@n1crack
Created November 4, 2022 07:51
Show Gist options
  • Select an option

  • Save n1crack/1325aa400bc3b2159da30774080235e2 to your computer and use it in GitHub Desktop.

Select an option

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"
}
}
@n1crack
Copy link
Author

n1crack commented Feb 2, 2026

v2 update

#Requires AutoHotkey v2.0
SendMode "Input"
SetWorkingDir A_ScriptDir

LocalAppData := EnvGet("LocalAppData")

!Space::ToggleTerminal()

ToggleTerminal() {
    WinMatcher := "ahk_class CASCADIA_HOSTING_WINDOW_CLASS"

    if WinExist(WinMatcher) {
        ; Pencere var
        if !WinActive(WinMatcher) {
            WinActivate(WinMatcher)
        } else {
            WinMinimize(WinMatcher)
        }
    } else {
        Run "wt.exe"
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment