Jump to content

DefaultBrowser - Change your default web browser easily from within Alfred - v1.1 Update Released September 10, 2015


Recommended Posts

Change your default web browser quickly and easily from within Alfred.

Simple yet effective, this workflow enablea you to easily change your default browser. The official repository is located on Github --> https://github.com/stuartcryan/defaultbrowser-alfred-workflow where any issues can be logged on the issue tracker. I have also put this workflow on Packal.

 


Update Version 1.2 released September 10, 2015:

What has changed:

  • Feature: Support additional browsers - added FirefoxDeveloperEdition and Webkit Nightly Build

Update Version 1.1 released August 8, 2015:

What has changed:

  • Feature: Support additional browsers - added Chromium, Canary and SeaMonkey
  • Feature: Only show installed browsers
  • Feature: Indicate which browser is the current default
  • Feature: Added hotkey assignments (to launch workflow, launch with "chrome", and launch with "safari")
  • Improvement: Renamed description in Alfred to simply "Default Browser"
  • Improvement: Improved failure feedback
  • Improvement: Major code refactor to remove duplication and speed up the workflow
  • Improvement: Added an icon to the workflow
  • Improvement: defaultbrowser binary has been updated to better support integrating. This code has been put into a pull request for the official publication of defaultbrowser.


Workflow Details:

A simple workflow to allow quick and easy changing of the default browser on OSX using a workflow in Alfred.

Installation

  1. Download the .alfredworkflow file or you can get it on Packal.
  2. Run to import into Alfred

Donations

This workflow represents many hours effort of development, testing and rework. The images that have been licensed for this workflow from DepositPhotos also needed a bit of my moolah. So if you love the workflow, and get use out of it every day, if you would like to donate as a thank you to buy me more caffeine giving Diet Coke, some Cake, or to put towards a shiny new gadget you can donate to me via Paypal.

 

donate.png

 

You should also consider getting into contact with Margus Kerma and donating to Margus also for the work that has bene put into the defaultbrowser binary.

Usage

  • db < browser >
  • Note - if you try to set the default browser that is already active as the default you will just get a notification.

Browsers currently supported:

  • Chrome
  • Firefox
  • Opera
  • Safari
  • Chromium - New in V1.1
  • Canary - New in V1.1
  • SeaMonkey - New in V1.1

Screenshots

default_browser_screenshot_1.png

 

default_browser_screenshot_2.png

 

default_browser3.jpg

 

default_browser_screenshot_4.png

 

Troubleshooting

If you are finding that you are seeing browsers listed that you have installed previously but no longer have on your system you will need to clear out all your default handlers.

Unfortunately, this is the only solution I have found to date, you should research it in depth before you use it. The following command will re-initialise all the "handlers" OSX knows about and will therefore resolve the issue, it will also likely require you to set up all your custom file associations again.

In other words... you do this at your own risk, I do not support this in any way shape or form...

The command you will need to run on the terminal is: lsregister -kill

 

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Change Log

  • Version 1.2 - Feature Release
    • Feature: Support additional browsers - added FirefoxDeveloperEdition and Webkit Nightly Build 
  • Version 1.1 - Feature Release
    • Feature: Support additional browsers - added Chromium, Canary and SeaMonkey
    • Feature: Only show installed browsers
    • Feature: Indicate which browser is the current default
    • Feature: Added hotkey assignments (to launch workflow, launch with "chrome", and launch with "safari")
    • Improvement: Renamed description in Alfred to simply "Default Browser"
    • Improvement: Improved failure feedback
    • Improvement: Major code refactor to remove duplication and speed up the workflow
    • Improvement: Added an icon to the workflow
    • Improvement: defaultbrowser binary has been updated to better support integrating. This code has been put into a pull request for the official publication of defaultbrowser.
  • Version 1.0 - Initial Release

Credits

defaultbrowser binary for OSX has been created by Margus Kerma.

  • Margus has been kind enough to permit me to include the binary for defaultbrowser as part of this workflow to make distribution significantly easier.
  • For any issues with the defaultbrowser binary please log these to the official DefaultBrowser Issue Tracker.

DefaultBrowser Alfred workflow created by Stuart Ryan. If you would like to get into contact you can do so via:

