Skip to content

Instantly share code, notes, and snippets.

@gAmUssA
Created May 21, 2012 03:59
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 gAmUssA/2760502 to your computer and use it in GitHub Desktop.
Save gAmUssA/2760502 to your computer and use it in GitHub Desktop.
Toggle desktop icons on Mac OS X
# checks visibility and stores value in a variable
isVisible="$(defaults read com.apple.finder CreateDesktop)"
# toggle desktop icon visibility based on variable
if [ "$isVisible" = 1 ]
then
defaults write com.apple.finder CreateDesktop -bool false
echo Icons are hidden
else
defaults write com.apple.finder CreateDesktop -bool true
echo Icons are visible
fi
killall Finder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment