Firefox and Thunderbird on Slackware-10.0

Recently, I upgraded my Slackware-9.1 workstation with a fresh install of Slackware-10.0. A couple of the applications that I use heavily are Mozilla’s Firefox and Thunderbird, so these got fresh installs, as well. A quick copy of my old bookmarks file is all I need to restore Firefox, and I use IMAP for email, so all messages are kept on the servers, and all I need to do is set up the accounts.

Unlike the full Mozilla suite (browser/email together) Firefox and Thunderbird are standalone applications that are not aware of one another, so the frustrating tasks of copying email addresses from a bowser to the email client, and copying URL’s from emails to a browser are things that I just lived with. Some desktops, like Gnome have some global configuration’s for filetypes that can make setting default applications pretty easy, but I am a Fluxbox user – fast and no fluff – so there are no global application settings.

After reading through reams of forum posts and scripts, I found a pair of simple scripts, and created user.js configs for each application to call the other appropriately. Read on for the details and scripts!

I installed Firefox and Thunderbird from the current downloads at mozilla.org, so they are not Slackware packages. No worries – this is what /usr/local is for 😉 Firefox runs an install script and Thunderbird is just a tarball.

I installed firefox-0.10.1 to /usr/local/firefox, and untar’ed Thunderbird to /usr/local/thunderbird, and just to be squeaky and have the binaries in my $PATH, I created symlinks in /usr/local/bin:

/usr/local/bin/firefox -> ../firefox/firefox
/usr/local/bin/thunderbird -> ../thunderbird/thunderbird

Run them first to set up the default profiles in your home directory – this is where we add our custom user.js preferences, later on.

In /usr/local/bin, create the following shell scripts – openlink.sh and mailto.sh:

openlink.sh

#!/bin/sh
export MOZILLA_FIVE_HOME="/usr/local/firefox"
url="$1"
if [ "x$url" = "x" ]; then
url="about:blank"
fi
if $MOZILLA_FIVE_HOME/mozilla-xremote-client openURL\("$url, new-window"\); then
exit 0
fi
exec $MOZILLA_FIVE_HOME/firefox "$url"

mailto.sh

#!/bin/sh
export MOZILLA_FIVE_HOME=/usr/local/thunderbird
url="$1"
if [ $(/sbin/pidof thunderbird-bin | wc -w) -gt 0 ]; then
url=`echo "$url" | sed -e's/^mailto://'`
$MOZILLA_FIVE_HOME/thunderbird -remote "mailto($url)"
else
$MOZILLA_FIVE_HOME/thunderbird -P default -compose $url
fi

Make them executable:

chmod 755 /usr/local/bin/openlink.sh /usr/local/bin/mailto.sh

Now we have our scripts in place to open Firefox when a link in an email is clicked, and to open Thunderbird when a mailto: link is clicked in a web page – let’s set them up in our user.js preferences for each application.

Your default profile for Thunderbird will be at:

~/.thunderbird/xxxxxxxx.default

In this directory, create the file ‘user.js’ with the following:

// Use firefox for http, https & ftp links
user_pref("network.protocol-handler.app.http", "/usr/local/bin/openlink.sh");
user_pref("network.protocol-handler.app.https", "/usr/local/bin/openlink.sh");
user_pref("network.protocol-handler.app.ftp", "/usr/local/bin/openlink.sh");

Your default profile for Firefox will be at:

~/.mozilla/firefox/xxxxxxxx.default

In this directory, create the file ‘user.js’ with the following:

// Use thunderbird for mailto links
user_pref("network.protocol-handler.app.mailto", "/usr/local/bin/mailto.sh");

Restart both applications to read the user.js preferences – test out that you can open a new compose window from a mailto: link and open URL’s from emails! Thanks to all the mozillazine forums posters!

2 thoughts on “Firefox and Thunderbird on Slackware-10.0”

  1. Regarding Leroy Hartley. I saw Leroy AT 1805 Esplanade yesterday. He is alive. If anyone reads this please notify Michael who posts on pbandjelly.org and let him know Leroy is alive. I am a good friend. Of course, there is quite a story Re: Mr. Hartley at this time – he refuses to leave.

Comments are closed.