License

With the exception of the workflow logo, this Alfred Workflow is provided free of charge under the GNU GENERAL PUBLIC LICENSE Version 2 June 1991.

The workflow logo is licensed only for use in this workflow and must be changed if the workflow is forked in the future.

The workflow logo has been licensed from DepositPhotos to Stuart Ryan.

Edited by stuartcryan
Link to comment
  • 2 weeks later...

I am happy to say I have pulled together a major update for everyone. I hope there are others out there getting use out of this, if not... I have done a lot of updates for my self :D *cackles*.

 

Changes are as follows:

  • Feature: Support additional browsers - added Chromium, Canary and SeaMonkey
  • Feature: Only show installed browsers
  • Feature: Indicate which browser is the current default
  • Feature: Added hotkey assignments (to launch workflow, launch with "chrome", and launch with "safari")
  • Improvement: Renamed description in Alfred to simply "Default Browser"
  • Improvement: Improved failure feedback
  • Improvement: Major code refactor to remove duplication and speed up the workflow
  • Improvement: Added an icon to the workflow
  • Improvement: defaultbrowser binary has been updated to better support integrating. This code has been put into a pull request for the official publication of defaultbrowser.
Link to comment
  • 1 month later...
  • 8 months later...
  • 3 months later...
  • 2 months later...
  • 4 months later...
  • 2 months later...
  • 4 months later...
  • 2 years later...
  • 6 months later...
  • 10 months later...
  • 2 months later...
  • 1 month later...
  • 1 month later...

Hello, nice idea for workflow, I adapted this for my use case :

  1. Chrome is a default for work
  2. Safari is my default browser for personal staff
  • When I start my work day I lunch a workflow that start several apps & now sets default browser to Chrome.
  • When my workday is done I lunch a workflow that close/forecquit all apps that I opened during the day & sets default browser to Safari

For annoying system pop-up I found this AppleScript that automate closing this shit

 

tell application "System Events"
			tell application process "CoreServicesUIAgent"
				tell window 1
					tell (first button whose name starts with "HERE INSERT FIRST WORD OF THE POP-UP BUTTON")
						perform action "AXPress"
					end tell
				end tell
			end tell
		end tell

 

Maby this will help somebody

 

Have a nice day :)

Edited by snoop182
script_edit
Link to comment
  • 9 months later...
On 3/27/2022 at 10:52 AM, snoop182 said:

Hello, nice idea for workflow, I adapted this for my use case :

  1. Chrome is a default for work
  2. Safari is my default browser for personal staff
  • When I start my work day I lunch a workflow that start several apps & now sets default browser to Chrome.
  • When my workday is done I lunch a workflow that close/forecquit all apps that I opened during the day & sets default browser to Safari

For annoying system pop-up I found this AppleScript that automate closing this shit

 

tell application "System Events"
			tell application process "CoreServicesUIAgent"
				tell window 1
					tell (first button whose name starts with "HERE INSERT FIRST WORD OF THE POP-UP BUTTON")
						perform action "AXPress"
					end tell
				end tell
			end tell
		end tell

 

Maby this will help somebody

 

Have a nice day :)

Do you mind sharing your workflows that launches your apps at the start of your workday and vice-versa? 🙂

Link to comment
  • 2 weeks later...

Coincidentally, I updated the code and workflow today. After peeking in here and seeing your script, @snoop182, I integrated it as well. Works like a charm! With a few tweaks that is. Here's a version of the script that confirms the default browser switch automatically and can handle most bundle names, regardless of locale:

 

on run
	set theBrowser to "{query}"
	set browserComponents to theBrowser's words
	tell application "System Events"
		tell application process "CoreServicesUIAgent"
			tell window 1
				set buttonNames to (name of every button)
				repeat with buttonName in buttonNames
					repeat with theComponent in browserComponents
						if (buttonName contains theComponent) then
							tell (first button whose name contains theComponent)
								perform action "AXPress"
							end tell
							return
						end if
					end repeat
				end repeat
			end tell
		end tell
	end tell
end run

 

And thanks @Grug@Mr Kenz :lol:. Perhaps now it deserves its own topic.

 

Link: Set Default Browser v1.1.0

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...