Skip to content

Instantly share code, notes, and snippets.

@ecspresso
Forked from andrewgodwin/QuakeTerminal.ahk
Created November 16, 2020 08:42
Show Gist options
  • Save ecspresso/2fc14fa57900d3fb8d5996b3f9612dc1 to your computer and use it in GitHub Desktop.
Save ecspresso/2fc14fa57900d3fb8d5996b3f9612dc1 to your computer and use it in GitHub Desktop.
AutoHotkey script for making Windows Terminal appear/disappear with a single keypress
#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.
F12::ToggleTerminal()
ShowAndPositionTerminal()
{
WinShow ahk_class CASCADIA_HOSTING_WINDOW_CLASS
WinActivate ahk_class CASCADIA_HOSTING_WINDOW_CLASS
}
ToggleTerminal()
{
WinMatcher := "ahk_class CASCADIA_HOSTING_WINDOW_CLASS"
DetectHiddenWindows, On
if WinExist(WinMatcher)
; Window Exists
{
DetectHiddenWindows, Off
; Check if its hidden
if !WinExist(WinMatcher) || !WinActive(WinMatcher)
{
ShowAndPositionTerminal()
}
else if WinExist(WinMatcher)
{
; Script sees it without detecting hidden windows, so..
WinHide ahk_class CASCADIA_HOSTING_WINDOW_CLASS
Send !{Esc}
}
}
else
{
Run "c:\Users\Andrew\AppData\Local\Microsoft\WindowsApps\wt.exe"
Sleep, 1000
ShowAndPositionTerminal()
}
}
@ecspresso
Copy link
Author

Removed resizing

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