Skip to content

Thunderbird Quick Filter Bar extensions, they’re a thing!

The previously discussed Quick Filter Bar interface landed in time for Thunderbird (Lanikai) 3.1 beta 2 (whose release is real-soon-now).  Although the Quick Filter Bar already contains dangerously high levels of awesome, we made sure to make it extensible so you can cram even more awesome in.

As an example, I have created an extension that enables you to ‘pivot’ based on the currently selected message(s).

In its most straightforward manner of operation, you can click on an e-mail address in the message reader header and pivot by that e-mail address.  Out of the box, this will show you all the messages in the current folder sent by that user.  You can also (or only) show messages where that user is on the to/cc lines by toggling the buttons on the expando bar appropriately.

You can also constrain the display to only show messages within some time interval of the message(s) in question.

The more confusing way to access the pivot functionality is to simply toggle the facet on the quick filter bar.  When you toggle the filter on, we walk all of the selected messages and build up a list of the observed e-mail addresses for all of the senders and all of the recipients.  One trick is that we filter out any e-mail addresses associated with your own account in order to avoid the filter becoming too inclusive.  We save those e-mail addresses into our state.  We also walk all the messages and find the time range that the messages cover and save that.  These are used as the basis for the specific constraints you can enable from the expando bar.  Because the values are saved, the filter does not change when you change your selected messages.  You need to toggle the pivot filter off and on again (or use the ‘pivot’ option on the email address popup) to change the data we are pivoting on.

The extension can be found on AMO and in source form.  In a forward-looking move that is probably complicating things for now, I used the Jetpack SDK and its XUL extension support to implement the extension.  In practice, all the example uses Jetpack for is its CommonJS module system and the standard mozilla-style JS modules would have been sufficient.  All the UI stuff is done purely in XUL overlays bound to the backing code using addEventListener.

The broad strokes for implementing a Quick Filter Bar extension are:

  1. Overlay your toolbarbutton into the quick filter bar, preferably the #quick-filter-bar-collapsible-buttons box.  If you have an expando bar you want to contribute, you probably want to put that into the #quick-filter-bar-expando.  As things currently stand, multiple expando bars being uncollapsed at the same time will probably turn out poorly, so you may need to be pragmatic and put your bar outside that box or do something clever.
  2. Import resource:///modules/quickFilterManager.js, implement your filter, and register it with QuickFilterManager.defineFilter() (whose documentation explains the interface you need to conform to).

We will likely not be doing up full documentation for this extension point beyond the in-code documentation and in-tree/extension examples.  This is an advanced extension point by virtue of it touching nsIMsgDBHdrs, nsIMsgDBViews, nsIMsgSearchSessions, and friends, all of which have sharp edges.  The way forward with soft, human-friendly documented abstractions is gloda and that’s where (my) effort will be concentrated.  The awesome in this extension point is making it practical for people who already have the scars to utilize the full power of the message view/traditional search subsystem without losing a limb and do so in a previously impossibly short period of time.

PS: I made the icon!

{ 11 } Comments

  1. K | May 2, 2010 at 11:14 am | Permalink

    Excellent, thanks!

    Say, is there a way to search this way across multiple folders? or for instances on all folders indexed by Gloda?
    Instead of just the local folder…

  2. Frank J. | May 2, 2010 at 12:39 pm | Permalink

    Really lovely!
    please add +1 for sub-folder search 😉

  3. Richard Jenkins | May 2, 2010 at 2:52 pm | Permalink

    K, you can use the Quick Filter on a Saved Search folder.

  4. Andrew Sutherland | May 2, 2010 at 3:08 pm | Permalink


    K and Frank, as Richard says, you can use the quick filter on saved searches / virtual folders, but that’s the extent of it.

    In terms of global / gloda searches, we’ll be doing a lot more with that after Thunderbird 3.1 ships.

  5. David R | May 2, 2010 at 7:17 pm | Permalink

    This is great! I love how it’s starting to be useful for specific (common) use cases — “show me the last few emails from Joe” is a huge chunk of my searching.

    For years I’ve been pining after a feature Eudora had 10 years ago: you could control-click on the email address cell of a message row, and it would do a sort of auto-filter/sort on messages from that email address. It was terrific for finding previous messages This is not exactly that, but it’s partway there.

    RE: searching multiple folders — the pivot won’t be terribly useful for those of us who keep up with inbox zero, since theoretically we’ve already archived any messages we would want to find in a pivot. Maybe eventually it can be smart about the official Archive folder and include that in the search, when your starting message is in the Inbox?

  6. Andrew Sutherland | May 2, 2010 at 7:48 pm | Permalink

    David R,

    The global database search allows you to search based on e-mail address using autocomplete. Hit control-k/weird-apple-button-k to get into the box, and then start typing the name or e-mail address of the person you want to see all your communications with. When they pop up, select them and hit enter. Then you get the pretty global search faceted view and can hit “view as list” button once you’ve filtered down the results to something manageable and want to see them in the standard thread pane view. (And then you can use the quick filter bar on that too!)

    We will be doing more with this in the future, including likely exposing a ‘pivot’ type functionality using gloda… it actually is pretty ridiculously easy to do…

  7. Frank J. | May 3, 2010 at 12:20 am | Permalink

    Hmm. This virtualfolder thing is kind of slow for me (24000 messages).
    Btw. I started labeling my mails with tag with the names of my most common contact searches…
    But what be really useful would be a name-cloud or a tag cloud of my most common contacts including subfolders 😉

  8. Charles | June 18, 2010 at 10:21 am | Permalink

    Hi Andrew,

    I’m a little dismayed at the conversion of a small searchbox (the old quickfilter search box) that could be placed on any toolbar desired, into a huge new toolbar that cannot be modified in any way.

    I do see the argument, and like some of the new features (the ability to create your own combinations of criteria), but I have a question…

    Is this coded in such a way that the old quickfilter searchbox could be brought back but with some of the new features?

    What I’d like is the old searchbox (I place everything on my menu bar, then use the Autohide extension to auto-hide/show it on mouse-over, just like the Windows Taskbar), but with the nice little Sticky pin added immediately to the left, and a new ‘select/drop-down’ menu for selecting the individual criteria – ie, you click in the drop-down, start clicking on the criteria until you get the ones you want enabled/disabled, then click off the menu and it applies your changes.

  9. Andrew Sutherland | June 18, 2010 at 11:14 am | Permalink

    Yes, someone could write an extension that does that and be able to reuse most of the work that went into the quick filter bar.

  10. Christian | July 26, 2010 at 11:23 pm | Permalink


    would it be possible to filter by same subject ? I tried to look at the code, but I’m a little bit confused.

  11. Andrew Sutherland | August 8, 2010 at 10:06 pm | Permalink

    It wouldn’t be hard to do, but you might be better served by “show in conversation” in the “other actions” drop-down menu accessible from the message reader.