Last active
June 17, 2020 19:33
-
-
Save sharunkumar/af7ba56e3cce8238ae9c986c619e8d1c to your computer and use it in GitHub Desktop.
Autohotkey script for hooking win+` to open and toggle to the new windows terminal. Terminal will be spawned if it isn't opened already.
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
#SingleInstance, force | |
global PreviousActiveWindow | |
; Requires windows terminal preview: https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701 | |
#`:: | |
DetectHiddenWindows, On | |
if (WinExist("ahk_class CASCADIA_HOSTING_WINDOW_CLASS")) { | |
if(WinActive("ahk_class CASCADIA_HOSTING_WINDOW_CLASS")) { | |
WinActivate, ahk_id %PreviousActiveWindow% | |
} else { | |
WinGet, PreviousActiveWindow, , A ; 'A' for currently active window | |
WinActivate, ahk_class CASCADIA_HOSTING_WINDOW_CLASS | |
} | |
} else { | |
TerminalLink = %localappdata%\Microsoft\WindowsApps\wt.exe | |
if FileExist(TerminalLink) { | |
WinGet, PreviousActiveWindow, , A ; 'A' for currently active window | |
Run, %TerminalLink% | |
} else { | |
MsgBox, Windows Terminal not installed | |
} | |
} | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment