🧰 AutoHotkey v2
Quick Window Snap (AutoHotkey)
AutoHotkey v2 script adding Ctrl+Alt+Numpad shortcuts to snap the active window into halves, quarters, or a centered position.
QuickWindowSnap.ahk
; ============================================================
; QuickWindowSnap.ahk
;
; AutoHotkey v2 script that adds quick keyboard shortcuts for
; snapping the active window to screen halves/quarters, beyond
; what the built-in Win+Arrow shortcuts offer.
;
; Requirements: AutoHotkey v2 (https://www.autohotkey.com/)
;
; Shortcuts (Ctrl+Alt+Numpad):
; Numpad4 = Snap left half Numpad6 = Snap right half
; Numpad8 = Snap top half Numpad2 = Snap bottom half
; Numpad7 = Snap top-left quarter Numpad9 = Snap top-right quarter
; Numpad1 = Snap bottom-left Numpad3 = Snap bottom-right
; Numpad5 = Center window (80% of screen)
;
; Usage: double-click to run, or place in your Startup folder.
; ============================================================
#Requires AutoHotkey v2.0
SnapWindow(x, y, w, h) {
WinGetPos(&curX, &curY, &curW, &curH, "A")
MonitorGetWorkArea(MonitorGetPrimary(), &left, &top, &right, &bottom)
screenW := right - left
screenH := bottom - top
WinMove(left + x * screenW, top + y * screenH, w * screenW, h * screenH, "A")
}
^!Numpad4::SnapWindow(0, 0, 0.5, 1) ; left half
^!Numpad6::SnapWindow(0.5, 0, 0.5, 1) ; right half
^!Numpad8::SnapWindow(0, 0, 1, 0.5) ; top half
^!Numpad2::SnapWindow(0, 0.5, 1, 0.5) ; bottom half
^!Numpad7::SnapWindow(0, 0, 0.5, 0.5) ; top-left quarter
^!Numpad9::SnapWindow(0.5, 0, 0.5, 0.5) ; top-right quarter
^!Numpad1::SnapWindow(0, 0.5, 0.5, 0.5) ; bottom-left quarter
^!Numpad3::SnapWindow(0.5, 0.5, 0.5, 0.5); bottom-right quarter
^!Numpad5::SnapWindow(0.1, 0.1, 0.8, 0.8); centered, 80% size