Last active
December 17, 2020 08:16
-
-
Save baflo/a0ab2f1c8e8532d8eb95a99bd59e05ee to your computer and use it in GitHub Desktop.
AutoHotKey script: Toggles (minimizes or restores) windows an keyboard shortcut
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. | |
ShowHideWindow(winTitle, winExe := "") | |
{ | |
WinGet, targetWindowID, IDLast, %winTitle% | |
if ("%winExe%" != "") and (not WinExist(winTitle)) { | |
Run, "%winExe%" | |
} | |
else { | |
IfWinActive, ahk_id %targetWindowID% | |
WinMinimize, ahk_id %targetWindowID% | |
Else | |
WinActivate, ahk_id %targetWindowID% | |
} | |
} | |
^+y:: | |
ShowHideWindow("ahk_exe Slack.exe") | |
Return | |
^+a:: | |
ShowHideWindow("ahk_exe notion.exe", "C:\Users\fb\AppData\Local\Programs\Notion\Notion.exe") | |
Return | |
^+q:: | |
ShowHideWindow("ahk_exe WindowsTerminal.exe", "wt.exe") | |
Return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment