Skip to content

Instantly share code, notes, and snippets.

@nikosavola
Last active November 18, 2021 12:19
Show Gist options
  • Save nikosavola/12b16630650283a6634e529a90c3cfb5 to your computer and use it in GitHub Desktop.
Save nikosavola/12b16630650283a6634e529a90c3cfb5 to your computer and use it in GitHub Desktop.
Ok AutoHotkey config
#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.
SwitchToWindowsTerminal()
{
windowHandleId := WinExist("ahk_exe WindowsTerminal.exe")
windowExistsAlready := windowHandleId > 0
; If the Windows Terminal is already open, determine if we should put it in focus or minimize it.
if (windowExistsAlready = true)
{
activeWindowHandleId := WinExist("A")
windowIsAlreadyActive := activeWindowHandleId == windowHandleId
if (windowIsAlreadyActive)
{
; Minimize the window.
WinMinimize, "ahk_id %windowHandleId%"
}
else
{
; Put the window in focus.
WinActivate, "ahk_id %windowHandleId%"
WinShow, "ahk_id %windowHandleId%"
}
}
; Else it's not already open, so launch it.
else
{
Run, wt
}
}
; Hotkey to use Ctrl+Shift+T to launch/restore the Windows Terminal.
^!t::SwitchToWindowsTerminal()
; Alt+Minus = En dash
!-::
Send {–}
return
; Shift+Alt+Minus = Em dash
+!-::
Send {—}
return
; Toggle window transparency on the current window with Win+Escape.
#Esc::
WinGet, TransLevel, Transparent, A
if (TransLevel = OFF) {
WinSet, Transparent, 225, A
} else {
WinSet, Transparent, OFF, A
}
return
; Windows + K to BT settings on Win11
#K::
Run, ms-settings:connecteddevices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment