Murphy Mac - Screencasts and Tutorials » Page 'Hide Everything'

Hide Everything


desktopEver want to hide ALL your applications and start with a clear, swept off desktop on your Mac? Yeah, there’s Exposé, but that’s not the same as what we’ll see here. When you show your desktop via Exposé you’re not changing the state of your applications to hidden – so as soon as you switch to an application the others will all be visible too.
If you’ve used Windows you may have used the Show Desktop icon in the taskbar to minimize all windows. We’re not going to minimize, we’re going to hide. But the end effect is the same. You’re looking at your desktop with nothing in your way.
How do we do this? A very short and simple Applescript. With one small concession.
If you’ve ever tried to hide ALL your applications you probably know what our obstacle is.

Try this: Switch to Finder and hit Command-Option-H. That hides all applications except Finder. Once they're hidden try hitting Command-H to hide the Finder itself. It doesn't work.

So here’s a workaround that’s acceptable to me: Our Applescript will hide the windows of all applications except the Finder. Then it will CLOSE all the Finder windows. The end result is a clean desktop with application windows that stay out of sight until you summon them back into view.
Optionally, you could include the 3 lines of the script after the line “Close every window” (commented out with dashes in the image below) to open up a single Finder window to a specified folder and use that as your starting point.


Once you’ve created the script you need a way to kick it off. I use TextExpander for a lot of these things. TexExpander is a fantastic text replacement utility that can also run Applescripts when you type certain characters. For example, Murphy might type dsktp or ddesk to make TextExpander run our script and display the clean desktop. There’s a lot more to TextExpander than running Applescripts, but I find it very handy in that capacity. Instead of memorizing somewhat arbitrary key combinations you can make up a code – so your shortcuts are more like keywords with meaning than shortcuts that generally only carry one letter. Murphy covered TexExpander here.
As an alternate check out FastScripts from Red Sweater Software. FastScripts lets you assign a script to a keyboard shortcut. And it has powerful features for helping you manage your script library. If you’re a heavy Applescripter you probably already know about it. If not, take a look at the features.

| Permalink

7 comments to “Hide Everything”

  1. There’s an app called DeskShade that works great.

  2. Finis, that’s a completely different thing than this.

  3. That’s actually a nice idea.
    Would be even better, when you minimize the Finder windows instead of closing them to retain all of them. I happen to have opened several Finder windows most of the time.

    So, I would have to change “close every window” to … ?
    I am not on my Mac atm, but something like “set miniaturized of every window to true” should work, right?

  4. Derico –

    Something like this should work:

    tell application “Finder”
    set the collapsed of windows to true
    end tell

  5. Thanks, Murphy. this worked perfectly and was much more elegant than a couple of downloadable apps I looked at. This tip, combined with your old posting about adding an icon to an Applescript app and I’ve got a nice little “Show Desktop” control on my dock. Dare I say, a lot like Windows.

  6. Very nice tip — I adjusted your script so that it leaves the Finder windows open along with the Find Any File application ( — I usually have several standard directories open and need to access them constantly throughout the day — I then assigned the script to a global function key so my Finder is a click away. Cheers!

    tell application “Finder”
    set visible of every process whose visible is true and name is not “Finder” and name is not “Find Any File” to false
    end tell

  7. Option+Click anywhere on the desktop, or Option+Click the Finder icon in the dock. All application windows will hide and only the desktop/Finder will remain. If you want to close all the Finder windows, press Command+Option+W.

Leave a comment