Hide Desktop Icons With an Automator App

If you have a cluttered Desktop, you may want to occasionally hide the icons. You can do this with third-party apps or Terminal commands. You can also write a very simple shell script in Automator and save it as an app. Then you can toggle the Desktop on or off with a simple click in the Dock.



Here is the code used in the Automator shell script:

if $(defaults read com.apple.finder CreateDesktop);
then
	defaults write com.apple.finder CreateDesktop false
else
	defaults write com.apple.finder CreateDesktop true
fi
killall Finder

Comments: 15 Responses to “Hide Desktop Icons With an Automator App”

    Emory
    5 years ago

    Gary; I tried to copy and paste your script into Automator but it didn't work. I tried doing it as a "Work Flow" then as an "Application" but neither one would accept the pasting action. What am I doing wrong here?

    5 years ago

    Emory: Are you adding the Shell action first and then putting the script in the shell? What version of MacOS? Does it give an error message? Does it at least seem to restart the Finder?

    Greg
    5 years ago

    Gary: here is what I typed
    if $(defaults read com.apple.finder CreateDesktop);
    then
    defaults write com.apple.finder CreateDesktop false
    else
    defaults write com.apple.finder CreateDesktop true
    f1
    killall Finder

    when I run I get this message: The action “Run Shell Script” encountered an error: “zsh:7: parse error near `Finder'”

    what can I do to correct --- Thanks

    5 years ago

    Greg: You appear too have typed f1 (the letter f and the number 1) instead of fi (the letter f and the letter i).

    Greg
    5 years ago

    Gary: (a bit red faced) - thanks - guess I just need an editor - at least a new set of eyes - works great

    Joshua
    5 years ago

    Hello Gray thanks for everything,
    i just want to be clear, must i first type in the command in Terminal and then the same command on Automator, or i just need to put the commands on automator only. i am a bit confused here from your video tutorial. Thanks for helping in advance.

    Gerd Gerdes
    5 years ago

    Hello Gary,
    Thank you for the skript.
    I tried to save it as an app but that didn't work.
    The system says that i don't have the right for that.
    So i searched the position of the automator app and tried to change the permissions but that did not work.
    I work with High Sierra.
    Can you please give me an hint?

    Thanks Gerd from Germany

    5 years ago

    Gerd: I don't know what your specifics are, but keep trying. Are you using a standard account or administrator? When it asked about permissions, did you grant them?

    Gerd
    5 years ago

    Thank you Gary!

    I first hat to make a copy and then i could that.

    John Thomas
    5 years ago

    Awesome! I have wanted to this forever. Thank you, Gary!!!!!

    John Thomas
    5 years ago

    Awesome! I have wanted to this forever. Thank you, Gary!!!!!

    asish
    5 years ago

    Gary, when i hit 'Run' after entering the script the message is "This app will not receive input when run inside Automator" and "To test this application with Automator, add the "Get Specified Finder items" act at the beginning of your workflow. Remove or disable the action before running the workflow outside of Automator". Am running High Sierra. Hope you can help. Thanks ahead

    5 years ago

    asish: It sounds like you have more than just the shell script in there. Take a careful look at what you have and compare it to what I am doing in the video. Maybe start again from scratch and follow along with what I am doing in the video.

    John Stires
    5 years ago

    Is it possible to toggle displaying Finder and Desktop "stuff" using a double click on the background? My goal would be to open a Finder window as well as the icons via a double click. Thanks G.

    5 years ago

    John: Clicking on the Desktop background? No, I can't think of any way to capture that as a trigger for an action, sorry.

Comments Closed.