Author Topic: Firefox/Thunderbird "Integrator"  (Read 1199 times)

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Firefox/Thunderbird "Integrator"
« on: 16 January 2006, 15:17 »
If any of you use Firefox and Thunderbird in linux or BSD and want them to use eachother, here is my script that links them together. This *should* work in linux (tested in FreeBSD only!), but if it doesn't it shouldn't do any damage.

Just save is as a shell script, chmod it and run it. It's fully automated.

Code: [Select]
#!/bin/sh
#PUBLIC DOMAIN
#Script by Paul Blair ([email protected])
#
#This script installs the neccessary scripts and configures both firefox and thunderbird
#so that they can interact with eachother on BSD systems.
#
#Please don't laugh. I'm not a shell scripting expert by any means!! ;)
#

if test -d $HOME/.mozilla/firefox; then
if test -d $HOME/.thunderbird; then
echo "Firefox and Thunderbird need to be closed to perform this operation. If you have any work open in either program, please save it and close both programs now."
echo -n Hit ENTER to proceed...; read ans
#Kill firefox and thunderbird
for i in `top | grep "$user" | grep "firefox-bin" | awk '{ print $1 }'`
do
kill $i
done
sleep 1
for i in `top | grep "$user" | grep "thunderbird" | awk '{ print $1 }'`
do
kill $i
done
sleep 1
fi
fi


if test -d $HOME/.mozilla/firefox; then
echo "Firefox Profile Found!"
else
echo "Setup has detected that you have no Firefox profile. Setup will now launch Firefox in order to create a profile for you."
echo -n Hit ENTER to proceed...; read ans
#start both programs, in case they have never been run and no profile exists
firefox&
sleep 3
for i in `top | grep "$user" | grep "firefox" | awk '{ print $1 }'`
do
kill $i
done
fi

if test -d $HOME/.thunderbird; then
echo "Thunderbird Profile Found!"
else
echo "Setup has detected that you have no Thunderbird profile. Setup will now launch Thunderbird in order to create a profile for you."
echo -n Hit ENTER to proceed...;  read ans
thunderbird&
sleep 3
for i in `top | grep "$user" | grep "thunderbird" | awk '{ print $1 }'`
do
kill $i
done
fi



#Install Mozilla link to Thunderbird
####################################
#Detect firefox profile path
profile_path=`(grep -A3 "Profile0" $HOME/.mozilla/firefox/profiles.ini | grep Path | sed ''/Path=/s///'')`
#copy script that handles "mailto" links in users firefox directory
echo "#!/bin/sh" > $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "#PUBLIC DOMAIN" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "#Script by unkonwn" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "#Script to integrate firefox with thunderbird on BSD Systems" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "#This script is used by firefox to invoke thunderbird properly when a \"mailto\" link is clicked from a web page" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "if (thunderbird -remote \"ping()\"); then" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "thunderbird -remote \"mailto(\$1)\"" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "else" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "thunderbird \$1" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
echo "fi" >> $HOME/.mozilla/firefox/firefox_mailto_handler.sh
chmod 755 $HOME/.mozilla/firefox/firefox_mailto_handler.sh
#modify user's firefox preferences to invoke script
echo "user_pref(\"network.protocol-handler.app.mailto\", \"$HOME/.mozilla/firefox/firefox_mailto_handler.sh\");" >> $HOME/.mozilla/firefox/$profile_path/prefs.js

#Install Thunderbird link to Mozilla
####################################
#Detect thuderbird profile path
profile_path=`(grep -A3 "Profile0" $HOME/.thunderbird/profiles.ini | grep Path | sed ''/Path=/s///'')`
#copy script that handles "mailto" links in users thunderbird directory
echo "#!/bin/sh" > $HOME/.thunderbird/thunderbird_link_handler.sh
echo "PUBLIC DOMAIN" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "#Script by unkonwn" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "#Script to integrate thunderbird with firefox on BSD/linux Systems" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "#This script is used by thunderbird to invoke firefox properly when a link in an email is clicked" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "if (firefox -remote \"ping()\"); then" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "firefox -remote \"openurl(\$1,new-tab)\"" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "else" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "firefox \$1" >> $HOME/.thunderbird/thunderbird_link_handler.sh
echo "fi" >> $HOME/.thunderbird/thunderbird_link_handler.sh
chmod 755 $HOME/.thunderbird/thunderbird_link_handler.sh
#modify user's thunderbird preferences to invoke script
echo "user_pref(\"network.protocol-handler.app.http\", \"$HOME/.thunderbird/thunderbird_link_handler.sh\");" >> $HOME/.thunderbird/$profile_path/prefs.js
echo "user_pref(\"network.protocol-handler.app.https\", \"$HOME/.thunderbird/thunderbird_link_handler.sh\");" >> $HOME/.thunderbird/$profile_path/prefs.js

echo "Installation is complete!"
« Last Edit: 24 May 2010, 18:57 by Refalm »
:)

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Re: Firefox/Thunderbird "Integrator"
« Reply #1 on: 17 January 2006, 00:53 »
I made a fix to the script. Forgot to put a couple of "\" which would cause the installed hadler scripts not to pass the url to the app.
:)

Aloone_Jonez

  • Administrator
  • Member
  • ***
  • Posts: 4,090
  • Kudos: 954
Re: Firefox/Thunderbird "Integrator"
« Reply #2 on: 17 January 2006, 01:07 »
Even though no one else give a fuck I think this is a good idea and I'll try it when I install the latest version of Thunderbird on Ubuntu when I get round to it.

Could it be possible to distribut similar scripts to this to automatically set up icons on the desktop like Xfce, Gnome or KDE?

A software developer could just distribute thier software with a universal install script that detects what desktops are present on the system and add the appropriet icons.

This sort of thing would simplify the installation of programs for many newbs and people who want to learn can easily view the scripts, it'll be like back in the days of programs comming with batch file installation program but UNIX's scripting is far superiour.
This is not a Windows help forum, however please do feel free to sign up and agree or disagree with our views on Microsoft.

Oh and FUCKMicrosoft! :fu: