Last active
November 20, 2020 00:29
-
-
Save gutierri/050be440790f1f5ddeb3787064447497 to your computer and use it in GitHub Desktop.
quake style terminal for Windows, write on ahk (key press F12)
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
; quake-terminal ~ quake-style terminal drop down | |
; Copyright (C) 2020 Gutierri Barboza | |
; | |
; This program is free software: you can redistribute it and/or modify it under | |
; the terms of the GNU General Public License as published by the Free Software | |
; Foundation, either version 3 of the License, or (at your option) any later | |
; version. | |
; | |
; This program is distributed in the hope that it will be useful, but WITHOUT | |
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
; | |
; You should have received a copy of the GNU General Public License along with | |
; this program. If not, see <http://www.gnu.org/licenses/>. | |
#Persistent | |
#SingleInstance force | |
cmd_current_instance_id := False | |
cmd_remove_taskbar(activeHwnd, n) { | |
IID_ITaskbarList := "{56FDF342-FD6D-11d0-958A-006097C9A090}" | |
CLSID_TaskbarList := "{56FDF344-FD6D-11d0-958A-006097C9A090}" | |
tbl := ComObjCreate(CLSID_TaskbarList, IID_ITaskbarList) | |
DllCall(NumGet(NumGet(tbl+0), 3*A_PtrSize), "ptr", tbl) | |
DllCall(NumGet(NumGet(tbl+0), n*A_PtrSize), "ptr", tbl, "ptr", activeHwnd) | |
ObjRelease(tbl) | |
} | |
hooks_style_apply(cmd_id){ | |
WinSet, Style, -0x200000, ahk_id %cmd_id% | |
WinSet, Style, -0xC00000, ahk_id %cmd_id% | |
WinMove, ahk_id %cmd_id%, , -7, -7, (A_ScreenWidth+14), (A_ScreenHeight/2) | |
} | |
open_cmd_start(){ | |
Run, bash.exe,,, cmd_pid | |
Sleep 1000 | |
WinGet cmd_id, ID, ahk_pid %cmd_pid% | |
hooks_style_apply(cmd_id) | |
cmd_remove_taskbar(cmd_id, 5) | |
Sleep 1000 | |
WinMinimize, ahk_id %cmd_id% | |
Return cmd_id | |
} | |
toggle_visible(cmd_id){ | |
WinGet, mx, MinMax, ahk_id %cmd_id% | |
if (mx = -1) { | |
WinRestore, ahk_id %cmd_id% | |
} else { | |
WinMinimize, ahk_id %cmd_id% | |
} | |
} | |
cmd_current_instance_id := open_cmd_start() | |
OnExit("kill_and_exit") | |
kill_and_exit(ExitReason, ExitCode){ | |
global cmd_current_instance_id | |
WinGet cmd_pid, PID, ahk_id %cmd_current_instance_id% | |
Process, Close, %cmd_pid% | |
} | |
F12:: | |
toggle_visible(cmd_current_instance_id) | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment