Is there are way to trigger certain Thunderbird operations through the command line? I am in particular looking for a way to:

  • Receive mail (Shift+F5)
  • Filter on a particular tag

Can this be done by a command in the command line?

Running Thunderbird 52.2.1 on Archlinux

  • pacman -S mutt... Seriously, if you want a command line mail client. thunderbird --help will tell you how it is only built for a GUI.
    – jasonwryan
    Jul 23, 2017 at 4:57
  • 2
    Thanks but I am not looking for a command line mail client. I am looking for a way to trigger two specific commands in Thunderbird through the command line.
    – user32421
    Jul 23, 2017 at 5:03
  • 1
    have you tried xdotool? e.g. something like xdotool search --name thunderbird key shift+F5. see man xdotool for more info, and note that some programs ignore events sent by xdotool, and/or ignore such events when not in focus.
    – cas
    Jul 23, 2017 at 5:16
  • Thanks @cas! I've been trying to use xdotool but so far no luck. I can't get Thunderbird to accept any input. Using i3 as window manager which may complicate things, although there seem to be other reports of Thunderbird not taking any 'synthetic' inputs.
    – user32421
    Jul 23, 2017 at 5:51

1 Answer 1


@cas' suggestion to use xdotool works. Not sure why previous attempts by OP weren't successful, perhaps a combination of Thunderbird updates and use of correct syntax.

The following command finds windows with Thunderbird in their name and sends the Get All New Messages key sequence to the first of the found windows:

xdotool search --name "Mozilla Thunderbird" key --window %1 shift+F5

Thanks to this thread I was able to set up KDE Connect to use my mobile to tell my laptop to download emails.

The way xdotool's window search works is best explained in its manpages, but in short: it builds a memory structure containing all windows that matched your criteria. How these results are sorted in memory is not in user's control, so when referring to the first window in the results (%1), you don't know which one it is. This could be the most common reason for xdotool invocations to have no effect: keys could be sent to the wrong window. To prevent it, try to set window search parameters to return just one window. It is tempting to replace %1 with %@ (all matched windows), but this may include applications where the keys activate an action you don't want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .