Hide windows in current desktop (Lion)

Solution 1:

Here is a suggestion (Works on OSX 10.8)

Using Automator :

  • Create a new Service with automator
  • Select Service receives selected no input in any application
  • Add a Run AppleScript action

Copy this script :

on run {input, parameters}
    tell application "System Events"
        set processList to (every application process whose visible is true)        
        repeat with appProc in processList
            set windowList to every window of appProc
            repeat with aWindow in windowList
                click (third button of aWindow)
            end repeat
        end repeat
    end tell
end run
  • Save your new service
  • In System Preferences > Keyboard > Keyboard Shortcuts > Services add a keyboard shortcut to your news ervice

Edit :

Other script :

on run {input, parameters}
    tell application "Finder"
        set visible of every process whose visible is true and name is not "Finder" to false
        close every window
    end tell
end run

It hides all apps but it closes all finder windows.