I was inspired by John Gruber's post on disabling Flash system wide, but while I did take his advice on "cheating" with Google Chrome, I am still not entirely convinced by Chrome, so it wasn't an ideal "cheat" for me.
Also, there are times when I know I'm going to be having a few flash-based sites around in background tabs (look, I play bejeweled on facebook okay), so I wanted to be able to "toggle" flash a little bit less manually than moving plugins.
Enter BASH.
|
#!/bin/bash
|
|
|
|
EXPECTED_ARGS=1
|
|
E_BADARGS=65
|
|
if [ $# -ne $EXPECTED_ARGS ]
|
|
then
|
|
echo "Usage: `basename $0` on|off"
|
|
echo "Flash is "`defaults read com.robotapple.flashstatus FlashStatus`
|
|
exit $E_BADARGS
|
|
fi
|
|
|
|
DISPATH='/Library/Internet Plug-Ins (disabled)'
|
|
ENPATH='/Library/Internet Plug-Ins'
|
|
|
|
if [[ ! -d "$DISPATH" ]]
|
|
then
|
|
mkdir "$DISPATH"
|
|
fi
|
|
|
|
if [[ $1 == "on" ]]
|
|
then
|
|
mv "$DISPATH/Flash Player.plugin/" "$ENPATH/"
|
|
mv "$DISPATH/NP-PPC-Dir-Shockwave" "$ENPATH/"
|
|
mv "$DISPATH/flashplayer.xpt" "$ENPATH/"
|
|
defaults write com.robotapple.flashstatus FlashStatus "on"
|
|
echo "Flash is on"
|
|
fi
|
|
|
|
if [[ $1 == "off" ]]
|
|
then
|
|
mv "$ENPATH/Flash Player.plugin/" "$DISPATH/"
|
|
mv "$ENPATH/NP-PPC-Dir-Shockwave" "$DISPATH/"
|
|
mv "$ENPATH/flashplayer.xpt" "$DISPATH/"
|
|
defaults write com.robotapple.flashstatus FlashStatus "off"
|
|
echo "Flash is off"
|
|
fi
|
It's not very graceful, but it does what I want it to do. Feel free to steal, modify, judge me on my lack of BASH skills, or just save into an executable file and "flash on" or "flash off" on the command line.
Comments
Comments powered by Disqus