OS X: Show desktop (Win-D equivalent)

It’s been a long time I was suffering from lack of “Hide all windows” feature in Mac OS X. Why is it so important to me? I feel discomfort when there are so many windows on the screen, or tabs in browser, or shortcuts on Desktop, it invokes a panic in me. In order to focus on some problem I need there not more than three windows on the screen. Ideally just one. Five years passed away since I’ve migrated from Windows and all this time I’ve been using very inconvenient workaround – Hide others (Option-Cmd-H) in applications menu. Today I’ve finally found quite acceptable way to hide all windows by one mouse click or keyboard shortcut. Let me tell you how to make it.

I’m not gonna tell long stories of my researches, I’ll just describe my solution. So, what do we need?

If you’re not familiar with Apple script, then just put this name (Apple script) in Spotlight, it will bring you to script editor where you can create a required script and save it as HideAllWindows.scpt

2. At start I wanted to use standard OS X functionality Hot Corners which is available in System Preferences -> Mission Control, but this didn’t have chance to come true because Hot Corners don’t allow to assign custom actions as handlers, only predefined actions. Short googling led me to CornerClick. Its idea is absolutely the same with Hot Corners but it’s a much more flexible. For instance it allows to assign an action to mouse click in the corner and especially it allows to assign Apple Script to events. This is exaclty what doctor has assigned. Install it, then you will see ClickCorners icon in the System Preferences pane. Open it and set up action at your desire (I’ve made click in left bottom corner event). Then assign the Apple script mentioned above. It’s done, enjoy.

3. Last thing of my plan is a Hot key. Of course it’s gonna be Cmd-D (Win-D equivalent). Unfortunately it’s impossible to use standard System Preferences (Keyboard -> Shortcuts) cause it also doesn’t allow custom actions for shortcuts. Any key mapper can help here. I took FastScript. Its free version allows to assign up to 10 shortcuts – it’s more than enough for my purposes. The only hard thing to do here relates to a list of scripts that FastScripts populate from /Library/Scripts folder. It belongs to superuser and we must use extended privileges to copy our HideAllWindows.scpt there. You can use Terminal app with following command. sudo cp /Users/heximal/Documents/HideAllWindows.scpt /Library/Scripts/UI\ Element\ Scripts/ Don’t forget to change the path to script, you will probably have it different. Next, open FastScript preferences, and make all required changes. That’s all.