Toggling Between a Hidden and a Restored Desktop ( No Desktop Icons )

On the theme of clearing the decks and suspending distractions, various approach to hiding desktop clutter for a while:

Toggle:

if [ $(defaults read com.apple.finder CreateDesktop) != 0 ]
then
  defaults write com.apple.finder CreateDesktop 0
else
  defaults write com.apple.finder CreateDesktop 1
fi
killall Finder

Hide Desktop icons:

Show Desktop icons:

Choose to hide or show the desktop icons from a dialog:

tell application "System Events"
	activate
	tell (display dialog "Hide or show Desktop icons?" buttons {"Hide", "Show"} with title "Hide or show Desktop" default button 1)
		set strSetting to ((button returned is not "Hide") as integer) as string
	end tell
end tell
do shell script "defaults write com.apple.finder CreateDesktop " & strSetting & "; killall Finder"
3 Likes

Most of the solutions for how to hide all desktop icons require killing and restarting Finder, as the method above does.

For me, with several FiInder windows open all the time on various desktops, it can take as long as 16 seconds for my desktop to be rebuilt and for me to be able to get back to work. That's a nearly intolerable delay. (:wink: A first-world problem if there ever was one, right?)

I found a free little utility called Clarity (http://www.shirt-ediss.me/clarity/) that instead moves everything from the current Desktop folder to a temporary folder and then back again. Since Finder responds fairly quickly to changes to the Desktop folder and all the other Finder windows don't have to be regenerated, it takes 2-4 seconds to change modes. Much more useful, right?

In addition, Clarity allows you to have any number of desktop icon configuration sets and swap between them with terminal commands, referring to the icon sets by name or number. This seems a natural to automate with KBM, but I haven't gotten there yet.

I hope this helps.