-
-
Save emorydunn/e410cd2b503d1bdfec61cc2d0375597b to your computer and use it in GitHub Desktop.
Fish function to toggle Finder icons
This file contains 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
function finder_icons --description 'Script to toggle Finder icons' | |
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1 | |
set enabled $status | |
switch $argv[1] | |
case off | |
if test $enabled -eq 1 | |
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" | |
end | |
case on | |
if test $enabled -eq 1 | |
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" | |
end | |
case status | |
if test $enabled -eq 1 | |
echo "Desktop icons are on" | |
else | |
echo "Desktop icons are off" | |
end | |
case '*' | |
echo "usage: `basename $0` ( on | off | status )" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment