Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wanted Thunderbird to stay in the Background to notify me of incoming mails.

After a bit of searching, I found this post.
How to keep Thunderbird and Pidgin running on background?

The solution is to install an addon so that when we close Thunderbird it just stays in the background.

Now, to have thunderbird running at Start up we can just add it to Startup Applications.

But, when I open my system, Thunderbird also gets opened and I have to manually press the close button everytime to make Thunderbird go into the background.

The solution given in the above post for this problem is to select Minimize on start. But doing so affects the way in which Thunderbird works when invoked from the Messaging menu. So I deselected this option.

But, if there is a way to emulate pressing the Close button from a script, I can just add that script to Startup Applications

So is there a way to achieve this?

Note : If there is a simpler way to solve my original problem of keeping Thunderbird in background please post that also.

Many thanks.

share|improve this question
    
According to the link you gave, the extension "Minimize On Start and Close" provides the option to minimise on open. Have you tried that? Regarding a simpler way, I just put Thunderbird on a different workspace! –  Paddy Landau Dec 12 '12 at 16:28
    
Forgot to add this. If we select Minimize on start then while pressing the mail entry in the Messaging menu, Thunderbird does not open up properly. I need to once again go and press the Thunderbird icon. So, I removed Minimize on start option. –  Karthik Dec 12 '12 at 16:33
    
Edited the question,the explain the change. –  Karthik Dec 12 '12 at 16:38
add comment

1 Answer

up vote 2 down vote accepted

In the probable absence of a Thunderbird command-line option that you could use to start it minimized or in the background, your best option is probably to use something like xdotool, which is in the repositories. (See my later note on the minimize to tray addon).

This is the command you need to minimise the instance of Thunderbird; xdotool searches for the Thunderbird window on the window stack and then minimizes it

xdotool search --class thunderbird windowminimize %@

Maximise Thunderbird and then try it in the terminal; it seems to be the command you are looking for. Often when used in scripts the --sync argument is added, as noted in the man page:

After requesting the window minimize, wait until the window is actually minimized. This is useful for scripts that depend on actions being completed before moving on.

You may also have to delay the command a bit until Thunderbird has actually started up, and there is a sleep command built into xdotool, so you could use

xdotool sleep 6 search --class thunderbird windowminimize %@

and set the sleep interval at whatever value you needed.

This minimises Thunderbird, but not to the background like when you use the minimize to tray addon, as you set up that addon so that pressing exit sends Thunderbird to the tray. Assuming that addon is installed, it may be possible to use xdotool to emulate the mouse-click of the x in Thunderbird's window and so background it. However, using windowkill instead of windowminimize with Thunderbird (when the tray addon is installed) closes the entire application.


After discussion it was said that the windowunmap option was the one necessary to actually hide the window; this is much easier than trying to emulate a click on the thunderbird window.

xdotool sleep 6 search --class thunderbird windowunmap %@
share|improve this answer
    
+1, This is such an awesome tool. Hopefully I should be able to find a way to use this tool to emulate a close click. Will try it out and get back –  Karthik Dec 12 '12 at 16:58
    
@Karthik Yes, it is a great tool- I'll see if I can do it for you as well- it should be possible. –  user76204 Dec 12 '12 at 17:01
    
The windowunmap option did the trick. The command will be like xdotool sleep 6 search --class thunderbird windowunmap %@ –  Karthik Dec 12 '12 at 17:09
    
Can you please update your answer with the info in my previous comment. –  Karthik Dec 12 '12 at 17:18
    
@Karthik Yes, I have done the edit, and I'll also see if it's possible to do it it by simulating a mouse-click. Thanks. –  user76204 Dec 12 '12 at 17:43
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.