Quick Switch Default Browser
Summary: Adding an Emacs function to quickly toggle default browser.
These days I run a few different browsers. My baseline default browser is the Mullvad Browser; when I open a URL its in this browser. Leaking the least amount of information.
When I want persisted sessions, I jump over to Firefox but with uBlock Origin and NoScript which prompts me to make decisions about each and every domain that tries to load a resource.
And when I don’t want to fuck around with various privacy antics, I load up Safari.
What I found was that I would want to shift my default browser to accomodate some odd task I was attempting. So I wrote an Emacs 📖 function to help me quickly set my default browser. This leverages the defaultbrowser MacOS shell command.
Here’s the interactive command that makes this change quicker:
(defun jf/default-browser (&optional name)
"Set the default browser based on the given NAME."
;; brew install defaultbrowser
(interactive (list
(completing-read
"Browser: "
'("mullvadbrowser" "firefox" "safari"))))
(shell-command (concat "defaultbrowser " name)))
This is a minor quality of life improvement, but one that helps me navigate a surveillance capitalism hell-scape.