Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created June 26, 2016 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/073d1302ed4af95608cfb5eca37a41f1 to your computer and use it in GitHub Desktop.
Save rtrouton/073d1302ed4af95608cfb5eca37a41f1 to your computer and use it in GitHub Desktop.
Shell script used by the Show or Hide Desktop Icons.app Automator application
if [[ `/usr/bin/defaults read com.apple.finder CreateDesktop` = "" ]] || [[ `/usr/bin/defaults read com.apple.finder CreateDesktop` == "1" ]]; then
/usr/bin/defaults write com.apple.finder CreateDesktop -bool false
/usr/bin/killall Finder
sleep 1
/usr/bin/osascript -e 'tell app "System Events" to display dialog "Desktop icons are now hidden." buttons "OK" default button 1'
exit
fi
if [[ `/usr/bin/defaults read com.apple.finder CreateDesktop` == "0" ]]; then
/usr/bin/defaults write com.apple.finder CreateDesktop -bool true
/usr/bin/killall Finder
sleep 1
/usr/bin/osascript -e 'tell app "System Events" to display dialog "Desktop icons are now visible." buttons "OK" default button 1'
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment