/
wt-quake-like.ahk
51 lines (40 loc) · 1.33 KB
/
wt-quake-like.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;; Taken from https://github.com/ehpc/quake-windows-bash
;; but replaced bash.exe with WindowsTerminal.exe
;; improved to launch terminal if not opened, and also to make active if the window is simply out of focus
;; relies on a shortcut that makes the terminal launch with a few options
;; but if you don't want the shortcut option you can replace Shortcut with BashHandle
;; Quake-style bash toggler for AutoHotkey.
;; Uses standard minimization/restoring animations.
;; ehpc@ehpc.io
#SingleInstance force
;handles
BashHandle = ahk_exe WindowsTerminal.exe
Shortcut = "C:\Users\Rub\wt.exe.lnk"
; On CTRL+` press
^`::
WinGet, wList, List, %BashHandle%
if !wList{ ; if no windows exist
; just use BashHandle if you don't want to go the route of using a shortcut (for the extra options)
Run, %Shortcut%
return
}
WinGet, mx, MinMax, %BashHandle%
; If window is minimized, restore it
if (mx = -1)
{
WinRestore, %BashHandle%
; Uncomment these lines to overcome tmux/vim rendering bug
; ControlSend, , ^{VK42}, %BashHandle%
; ControlSend, , {VK52}, %BashHandle%
}
; if window is active, minimize it
else if WinActive(BashHandle)
{
WinMinimize, %BashHandle%
}
; Otherwise focus it
else
{
WinActivate, %BashHandle%
}
Return