Chapter 2. Misc programs

Table of Contents

Mozilla Thunderbird
Opera
XMMS
Current song in mail signature
Broadcasting the song information with icecast

Here are some tips and settings I use to integrate programs into each other.

Mozilla Thunderbird

My favourite email program.

When I call thunderbird while there is an open instance, a new instance is started and the "select profile" dialog is shown. I don't like this behaviour, and so here is a script which just activates a running instance if there is one.

Example 2.1. /home/cweiske/scripts/start-tb

#!/bin/sh
sudo /scripts/mail-popfile

if [ `ps -u cweiske | grep thunderbird-bin | wc -l` -eq 0 ]; then
        #echo "start thunderbird new"
        /usr/bin/thunderbird &
else
        #echo "thunderbird is running, just activating"
        thunderbird -remote "xfeDoCommand(openInbox)"
fi

The mail-popfile scripts takes care that stunnel (ssh program) and popfile (spam filter) is started, so that I can filter my mails with popfile and use a SSL connection to the mail server at the same time.

Note

This script has to be run as root, so use sudo from your normal profile

Example 2.2. /scripts/mail-popfile

#!/bin/sh

#stunnel - already running?
numstunnel=`ps uax | grep stunnel | wc -l`
if [ $numstunnel -ge 2 ]; then
        echo "stunnel is running"
else
        echo "starting stunnel"
        /usr/sbin/stunnel
fi

#popfile
numpopfile=`ps uax | grep popfile | grep perl | wc -l`
if [ $numpopfile -ge 1 ]; then
        echo "popfile is running"
else
        echo "starting popfile"
        cd /usr/share/popfile
        ./popfile.pl &
fi

echo "mail-popfile done"

Normally firefox is started when there is a link in an email in thunderbird, but I am addicted to Opera... So I changed the http protocol handler that it starts Opera now

Example 2.3. /home/cweiske/.thunderbird/default/9sm8x38r.slt/prefs.js

...
user_pref("network.protocol-handler.app.http", "/home/cweiske/scripts/browser");
...

with the browser script being the following

Example 2.4. /home/cweiske/scripts/browser

#!/bin/sh
# opens opera with the given url

url="$1"
if [ "x$url" = "x" ]; then
        url="about:blank"
fi

exec opera -newpage "$url"

Now it is comfortable with thunderbird, but I am still missing some things:

  • Tell me the number of newly arrived, non-spam mails