As part of preparing for a presentation, it’s often handy to be able to hide the icons on your desktop so that folks viewing the presentation aren’t distracted by what you have stored on your desktop.
To aid with this, there are defaults commands which can be run to hide or (if hidden) show the icons on your desktop.
To hide your desktop’s icons, run the command shown below:
defaults write com.apple.finder CreateDesktop -bool false
To show your desktop’s icons, run the command shown below:
defaults write com.apple.finder CreateDesktop -bool true
After running the appropriate command to either show or hide the desktop’s icons, the Finder needs to be restarted so that it can display the changes. You can do this one of two ways:
1. Log out, then log back in
2. Run the following command:
killall Finder
Since I usually remember only at the last minute that I should hide my desktop icons, I’ve also built an Automator application named Show or Hide Desktop Icons.app to assist me with showing or hiding my own desktop’s icons. For more details, see below the jump.
Using Show or Hide Desktop Icons.app
1. If needed, download the Show_and_Hide_Desktop_Icons zip file from the installer directory in my GitHub repo.
2. Once downloaded and installed, double-click on the Show or Hide Desktop Icons application in /Applications.
3. Depending on if your icons are visible or hidden, the following actions take place:
Visible icons:
- The defaults command to hide the icons is applied.
- The Finder process is restarted.
- A dialog window notifies you that the desktop icons are now hidden.
Hidden icons:
- The defaults command to make the icons visible is applied.
- The Finder process is restarted.
- A dialog window notifies you that the desktop icons are now visible.
How Show or Hide Desktop Icons.app works
Show or Hide Desktop Icons.app is an Automator application that uses shell scripting behind the scenes to run the needed commands. When the application is launched, the following process takes place:
The script inside the Automator application determines if the desktop icons are set to be hidden or visible by checking for the following conditions:
Condition:
The CreateDesktop value in the user’s ~/Library/Preferences/com.apple.finder.plist file is either not explicitly set or set with a boolean value of true.
Action:
- The defaults command to hide the icons is applied.
- The Finder process is restarted.
- A dialog window notifies you that the desktop icons are now hidden.
- The script exits.
Condition:
The CreateDesktop value in the user’s ~/Library/Preferences/com.apple.finder.plist file is set with a boolean value of false.
Action:
- The defaults command to make the icons visible is applied.
- The Finder process is restarted.
- A dialog window notifies you that the desktop icons are now visible.
- The script exits.
The shell script inside looks like this:
The total workflow looks like this:
For those interested, all Show or Hide Desktop Icons.app components and scripts are available via the GitHub repo linked below:
https://github.com/rtrouton/Show-or-Hide-Desktop-Icons