💾 Archived View for tdem.in › post › autohotkey-better-minimize.gmi captured on 2023-12-28 at 15:19:26. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
2019-06-10 01:28
Another day, another hack. This AutoHotkey snippet preserves the last window you minimized with `Win + Down` and allows you to quickly unminimize it with `Win + Shift + Up`:
global lastWindow ToScratchpad() { WinGetTitle, lastWindow, A WinMinimize, %lastWindow% } FromScratchpad() { WinActivate, %lastWindow% } #Down::ToScratchpad() #+Up::FromScratchpad()
Now let's go even further and use a stack of windows for that purpose! The next snippet saves the list of windows you minimized that way in a stack, and restores them in order:
global lastWindows := Array() ; this line needs to be at the top of the file ToScratchpad(windows) { WinGetTitle, lastWindow, A WinMinimize, %lastWindow% windows.Push(lastWindow) } FromScratchpad(windows) { lastWindow := windows.Pop() WinActivate, %lastWindow% } #Down::ToScratchpad(lastWindows) #+Up::FromScratchpad(lastWindows)
The first line has to be placed before the first return/hotkey, or it won't be executed (and the script will not work).