A Service to hide/show the Desktop

Aug 05, '10 07:30:00AM

Contributed by: renaultssoftware

Sometimes you have a really cluttered desktop, and you want to clean it off, but you don't have time (or you're just plain lazy). That's where this hint about hiding/showing your desktop via a service comes in.

First of all, open Automator. When you're presented with the options sheet, choose Service. After, in the banner of the action, make it say: 'Service takes no input in any application.'

Now, drag in a Run AppleScript action from the Utilities category. Paste the following text in:

on run {input, parameters}
	set myAnswer to ((do shell script "defaults read com.apple.finder CreateDesktop") as integer) as boolean
	do shell script "defaults write com.apple.finder CreateDesktop " & (((not myAnswer) as integer) as string)
	do shell script "killall Finder"
end run
Finally, save the service as, for example, Hide/Show Desktop. You can assign it a keyboard shortcut, like ⌃⌘H, so you can hide or show your desktop.

Note: this script kills the Finder to finish its job. Remember that if you invoke this during a file operation, bad stuff could happen.

[crarko adds: I tested this, and it works as described.]

Comments (34)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100804092806364