I'm looking to bind a keyboard shortcut to the action "minimize all windows from the current application except the current window." (The app in question is always Google Chrome.)

(Sort of like ⌘ + ⌥ + h, which translates to "hide all applications except the current application".)

I've never bound a new shortcut, but I suspect I could figure it out once I have a working AppleScript for the task. I also use Better Touch Tool, in case it is easier to go through that app.

This question asks the same thing, but the answers are not bindable to a simple keyboard shortcut as far as I can tell.

This question asks the same thing (except specifically for Safari), and a user suggests the AppleScript

tell application "Safari"
    tell application "System Events"
        keystroke "h" using {command down, option down}
    end tell
    set miniaturized of (windows whose index is not 1) to true
end tell

When I replace "Safari" with "Google Chrome" in the script, and try to run it from Script Editor, I get the error

Script error: Google Chrome got an error: Can’t make miniaturized of every window whose index ≠ 1 into type specifier.

Can anyone help? Thanks

  • As I can see it: after current problem of minimizing is solved this solution creates new problem which must be addressed: 'how to un-minimize other windows of the current app' Commented Jan 5, 2021 at 8:39
  • @AivarPaalberg I agree. I personally use the "Session Buddy" Chrome extension which lets me see all open windows and tabs in a list. So that's not a problem for me.
    – Eric Auld
    Commented Jan 5, 2021 at 18:34

1 Answer 1


The following example AppleScript code will minimize all but the front window in Google Chrome:

tell application "System Events" to ¬
    set miniaturized of windows of application ¬
        "Google Chrome" whose index is not equal to 1 to true

Since you already have BetterTouchTool and assuming it can run AppleScript code or an AppleScript .scrpt file with a keyboard shortcut, that is probably the easiest way to go to trigger the code.

That said, my preferred method for running AppleScript scripts with a keyboard shortcut, is to use a third-party application named FastScripts, however you can also use Automator with a Run AppleScript action as a Service/Quick Action and assign it a keyboard shortcut in: System Preferences > Keyboard > Shortcuts > Services

  • The keyboard shortcut assigned to the Service/Quick Action needs to not conflict with a default keyboard shortcut for whichever application is frontmost at the time it's pressed, otherwise there may be unwanted behavior.

  • FastScripts can be run as a free app, up to 10 keyboard shortcuts, or upgraded for $24.95 USD to unlock unlimited keyboard shortcuts. I have no affiliation with Red Sweater Software, LLC, other then as a user of FastScripts.
  • I was going to comment that you could more precisely accomplish what the asker requested by replacing "Google Chrome" with (path to frontmost application as text)—except it turns out that doesn't work in practice. I wonder why... Commented Jan 5, 2021 at 1:39
  • @Wowfunhappy The OP explicitly stated "The app in question is always Google Chrome.", so I couldn't be any more precise then I already have! Commented Jan 5, 2021 at 1:50
  • Whoops, missed that—I was looking at the question title specifically! Commented Jan 5, 2021 at 2:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .