#!/bin/bash #set -x # Uncomment "set -x" for debugging export MOZILLA_FIVE_HOME="/usr/lib/thunderbird" #check if command line arguments have the form "mailto:somebody@somewhere.com?subject=something" #if that's true put "somebody@somewhere.com?subject=something" in MAILTO address MAILTO=`echo $@ | awk 'BEGIN{FS=":"} $1 ~ /mailto/ {print $2}'` THUNDERBIRD_PATH="/usr/lib/thunderbird" if [ -z "`ps x | grep \"[0-9] ${THUNDERBIRD_PATH}/thunderbird-bin\"`" ]; then # No thunderbird running ${THUNDERBIRD_PATH}/thunderbird $@ else # thunderbird running - raise window ${THUNDERBIRD_PATH}/thunderbird -remote "xfeDoCommand(openInbox)" fi if [ -n "$MAILTO" ]; then ${THUNDERBIRD_PATH}/thunderbird -remote "mailto($MAILTO)" fi