Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On Mac OS X (10.6.4) is there a keyboard shortcut to close all other windows except the one with focus?

share|improve this question

2 Answers 2

Not that I know of.

You can however hide all other applications with Option+Command+H.

share|improve this answer
    
Does ⌥⌘H work differently on 10.6? On earlier releases it only hides other applications (if the current application has multiple windows open, they will all remain visible). –  Chris Johnsen Jun 20 '10 at 20:36
    
@Chris: You are correct, all other applications. –  Josh K Jun 20 '10 at 22:41

You can create an applescript to close all but the frontmost window of the current application. In snow leopard, you can put it in an automator service and give it a keyboard shortcut. Alternatively, you can use Fastscripts to give it a shortcut.

Edit: I've added hiding other applications to the applescript. Edit #2: OK, after testing I found the repeat while window 2 exists actually didn't stop looping, causing nasty autoclose behaviour when opening new windows. The new code should be more robust.

with timeout of 2 seconds
  try
    tell application "System Events"
        set app_name to name of the first process whose frontmost is true
        set visible of (every process) to false -- hide everything
    end tell

    tell application app_name
        activate -- show frontmost application
        repeat with aWindow in (get every window)
            if index of aWindow > 1 then close aWindow
        end repeat
    end tell
  on error error_message number error_number
    display alert ("Something went wrong:") ¬
        message error_message ¬
        & (" Error number ") & error_number & "."
  end try
end timeout
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.