[feature] move cursor to window center when win+jk

This commit is contained in:
Klesh Wong 2021-01-22 00:15:44 +08:00
parent 8e4c3a030f
commit 3cfe5d8c6b

View File

@ -33,10 +33,10 @@ Return
VarSetCapacity(Clip0, 0) ; Free memory VarSetCapacity(Clip0, 0) ; Free memory
Return Return
#IfWinActive ahk_class mintty ; #IfWinActive ahk_class mintty
^+v::Send +{Ins} ; ^+v::Send +{Ins}
^+c::Send ^{Ins} ; ^+c::Send ^{Ins}
#IfWinActive ; #IfWinActive
@ -69,6 +69,9 @@ MoveMouseAct(x, y) {
DllCall("SetCursorPos", "int", x, "int", y) DllCall("SetCursorPos", "int", x, "int", y)
MouseGetPos, MouseX, MouseY, WinId MouseGetPos, MouseX, MouseY, WinId
WinActivate, ahk_id %WinId% WinActivate, ahk_id %WinId%
; Sleep 0.2
WinGetPos x, y, w, h, A
DllCall("SetCursorPos", "int", x + w / 2, "int", y + h / 2)
} }
MoveCursorMon(toRight) { MoveCursorMon(toRight) {
@ -106,7 +109,6 @@ MoveCursorWin(toRight) {
if (monLeft < MouseX and monRight > MouseX) { if (monLeft < MouseX and monRight > MouseX) {
x := monLeft + (monRight - monLeft) * (toRight ? 0.75 : 0.25) x := monLeft + (monRight - monLeft) * (toRight ? 0.75 : 0.25)
y := monTop + monBottom / 2 y := monTop + monBottom / 2
DllCall("SetCursorPos", "int", x, "int", y)
MoveMouseAct(x, y) MoveMouseAct(x, y)
break break
} }