Skip to content

Instantly share code, notes, and snippets.

@rubenhorn
Last active January 30, 2024 10:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenhorn/698203535bb66fb241e5c0ab3d55d2eb to your computer and use it in GitHub Desktop.
Save rubenhorn/698203535bb66fb241e5c0ab3d55d2eb to your computer and use it in GitHub Desktop.
AutoHotkey script for moving active window to main monitor
#SingleInstance force
; Hotkey: Alt + S
!s::
; Check if window active window exists
WinGetTitle, t, a
if(t = "Program Manager" or t = "") {
MsgBox ,, No window selected!, Please select a window.`n(Alt + Tab)
return
}
; Get bounding coordinates of the main monitor
SysGet n, MonitorPrimary
SysGet b, monitor, n
; Move window to main monitor
WinMove a,, bLeft, bTop
; End of script
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment