Turn Off Your Desktop [OS X Tips]

Example of dialog box created by AppleScript

If you’re using your Mac to give a presentation, you might not want everybody to see your messy desktop! If so, you can run a quick command that will hide your desktop icons.

To temporarily turn off the desktop, open a Terminal window (Finder->Applications->Utilities->Terminal) and type the following line:

defaults write com.apple.finder CreateDesktop -bool FALSE;killall Finder

Note that this will mean you can no longer right-click on the desktop or drag files there. The files there will still be accessible by using Finder to browse to your Desktop folder.

Typing the command

A simple command will hide all desktop detritus--essentially, turning it off

To restore things back to normal after your presentation, again open a Terminal window, but this time type the following:

defaults delete com.apple.finder CreateDesktop;killall Finder

Hey, presto! Everything should be back to normal. If not, log out and back in again.

With the use of a quick AppleScript, this Terminal command can even be turned into an standalone application that you can run before each presentation, saving the hassle of the command line.

Open AppleScript editor (Finder->Applications->Utilities->AppleScript Editor), and cut and paste the following code:

display dialog "Desktop icons visible or hidden?" buttons {"Visible", "Hidden"} with icon 2 with title "Switch to presentation mode" default button 1
set switch to button returned of result
if switch is "Hidden" then
do shell script "defaults write com.apple.finder CreateDesktop -bool FALSE;killall Finder"
else
do shell script "defaults delete com.apple.finder CreateDesktop;killall Finder"
end if

Click the Run button on the toolbar to test your script. You should see a dialog box appear with two buttons: Visible and Hidden. To make sure the app works OK, click Hidden to hide the icons, then run the app again and click Visible to reveal them again.

Example of dialog box created by AppleScript

A little AppleScript gives you an app that will hide the desktop whenever you want

To save the AppleScript as an application, click File->Save As. Type a filename and, in the File Format dropdown list, select Application. Save the file, although not on your desktop–when the icons get hidden, you won’t be able to access it again to unhide them unless you use Finder.

Related
  • moiano66

    Who still uses desktop icons???

  • sudoash

    Nice idea. However, for anyone using the AppleScript, remove the tell application start and end blocks as it’s not required. You’ll end up with Terminal being left open anyway.

  • KeirThomas

    Ashley I’m not an AppleScript expert but this script doesn’t open a Terminal window.

  • Georgi Mladenov

    i expected someone would ask such an idiotic question.

  • Guest

    Windows refugees. 

  • sudoash

    It doesn’t open a window, but the Terminal application itself is left open. Enable the indicator and you’ll see.

  • sudoash

    My mounted volumes.

  • Carbayon

    Or just use Desktopple: 

    http://foggynoggin.com/desktop

  • KeirThomas

    OK, I see what you mean. Thanks. I’ve fixed the script now to remove the ‘tell’ and ‘end tell’ statements. 

  • Wanda Gomez-Berger

    Alternatively, create a User account that you use for presentations and has a “clean” desktop.
    From this account run your presentation – being sure the file is accessible by setting permissions correctly.

  • ErinsDad

    I could try this, I just know I’d mess it up and never see my icons again.  I like Wanda’s idea better.

  • ScorpionGeorge

    Why not just clean your desktop? That seems so much easier than using terminal to make them disappear or creating another user account.

  • Jdsonice

    Excellent. The script works perfectly – please read and follow the instructions. Thanks for sharing.

  • Bert Vanderveen

    I use DeskShade. No hassle with Terminal.

  • MacRat

    That would make too much sense for most people.

  • Jeffrey Gee

    Thank you!  This is awesome.  More applescript tips please.

  • Jeffrey Gee

    Cool, thanks!  I added a quit command already into my if & else statement, but that’s good to know.

  • Netnyke

    Add this at the end (in the AppleScript editor): quit application “Terminal”

  • KeirThomas

    Hi Netnyke, see my comment below in response to Ashley’s discussion. I’ve now removed the references to Terminal in the script, so there’s no need to add a line to quit it. 

    _______
    Keir Thomas
    Author of Mac Kung Fu
    Over 300 tips, tricks, hints and hacks for OS X Lion
    http://pragprog.com/book/ktmac

About the author

Keir ThomasKeir Thomas (http://keirthomas.com) is the author of Mac Kung Fu, which contains over 300 tips, tricks, hints and hacks for Mac OS X Lion. He's also the author of over 10 other computing titles.

(sorry, you need Javascript to see this e-mail address)| Read more posts by .

Posted in Mac, OS X, Tips & Tricks | Tagged: , , , , , , , |