HOWTO Better Integrate Thunderbird With Cinnamon

MagicMint
  4 years ago
  1

thunderbird_with_cinnamon The mail program used by default in Linux Mint is Mozilla Thunderbird, which is an awesome piece of free software. As such, it doesn’t target any specific platform, which, in turn, means that in Cinnamon, e.g., there is some room left for improvement regarding its integration into that platform.

1. Starting in the background

The people at Mozilla seem to think that Thunderbird is indispensable at the point cheeky that it doesn’t need to be started in the background. But to me, a mail program should always run automatically in an invisible manner, unless I want to write a mail or read a new one. So let’s see how we can force Thunderbird to do so.

First of all, you need to install a little utility called xdotool, preferably with the Software Manager as it’s always counselled. After this has been done, you must make up a script for the mailer with the following single but multi-line command from a terminal window (you could do this graphically from Nemo as well, but it would require 8 mouse clicks, whereas by marking the entire command, you’re done with just a left click to start the terminal and a middle one to paste the command enlightened ):

…$ mkdir --parents ~/bin; \
   touch ~/bin/thunderbird; \
   chmod +x ~/bin/thunderbird; \
   gedit ~/bin/thunderbird

 

Once the text editor has started, fill in the following contents, and save the file:

#!/bin/bash
# {~,/usr/local}/bin/thunderbird (MagicMint) O1010
# Start thunderbird minimized if desired

mailer="/usr/bin/thunderbird"

help_msg() {
 cat <<-EOF
 `awk  'FNR==3 {print gensub("# ", "", 1)}' "$0"`
 Usage: `basename $0` [-min] [URL] | [-h] | [--help]
 EOF
}

case $1 in
 -h | --help )
  help_msg
  echo
  read -p "Press [Enter] to continue or [CTRL-C] to abort"
  eval $mailer --help 2>/dev/null 
  ;;

 -min )
  shift
  eval $mailer "$@" &
  until test $THUNDERWIN; do
   sleep 1
   THUNDERWIN=`xdotool search --name ".*- Mozilla Thunderbird$"|head -n 1`
  done
  xdotool windowfocus --sync $THUNDERWIN
  xdotool key Ctrl+Super+Down
  ;;

 *) exec $mailer "$@"
  ;;
esac
#End of script

 

In principle, the script above starts Thunderbird as usual, but waits for its window to show up when it is supplied with a “-min” parameter, and then simulates a [Ctrl+Super(aka Windows)+Down] key press to minimize it. This was the only key combo that worked for me in Cinnamon 2.6, so take care to try it out on some open window, and set it accordingly in (System) Settings› Keyboard› Keyboard shortcuts› Windows› Minimize Windows if necessary.

The purpose of the parameter aforesaid is to start Thunderbird in the background when you log in, so do Menu› Preferences› Startup Applications› Add the starter below to your session. Therein, you should adjust the marked value of the Startup Delay in order to allow for Thunderbird to minimize reliably at startup.

Thunderbird Startup Launcher
 

Remark Ⅰ

The script above will be installed as explained for the current user only. If you want to make it available system wide, that is for all users, you have to replace “~/bin” by “/usr/local/bin” in the initial commands. You can also move the script there subsequently with the following command:

…$ sudo mv --interactive ~/bin/thunderbird /usr/local/bin

 

Remark Ⅱ

Minimizing will also work if you set a master password in Thunderbird — as you should unless you use an encrypted drive devil for your home partition. Why ? Because there is probably nobody willing to type in passwords every five minutes or so, hence sooner or later you’ll inevitably end up letting the mail program store them.

This would be fine, if only Thunderbird were using the Gnome keyring as instantiated by Menu› Preferences› Passwords and Keys (Seahorse) to store the passwords of your accounts. But it isn’t (there are add-ons to do just this, but I wouldn’t trust my passwords to any of them as none could keep up the pace with the frequent changes in Thunderbird’s security model), and if you don’t provide a master password to the mailer, it will store your keys with just an empty password. That is, they are recoverable by anybody in case your hard disk gets lost, because the encryption algorithm is known surprise

So, having to type in the password once at the beginning of a session is a bearable compromise in my opinion (and the same holds for Firefox as another Mozilla product too, by the way). In other programs that make use of the integrated keyring such as Chrome (Chromium) or Opera (newer than version 12.16, the one which is in the repositories of LM 17.x), this can happen only when you have auto login enabled, which is a really bad idea as your login password is the only key to anything on your hard disk, even if it’s encrypted (or when you have password-protected SSH access enabled) — that’s why you have to enter your password once at least

But many users are too lazy to type in their password even once, so they keep complaining, and finally undermine a proved security arrangement by disabling the login key in the keyring altogether. This is the worst advice no you can get (even if it’s given in a surprisingly frequent manner on forums) — never do it !


2. Send notifications on new mails

