- 
      
 - 
        
Save cynion/ae813113c96c1296c9839e8ef41fa27a to your computer and use it in GitHub Desktop.  
    Script to toggle Finder icons
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/sh | |
| defaults read com.apple.finder CreateDesktop > /dev/null 2>&1 | |
| enabled=$? | |
| if [ "$1" = "off" ]; then | |
| if [ $enabled -eq 1 ]; then | |
| osascript -e 'tell application "Finder" to quit' | |
| defaults write com.apple.finder CreateDesktop false | |
| open -a Finder | |
| echo "Desktop icons are now turned off" | |
| else | |
| echo "Desktop icons are already off" | |
| fi | |
| elif [ "$1" = "on" ]; then | |
| if [ $enabled -eq 1 ]; then | |
| echo "Desktop icons are already on" | |
| else | |
| osascript -e 'tell application "Finder" to quit' | |
| defaults delete com.apple.finder CreateDesktop | |
| open -a Finder | |
| echo "Desktop icons now turned on" | |
| fi | |
| elif [ "$1" = "status" ]; then | |
| if [ $enabled -eq 1 ]; then | |
| echo "Desktop icons are on" | |
| else | |
| echo "Desktop icons are off" | |
| fi | |
| else | |
| echo "usage: `basename $0` ( on | off | status )" | |
| fi | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment