Hey Guys,
First, thank you for this. I tried and it worked but there are issues.
For some reason, it doesn't let the last active app to be the foreground after restoring. Also, after restoring, all the apps on my desktop (3 monitors) all completely disappear and I can't even right click on the desktop.
Below is my code where I decided to use #D as the same hotkey for both minimizing and maximizing. Thank you
Also, if I will be taking it another step further, is there a way to just show desktop rather than minimizing all the apps one by one? Is there any caveat to doing that? And then on the second press, it should restore all.
Code: Select all
#MaxThreadsperHotkey 2
#D::
Previouskey:= !PreviousKey
if PreviousKey
{
WinGet, WindowList, List,,, Program Manager
Loop, %WindowList%
{
WinGetClass, Class, % "ahk_id " . WindowList%A_Index%
IF (Class <> "Shell_SecondaryTrayWnd" And Class <> "Shell_TrayWnd")
WinMinimize, % "ahk_id " . WindowList%A_Index%
}
return
}
else
{
active_ID := WinActive("A")
WinGet, WindowList, List,,, Program Manager
Loop, %WindowList%
{
WinGetClass, Class, % "ahk_id " . WindowList%A_Index%
IF Class not contains Shell_TrayWnd,Shell_SecondaryTrayWnd
WinRestore, % "ahk_id " . WindowList%A_Index%
}
WinActivate, % "ahk_id " active_ID
return
}
return