There is actually a question that covers this same topic, but none of the answers worked for me, at least not completely.
The accepted answer is just a link to this forum thread, and based on one of its suggestions (that didn't work for me initially), I managed to put together this:
#!/bin/bash
thunderbird &
while [[ $(wmctrl -l | grep "Mozilla Thunderbird") == "" ]]; do sleep 0.1; done
xdotool windowactivate --sync `xdotool search --name "Mozilla Thunderbird"`
sleep 0.1 # prevents flakiness
xdotool key alt+F4
exit 0
Which, together with the addon MinimizeToTray revived
to cause it to minimize to tray instead of closing, works. I have it set to run automatically, and it closes the window, but the mail notification applet in the system tray still turns blue when I have an email.
The only problem is that, when logging in, you will still see the window "flash" as it opens and closes, and I find this annoying (though I'm willing to put up with it if I have to).
There is another, similar add-on called FireTray
which has the advantage that you can set Thunderbird to open automatically minimized to the system tray (and this works), negating the need for a script (all you would need to do is set up the extension, then add thunderbird
to the startup programs).
However, for reasons I don't really understand, enabling FireTray
messes up the icons for Firefox and Thunderbird. They become really blurry, and I can't figure out how to fix it. I googled to see if anyone had this problem, but I couldn't find anything.
Basically, my question is just if anyone has any ideas on either how to fix either of these problems. Either prevent FireTray
from messing up the icons, or close Thunderbird with MinimizeToTray revived
without the window flashing.
Edit: After experimenting with FireTray more, I realized that it does the same window flashing thing, which makes me think it's unlikely to prevent or hide it.
MinimizeToTray revived
addon causes it work even after you close it (because you're really just hiding it), and I got that to work (with window flashing) using a script to open it and then close it at startup. I just find the window flashing irritating and would prefer it to be completely invisible until I choose to open Thunderbird myself.