Automator: How to hide files from the desktop Mac

Many users do not realize what a vast possibilities provides such a powerful tool like Automator. At first glance, the program is quite complex to learn, but understand, you can see that the control is pretty intuitive and clear. Today we’ll show you how to use a simple service, it can cause desktop macOS in order, hiding all the files.

Many users when working with files actively engages Desk, causing it to quickly lose its original appearance. Despite the fact that in macOS Mojave there is an option “Stack”, which sorts the documents by folder, this is only a partial solution to the problem. Today we’ll show you how to use Automator to create a service that will allow you to visually clear the Desk, while not removing the files themselves.

So, what do you need?

  • First, run the application “Automator”. In the opened window select “New document”.

  • When you run the program, we will offer a choice of several scenarios for further work. Select “Quick action”.
  • After creation in the right window find the “Process gets in”. The drop-down list of “the Finder”.

  • In the left part of the program it is necessary to use search and find the item “Run AppleScript”. Dragged to the workspace.

  • Now in the script window will need to copy and paste the following code:

on the run
tell application “System Events”
_activeApp set to the name of the first process whose frontmost is true
end tell
try
_theVar set to ((do shell script “defaults read com.apple.finder CreateDesktop”) as integer) as boolean
on error if the default value doesn’t already exist, create it…
do shell script “defaults write com.apple.finder CreateDesktop 1”
_theVar set to ((do shell script “defaults read com.apple.finder CreateDesktop”) as integer) as boolean
end try
do shell script “defaults write com.apple.finder CreateDesktop ” & (((not _theVar) as integer) as string)
tell application “Finder” to quit
delay 1
tell application “Finder” to launch
_activeApp tell application to activate
end run

  • Save the service: “File” –> “Save”. Specify the name of the service (any, but preferably save it as “Hide files from the desktop” for convenience).

All the necessary actions we performed, Automator can be closed. The next step is to test our service. On the desktop select “Finder” -> “Services” -> “Hide files from your desktop”.

We will request the appropriate permission. Agree. After this all the files should disappear from the desktop. To return them, you need to re-activate our service.

To discuss this article in the comments or in our Telegram chat.

Leave a Reply

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