Turn Off Your Desktop [OS X Tips]

By

Example of dialog box created by AppleScript
A little AppleScript gives you an app that will hide the desktop whenever you want

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.

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.

Deals of the Day

20 responses to “Turn Off Your Desktop [OS X Tips]”

  1. moiano66 says:

    Who still uses desktop icons???

  2. sudoash says:

    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.

  3. KeirThomas says:

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

  4. Georgi Mladenov says:

    i expected someone would ask such an idiotic question.

  5. Guest says:

    Windows refugees. 

  6. sudoash says:

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

  7. sudoash says:

    My mounted volumes.

  8. Carbayon says:

    Or just use Desktopple: 

    http://foggynoggin.com/desktop

  9. KeirThomas says:

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

  10. Wanda Gomez-Berger says:

    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.

  11. ErinsDad says:

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

  12. ScorpionGeorge says:

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

  13. Jdsonice says:

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

  14. Bert Vanderveen says:

    I use DeskShade. No hassle with Terminal.

  15. MacRat says:

    That would make too much sense for most people.

  16. Jeffrey Gee says:

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

  17. Jeffrey Gee says:

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

  18. Netnyke says:

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

  19. KeirThomas says:

    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

  20. robrecord says:

    Thanks to some awful script on your website, one can’t simply copy & paste any of these scripts into Terminal. Please fix!

Leave a Reply

Your email address will not be published. Required fields are marked *