Tuxtips - Linux HowTos

Linux HowTos live here

How to get Thunderbird new mail notification in i3 window manager

05 Apr 2022

Here is a tutorial on how to get a working unread mail notification from Thunderbird in the i3 window manager. What you need is i3blocks for your status bar and, of course, Thunderbird e-mail client.

First, we need to determine the path to the mail folder of your Thunderbird instance. It usually sits in ~/.thunderbird/profile/ImapMail, where profile is a folder, whose name consists of two parts separated by a dot (the first part is a random string, the second is the proper profile name - if you have not created a special profile, the default one is called default-release).

Now, we need to create a shell script for i3blocks. Let's name it unreadmail.sh and place it in the home folder. The contents of the script is as follows:

click code to copy
RES=$(grep "X-Mozilla-Status: 0000" $FILE1 | wc -l)
if [ "$RES" == "0" ]; then
    echo " "
    echo " $RES "

Obviously you need to change the FILE1 variable to the path of your Thunderbird folder, specifically to the Inbox file. We have to make the script executable:

click code to copy
chmod +x unreadmail.sh

The last thing we need to do is to open our i3blocks config file (somewhere in the ~/.config directory) and add our scritpt to the blocks:

click code to copy

Remember to adjust the path in the command. If you reload your i3 (Mod+shift+R) you should see the number of unread messages in your Thunderbird, if you have any.

Of course you can modify the scritp or the i3blocks to suit your needs (e.g. you can modify the colors or the interval).
Tested on: Arch, April 2022.

Thunderbird logo:
By Ura Design - https://demo.identihub.co/thunderbirdhttps://thunderbird.ura.design/visuals/product-identity-assets.html, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=71404223
Comments Add your comment

Enter the digit "nine" (spam protection):