Action to Show/Hide desktop icons

Hi there,

I would love to configure a shortcut that toggles showing/hiding my desktop icons. Whenever I share my screen with colleagues, I would love to quickly hide all icons on my desktop.

This can be achieved with the following script:

defaults write com.apple.finder CreateDesktop false
killall Finder

The only problem right now is that I have to assign two shortcuts executing shell commands, one to show and one to hide the icons.

If that's the only issue, you can use the "Cycle though multiple actions (on repeated trigger)" helper action. It allows you to execute different stuff when triggering a trigger multiple times.

Thanks a lot for your quick reply, this is brilliant! :smile: Wasn't aware of this helper action.

This solved my problem, although it might sitll be nice to have show/hide desktop icons as a predefined action - it offers some privacy in times of remote work and lots of screen sharing :blush:

IMO, a more reliable solution would be to invert the current desktop state by extending your script a bit:

state=$(defaults read com.apple.finder CreateDesktop)
((state ^= 1))
defaults write com.apple.finder CreateDesktop $state
killall Finder

And this way you won't have to assign a second shortcut

Awesome, thanks!