macOS Unminimize Specific Windows from Dock

In macOS, it's possible to minimize windows to the dock with Command+m. However, there's no shortcut to "unminimize" windows which is annoying when you're trying to use the mouse as little as possible.

To fix this, on my first pass, I created a macro that simply goes to a location and clicks, but it isn't very useful because the size of the icons varies depending on how many windows you have in the dock (e.g. more = smaller app icons, with reduced width between them).

Ideally, I'd be able to indicate which window I want to unminimize in a numbered fashion, where e.g. 1 means the window immediately beside the trash, 2, means the window 2 over from the trash, etc. Alternatively, because the order of the windows in the dock is based on the order in which they were minimized, forming a sort of stack, an alternative would be to have 1 mean the most recently minimized window, 2 would mean the second most recently minimized window, and so on. Anyone know how this might be accomplished with Keyboard Maestro?

Image on 2021-07-24 10.51.14 AM

Note, I'm open to other ways of doing this, but here are some that I've considered and why they don't quite do it for me:

  1. Using hide instead of minimize (as argued for here). This isn't a great solution if you want to hide some windows from one particular program, but not others. For example, when you have hundreds of browser tabs open for several different projects and just want to keep the windows and tabs open for the project you're currently working on. Also, when you minimize windows, you can cycle through just the non-minimized windows with Command+`, but this isn't possible with hide.

  2. As described here, control clicking the app's dock icon and selecting the minimized window (indicated with a diamond). The issue with this is that the app's dock icon can move around based on the number of windows you have minimized (assuming you haven't enabled the Minimize windows into application icon option). Also, the windows that show up in that menu are sorted alphabetically by the title of the tab you happened to be on when that window was minimized, so it's highly variable.

  3. Using App Exposé (as described here). This approach isn't horrible but it requires at least a three-finger down swipe on the trackpad before you can use the arrow keys to select the window you want to unminimize. A pro regarding this approach is that the minimized windows are displayed in the order they were minimized. A con is that it's application specific, so if you want to unminimize applications from the dock from different programs, you have to first activate the programs you want, then swipe down, and then move to the window you want to unminimize, which is fairly tedious. Also, I haven't found a Keyboard Maestro action to simulate a three-finger downswipe to launch App Exposé.

  4. Use a shortcut for the Mission Control Application windows feature, as described in the second link above. This option is pretty close to perfect except that as with #3, it's application-specific and requires you to key over to the specific window you want to unminimize.

Hey Charles,

You can find out what windows have been minimized using AppleScript UI-Scripting.

This script will simply unminimize all minimized windows, but you can adapt the techniques to discover which app has minimized windows and what the window names are.

See the Execute an AppleScript action.

From there you can use a Prompt With List action to chose which windows to unminimize.

Your task is not a simple one, but it's doable.

-Chris

--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/07/24 22:36
# dMod: 2021/07/24 22:36 
# Appl: System Events
# Task: Unminimize All Minimized Windows.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @Unminimize, @Minimized, @Windows
--------------------------------------------------------

tell application "System Events"
   
   tell (application processes whose background only is false)
      set minimizedWindowList to windows where the value of its attribute "AXMinimized" is true
   end tell
   
   repeat with theList in minimizedWindowList
      repeat with theWindow in theList
         tell theWindow to perform action "AXRaise"
      end repeat
   end repeat
   
end tell

--------------------------------------------------------

Hey Chris,

Thanks so much for the tips! I was worried it might start to get complex, but at least now I have a direction to pursue. Let me know if any other approaches occur to you.