Automator Service to Hide or Show Desktop Files

MJD 0 Comments

Here is a handy little automator service so you can quickly remove all the files that are cluttering your desktop without deleting them all. This service just hides your desktop files and then when you want them back the service will replace them as they were. Very handy if you need an uncluttered desktop for any length of time but don't want to spend time organising/deleting them.

  • Open Automator
  • Select Service

  • In Service Receives select No Input and Finder

  • In Actions type Run and look for Run AppleScript

  • Drag Run AppleScript to the main window on the right

  • Copy the following and paste it over the contents in the AppleScript window

try
set toggle to do shell script "defaults read com.apple.finder CreateDesktop"
if toggle = "true" then
do shell script "defaults write com.apple.finder CreateDesktop false"
else if toggle = "false" then
do shell script "defaults write com.apple.finder CreateDesktop true"
end if
end try

do shell script "killall Finder"
delay 0.5
activate application "Finder"

  • Press CMD+S and give the service a relevant name and select Save

The service is now ready but you must enter a command into Terminal first before it will work.

  • Open Terminal
  • Paste the following into Terminal

defaults write com.apple.finder CreateDesktop false; killall Finder

  • Press Enter
  • Paste the following into Terminal

defaults write com.apple.finder CreateDesktop true; killall Finder

  • Press Enter
  • Quit Terminal

The service will now work from the services menu in your menubar

Finder > Services > Whatever you named service

MJD

Comments