I'm a big fan of multiple desktop spaces on OS X 10.7 (see image).
I'm wondering if you can hide desktop icons on just one of the 4 spaces I have setup. Is that possible?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
This free app may be useful to you. It does not exactly do what you ask, but it comes close, and there may be ways to further automate it to get even closer.
When this is installed as directed, a couple of simple terminal commands, e.g.:
$ sw 0 $ sw 1
let you empty the desktop of icons (except for mounted drives, if you have your desktop configured to show them) and then switch back to your standard desktop.
In my initial testing (I just installed it tonight) it takes about 2 seconds to clear the desktop and about 4 seconds to restore it.
Clarity has the added advantage of letting you save various desktop configurations to switch back and forth among, identified by either number or a text name. In the above commands, you could also type
$ sw home
which may be more mnemonic if you have saved dozens of desktop configurations.
If you want to have the Clarity commands automatically invoked to change the icons when you move between desktop workspaces, as in the OP, I believe you can achieve that using the free Mac program CurrentKey Stats (https://currentkey.com/). The latest version (12/2020) adds the feature of "Bi-directional AppleScript support". As described on the CurrentKey web page:
CurrentKey can also notify your own custom AppleScript every time you switch between Rooms. This enables you to trigger Room-specific functionality outside of the app.
While I have not tested that feature of CurrentKey, I've corresponeded with the developer and I use it for switching between workspace desktops constantly.
It seems like it would be a straighforward task to have CurrentKey trigger an AppleScript function that runs
sw 0 when you enter a specific workspace and then run
sw 1 when you leave it. If I were more facile with AppleScript, I would knock one up right now to try it and complete this answer.
Another technique for clearing and restoring the desktop icons is described at Hide files/icons on the desktop but not in finder. While Clarity (above) empties the
Desktop folder and then restores it from saved snapshots, the technique on that thread addresses the need to have the contents of the
Desktop folder stay intact. It turns off or on a Finder default setting and then kills the Finder app so that it restarts.
When I tried it, the icons went away instantly, but so did my Finder windows, which then took about 12 seconds to be automatically restarted. When restoring the desktop, the Finder windows were again restored in about 12 seconds with the desktop icons following a few seconds later. Personally, I would find it disturbing to have that automatically happen whenever I changed desktop workspaces. If you absolutely need to access the contents of your Desktop directory while the icons are hidden, that delay may be worth it to you.
I hope this helps.