Changing Default Browser in Debian

Not too long ago I wrote a short article about my findings in switching my default x-scheme-handler to Chrome for opening links from mutt. I used gio, and somehow it turned out to be pretty straight forward. I recently decided to switch back to Firefox for my browser, but now following links and viewing html email in a browser would open Chrome even though I used gio to set firefox-esr as my x-scheme-handler. That doesn’t even really matter anyway because I want to use firefox and not firefox-esr, but gio wouldn’t see firefox.desktop that I created in ~/.local/share/applications. What a headache.

It turns out that gio was not the tool that I needed. Or at least I’m pretty sure it was the wrong tool. Anyway, through a combination of articles, I discovered that not only did I need to create the .desktop file, but I needed to ‘install’ it using ‘sudo update-alternatives –install /usr/bin/x-www-browser x-www-browser /usr/bin/firefox 200’ then setting the default using ‘sudo update-alternatives –config x-www-browser’. So now mutt would try to open the text/html from the list of attachments from hitting ‘v’ in the pager, but I got the error ‘file:///tmp/mutt.html not found’.

A little further digging revealed that I needed a line in my .mailcap for ‘text/html; /usr/bin/firefox %s; description=HTML Text; test=test -n “$DISPLAY”; nametemplate=%s.html’ which I got from /etc/mailcap and changed to be firefox instead of firefox-esr and added ‘set implicit_autoview=yes’ in muttrc.

Sheesh. It’s working now. I don’t know if this was the totally proper way to do this, but it works and didn’t seem to break anything else. Yet. We’ll see if something turns up later.