Until recently, Thunderbird didn’t play nice with Cinnamon’s panel: it didn’t show any icon there, not even when a new mail has arrived. This is supposed to be fixed in Cinnamon 2.8, but I still prefer to lay the mailer in a Mac-like fashion onto a dock, e.g. with Docky — and to get a normal notification, with a sound of course, each time a new mail is received.

As far as the sound is concerned, you could set up Thunderbird to ☰ Menu› Preferences› Thunderbird Preferences› (When new messages arrive:) Play a sound› Use the following sound file which you must choose (i.e. download from somewhere) yourself, since there is no “Default system sound for new mail” in Linux Mint. But you don’t have to, because the notification will fall short anyway, as the (Unity) messaging menu integration add-on, which comes with Thunderbird by default, doesn’t work in Cinnamon.

Hence, you should disable it with the (☰ Menu›) Add-ons Manager of Thunderbird, and install the Gnome Integration add-on instead by downloading it, and from within the Manager, by (Tools for all add-ons: the button in front of the search field›) Install(ing) add-on from file…

Finally, the Preferences› of the new add-on should look like in the picture below. That is to say that the only thing you need to change from the default configuration is the marked field for the sound (notify.wav is my beloved mail sound from those old Windows days gone by wink ):

Gnome Integration Options
 

3. Mail encryption

If your privacy is of concern to you, you should consider to encrypt your mail. Fortunately, this is pretty easy in Linux Mint as the pieces you need are already there. All you have to do in addition is to install the Enigmail extension for Thunderbird from the Software Manager.

Then, after the next start of the mailer, Enigmail’s Setup Wizard will get up automatically (if not, you can always call for it with ☰ Menu› Enigmail› Setup Wizard), and you can make or import your keys — they could also have been generated by Seahorse already, in case you had formerly done so. Be careful to choose a strong passphrase though, in order to protect your public key sufficiently — it’s a personal asset that will be used publicly by your pen pals indecision

I found that the Diceware method advocated by the Free Software Foundation’s Email Self-defense guide generates both good and easy to remember passphrases, which you can adjust in strength according to your needs (and your memory) — so don’t hesitate to employ it even for your login keys angle

Finally, you’ll still have to convince your friends to use PGP too — it’s much easier to set up than Mr. Greenwald from The Guardian had thought when a certain Mr. Snowden asked him to do so. But this is the fate of naive Windows users anyway crying

Remark Ⅲ

The OpenPGP Standard is embodied in Linux Mint by the GnuPG package. By default, GnuPG is installed in its version 1.4. However, the current stable branch is version 2.0. You can either install it directly, if you wish to, or by means of the Gnu Privacy Assistant which is another frontend to GnuPG like Enigmail, but in a stand-alone way, so that you could employ it with mailers other than Thunderbird to encrypt or sign your emails.

All in all, you can use Enigmail as well as Seahorse or the Gnu Privacy Assistant to manage your PGP — and other — keys, but the last one is limited to 3072 bit in the size of the keys it can generate (which is rather a question of encryption speed trade off than of real concern by today’s standards).

Comments
theblackhole 2 years ago

@MagicMint Thanks for this tutorial! It was useful for me because there's no minimize addon compatible with my Thunderbird version (58 beta) so this script is the only way to start Firefox minimized.

Unfortunatly, as @bren said 9 months ago, the script doesn't work. That's because the EOF token must be at the beginning of the line or indented by a tab character as described here : https://stackoverflow.com/questions/18660798/here-document-gives-unexpected-end-of-file-error

Here's a fixed version : https://gist.github.com/theblackhole/36de56b8cddf4e7ee33a501ba72759e1

Also the shortcut to minimize windows has been removed so I had to map [Ctrl+Alt+Super(aka Windows)+Down] to "(System) Settings› Keyboard› Keyboard shortcuts› Windows› Minimize Windows" and change it in the script since [Ctrl+Super+Down] is already used.


bren 3 years ago

The script in section 1 gives the following error:
/tmp/thunder.sh: line 37: warning: here-document at line 8 delimited by end-of-file (wanted `EOF')
/tmp/thunder.sh: line 38: syntax error: unexpected end of file


atsag 4 years ago

This is a great resource MagicMint! Do never give up writing such excellent advice. It has been a great help to me, and helped me to get notifications working after searching through obsolete and generic information on Thunderbird. Congratulations, keep it up!


MagicMint 4 years ago

@remoulder: Sorry to contradict you, but this problem does exist very well, at least when you’re referring to the Messaging Menu spice. It doesn’t start automatically Thunderbird, and when it does, it’s in the foreground as this is nothing else than an applet that just “lets you access your Messaging Icons” — these are nothing more than shortcuts to those icons in the menu.

I don’t think that the notification issue is resolved, either.


remoulder 4 years ago

This appears to be a tutorial providing a solution for a non existent problem. The messaging addon already integrates thunderbird.