Skip to content

Instantly share code, notes, and snippets.

@darrik
Last active June 14, 2021 16:26
Show Gist options
  • Save darrik/72b19919229ed179a424ec64ae27aa4b to your computer and use it in GitHub Desktop.
Save darrik/72b19919229ed179a424ec64ae27aa4b to your computer and use it in GitHub Desktop.
autohotkey script to minimize all* windows on primary monitor
;; Created: 2021-03-14 13:03:11
;; Time-stamp: <2021-03-27 15:35:47>
;; Win+m
#m::
SysGet, monitor, Monitor ; get resolution, etc
WinGet, winlist, List ; get list of windows
Loop % winlist {
me := % "ahk_id " winlist%A_Index%
WinGet, exe, ProcessName, %me%
; exclusions
if(exe == "Explorer.EXE" || exe == "AISuite3.exe" || exe == "destiny2.exe") {
continue
}
WinGet, winstate, MinMax, %me%
if(winstate != -1) { ; -1 is minimized
WinGetPos, X, Y, , , %me%
; Some applications that are hidden but not minimized have position -8,-8 for some reason
if((X > 0 && X < (monitorRight - 10)) || (X == -8 && Y == -8)) {
WinMinimize, %me%
}
}
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment