2008年10月11日

firefoxとthunderbirdを連携させる(Linux)

Linuxマシン(Gentoo)を使っているのだけれども、thunderbirdのURLリンクをfirefoxで開きたい。そこで、その設定を行ったのをメモで残しておく。

なお、マシンの構成は以下の通り。
  • ディストリビューション : Gentoo Linux 2008.0
  • ウィンドウマネージャー : fluxbox 1.0 RC3
  • ブラウザ : firefox 2.0.0.5
  • メーラー : thunderbird 2.0.0.5
thunderbirdのプリファレンスを保持するファイルを $HOME/.thunderbird/<プロファイル名>/users.js として作成し、以下のエントリを記載する。(users.jpが既に存在している場合には追記する)

user_pref("network.protocol-handler.app.http", "/home/<ユーザ名>/.thunderbird/openlink.sh");
user_pref("network.protocol-handler.app.https", "/home/<ユーザ名>/.thunderbird/openlink.sh");
user_pref("network.protocol-handler.app.ftp", "/home/<ユーザ名>/.thunderbird/openlink.sh");
user_pref("mail.strictly_mime.parm_folding", 0);


この設定により、メール本文中のhttp, https, ftpのリンクをクリックした際に、openlink.shというシェルスクリプトが実行されるようになる。

続いて、このopenlink.shのシェルスクリプトを作成する。
作成したスクリプトはこんな感じ

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

この設定を行った上で、thunderbirdを再起動すればOK。

今度は、firefoxのMail.toでthunderbirdを開くようにする方法を調べてみようかな‥


<参考リンク>