This script outputs how many emails are unread in each account of Thunderbird. It will automatically detect your default Thunderbird profile.
$ tbunread --output /where/you/need/the/output
[...] Watching /path/to/my/.thunderbird/some.profile/ImapMail/tbunread
6 1 1 2
5 1 1 2
5 1 2 2
To use the script you have to provide it with the email accounts you want to query.
This is done by creating symbolic links in a tbunread
directory inside the ImapMail
directory of Thunderbird.
The symbolic links point to one of the IMAP directories (POP3 is not supported).
By naming the links in the alphabetical order of your choice you can also choose the order of the output.
Here is an example of how it might look inside a tbunread
directory:
$ pwd
/path/to/my/.thunderbird/some.profile/ImapMail/tbunread
$ ls -lA
lrwxrwxrwx. (...) 01 -> ../mail.example1.com
lrwxrwxrwx. (...) 02 -> ../mail.example2.com
lrwxrwxrwx. (...) 03 -> ../mail.example3.com
cargo install tbunread
I recommend using systemd to run the script. See below for an example on how the service file should look like.
[Unit]
Description=tbunread
[Service]
Type=simple
ExecStart=tbunread --output /where/you/need/the/output
Restart=on-success
RestartSec=5s
[Install]
WantedBy=default.target