-
-
Save ecspresso/2fc14fa57900d3fb8d5996b3f9612dc1 to your computer and use it in GitHub Desktop.
AutoHotkey script for making Windows Terminal appear/disappear with a single keypress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Removed resizing