OraMatt: YABAOracle

Yet Another Blog About Oracle

, , , ,

Safari Extension Changer

Ever since I upgraded Safari the other day I kept getting spinning a spinning beach ball and Safari would NEVER respond.

I figured out the culprit was all the Safari Extensions I had installed.

After a bit of Google-Fu I found the shell command that would disable the Safari Extension toogle in Safari Preferences.

I decided to create an Apple Script and Alfred Workflow (you ARE using Alfred aren’t you???) to simplify the whole thing.

Here’s the Apple Script:

--
-- Safari_Extensions 
-- author: Matt D
-- email: mattdee@gmail.com
-- created: 07.17.2014
-- 

try -- ask whether or not to disable or enable Safari extensions
	
	
	display dialog "Safari Extensions" buttons {"Enable", "Disable", "Cancel"} with icon stop default button 1
	set userChoice to button returned of result
	
	if userChoice = "Disable" then
		do shell script "defaults write com.apple.Safari ExtensionsEnabled 0"
		display dialog "Extensions Disabled!" buttons {"Ok"} with icon applet default button 1
		
	else if userChoice = "Enable" then
		do shell script "defaults write com.apple.Safari ExtensionsEnabled 1"
		display dialog "Extensions Enabled!" buttons {"Ok"} with icon applet default button 1
		
	else if userChoice = "Cancel" then
		display dialog "You quit" buttons {"Ok"} with icon applet default button 1
		quit
		
	end if
	
end try

try -- Restart Safari with the Extension Flag set
	display dialog "Restart Safari?" buttons {"Restart", "Cancel"} with icon stop default button 1
	set userChoice to button returned of result
	
	if userChoice = "Restart" then
		do shell script "killall Safari; open -a Safari"
		
	else if userChoice = "Cancel" then
		quit
		
	end if
	
end try

You can download the app here

And here’s the Alfred Workflow

Enjoy!

Leave a comment

Navigation

About

I’m Matt and I do Oracle things.