Skip to content

Instantly share code, notes, and snippets.

@emorydunn
Forked from chockenberry/finder_icons.sh
Last active March 16, 2023 21:23
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 emorydunn/e410cd2b503d1bdfec61cc2d0375597b to your computer and use it in GitHub Desktop.
Save emorydunn/e410cd2b503d1bdfec61cc2d0375597b to your computer and use it in GitHub Desktop.
Fish function to toggle Finder icons
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