UNIX / Linux keyboard.

Change Thunderbird's Default Browser:
Firefox vs Chrome

Which Browser, Firefox or Chrome?

Mozilla's Thunderbird electronic mail tool is very nice. I had used the KDE KMail for years but I changed to Thunderbird when the advantages had become quite clear.

With Firefox installed and used as my default browser on both my main desktop system and my laptop, things worked very well.

Then I started using TweetDeck to manage some Twitter feeds, and that required installing Google's Chrome browser.

When I installed the chromium package on my OpenBSD laptop, it became my default browser. Thunderbird no longer opened web pages in Firefox. It would try to start Chome but immediately present this error message:

The Chrome browser gets this error message on OpenBSD.

If I had tried to start Chrome from a command prompt, I would also get to see this error message:

% chrome https://www.google.com/
/usr/local/bin/chrome[17]: ulimit: bad -d limit: Invalid argument

Logged in as an unprivileged user, which is the only thing that makes sense, I see the following resource limits from within my preferred tcsh command-line environment and the bash environment:

OpenBSD:~ % limit
cputime      unlimited
filesize     unlimited
datasize     524288 kbytes
stacksize    4096 kbytes
coredumpsize unlimited
memoryuse    2952848 kbytes
descriptors  512 
memorylocked 989114 kbytes
maxproc      128 
OpenBSD:~ % bash
bash-4.2$ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) 524288
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) 989114
max memory size         (kbytes, -m) 2952848
open files                      (-n) 512
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 4096
cpu time               (seconds, -t) unlimited
max user processes              (-u) 128
virtual memory          (kbytes, -v) 528384

The chrome executable is a shell script that tries to use ulimit increase the datasize to 716800 and the number of open files to 400, then removes ~/.config/chromium/SingletonLock, and then runs the actual binary in /usr/local/chrome/chrome.

The result seems to be that Chrome runs fine if you simply agree to the warning and continue. Or at least that's the case for just running TweetDeck.

Of course, Firefox is such a resource hog that it gets killed off from time to time on OpenBSD, so at least with Chrome the situation is a little better as at least we're getting some warning.

I can live with Chrome being less than perfectly stable on my laptop, but my real goal here was to change Thunderbird's default browser. Let's solve that problem!

Start Thunderbird's Preferences menu by clicking Edit and then Preferences.

Within that new window click Advanced and then its General tab, as seen here.

The Thunderbird 'Preferences' window.

Click Config Editor...

That will bring up the warning shown here. We will continue, but you do need to be careful here.

Don't change things within the configuration editor unless you're very certain of what you're doing.

The Thunderbird configuration editor warning.

You will see the about:config editor as shown here.

There are many settings here, so we will type a string in the search box at top.

The Thunderbird configuration editor.

Type this search string:

network.protocol-handler.warn-external

The enormous list will change to just the relevant entries as shown here.

We want to change the HTTP and HTTPS settings.

The Thunderbird configuration editor after a search.

Double-click both of the HTTP and HTTPS lines. That will change them from false to true.

What we have done is to tell Thunderbird "Please warn the user", which has the desired effect of then asking what to do, including a choice of which application to use to handle this protocol.

The Thunderbird configuration editor after changing two settings.

Close the configuration editor (just click the "X" at upper right, even though this strikes me as reckless), then close the Preferences window.

Now find a message containing an http:// URL and click on it.

That will bring up the Launch Application "warning" window seen here.

Click its Choose... button

Thunderbird's application chooser.

You will need to navigate to the relevant executable. You can use the which command built into your shell to figure out where it is. Expect them to be in /usr/bin on Linux but /usr/local/bin on OpenBSD.

OpenBSD:~ % which firefox
/usr/local/bin/firefox
OpenBSD:~ % which chrome
/usr/local/bin/chrome

In the window shown here I have already navigated to the /usr/local/bin directory, scrolled down, and clicked on firefox.

Having chosen /usr/local/bin/firefox.

Once you have chosen your binary, click Open. The file chooser window will close and you will be back to the Launch Application window.

Select the box to remember this choice.

Now you just need to repeat those last three steps for an https:// URL, and you're ready to go.

Thunderbird's application chooser, having chosen.

Changing Your Mind

Try as I might, once I've done this once I can't get Thunderbird to offer me the chance to change my mind! Here's the fix in case the above doesn't work:

First, find where the Firefox and Chrome binaries are on your system. On OpenBSD I see this:

$ which firefox
/usr/local/bin/firefox
$ which chrome
/usr/local/bin/chrome 

Edit the file ~/.thunderbird/profilename.default/mimeTypes.rdf. After making the changes described above, I find the following in that file. It looks like changing alwaysAsk to "true" within the highlighted lines would be a fairly safe and simple way to replicate what we did with the configuration editor above.

Change the NC:path="..." fields from firefox to chrome.

<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Description RDF:about="urn:mimetypes">
    <NC:MIME-types RDF:resource="urn:mimetypes:root"/>
  </RDF:Description>
  <RDF:Description RDF:about="urn:root"
                   NC:en-US_defaultHandlersVersion="-1" />
  <RDF:Description RDF:about="urn:schemes">
    <NC:Protocol-Schemes RDF:resource="urn:schemes:root"/>
  </RDF:Description>
  <RDF:Description RDF:about="urn:scheme:http"
                   NC:value="http">
    <NC:handlerProp RDF:resource="urn:scheme:handler:http"/>
  </RDF:Description>
  <RDF:Seq RDF:about="urn:mimetypes:root">
  </RDF:Seq>
  <RDF:Description RDF:about="urn:scheme:handler:http"
		   NC:alwaysAsk="false">
    <NC:externalApplication RDF:resource="urn:scheme:externalApplication:http"/>
  </RDF:Description>
  <RDF:Description RDF:about="urn:scheme:externalApplication:http"
		   NC:prettyName="firefox"
		   NC:path="/usr/local/bin/firefox" />
  <RDF:Description RDF:about="urn:scheme:externalApplication:https"
		   NC:prettyName="firefox"
		   NC:path="/usr/local/bin/firefox" />
  <RDF:Description RDF:about="urn:scheme:handler:https"
		   NC:alwaysAsk="false">
    <NC:externalApplication RDF:resource="urn:scheme:externalApplication:https"/>
  </RDF:Description>
  <RDF:Seq RDF:about="urn:schemes:root">
    <RDF:li RDF:resource="urn:scheme:http"/>
    <RDF:li RDF:resource="urn:scheme:https"/>
  </RDF:Seq>
  <RDF:Description RDF:about="urn:scheme:https"
                   NC:value="https">
    <NC:handlerProp RDF:resource="urn:scheme:handler:https"/>
  </RDF:Description>
</RDF:RDF>