Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Trigger script

Dustin Falgout edited this page Dec 2, 2013 · 3 revisions

When extending Thunderbird or a mail application, FireTray has a trigger option labeled Launch on count change. As the tip says, you should specify:

[the] Absolute path of the program to run when the message count changes. This program will get the new message count as the first argument.

If you choose "new messages" as the message count type in FireTray preferences, your script will be triggered when the mail count changes from the last time you viewed your inbox. This option gives only a true/false value (true=new mail; false=no new mail):

#!/bin/bash
# contributed by lots0logs 2013-10
MAIL=$1
ZERO=0

if [[ $MAIL -eq $ZERO ]]; then
  notify-send -i /usr/share/icons/Faenza/apps/scalable/thunderbird.svg "Firetray:" "You've got mail.";
else
  exit;
fi

If you choose the "unread messages" count type, your script will be triggered when new mail is received and will also include the total message count. Script example:

#!/bin/bash
# contributed by lots0logs 2013-12

MAIL=$1
ZERO=0

if [ "$MAIL" = "$ZERO" ]; then
exit
else
notify-send -u normal -a thunderbird -i /usr/share/icons/Faenza/apps/scalable/thunderbird.svg "FireTray Alert:" "You have ${MAIL} new messages.";
fi

Remember to make the script executable after you've saved it. (chmod +x /path/to/script)

Clone this wiki locally