5

When I open the "customize" menu in Thunderbird, I can add or remove the items from the toolbar. This way, I can reorder the buttons "write", "reply", "reply all", or remove them altogether.

The Quick Filter Toolbar cannot be moved like this.

There used to be an addon called quickfiltertoolbar, which made it possible to move the Quick Filter Toolbar around, same as other items.

I have made a screenshot to illustrate what I mean:

enter image description here

By default, the Quick Filter Toolbar occupies its own panel, under the main panel. What the addon allowed, was to move the items up to the main panel (purple on my screenshot) and move the various associated buttons as well (attachements, ...)

This way I could save space, and I did not need a separate panel for Quick Filter Toolbar.

Unfortunately, this great addon no longer works with current Thunderbird 68.8.

I am looking for a way to achive the same, by perhaps using userChrome.css, or if not possible by editing the files omni.ja.

I have shown on my screenshot what I am trying to achieve.

First, remove the stupid useless buttons from the Quick Filter Toolbar: "Unread", "Starred", "Contact", "Tags".

And then, move the rest up (the pin icon, attachements, and the search field.

Lastly, get rid of the now-empty panel

Can this be achieved ?

Martin Vegter
  • 358
  • 75
  • 236
  • 411

1 Answers1

2

Edited: adding patch script

The solution is based on the Thunderbird source code. I have applied these changes for Thunderbird 68.8.0 (package at Opensuse 68.8.0-1.1 | x86_64) .

You need to unpack the omni.ja edit/replace the files the way I have indicated and pack omni.ja back again (the same way the path script does).

First what you need to patch is messenger.xul file:

diff -r chrome\messenger\content\messenger\messenger.xul chrome\messenger\content\messenger\messenger.xul
4798,4824d4797
<     <toolbarbutton id="qfb-sticky" type="checkbox"
<                    class="toolbarbutton-1" orient="horizontal"
<                    crop="none" minwidth="16"
<                    tooltiptext="&quickFilterBar.sticky.tooltip;"/>
<     <label id="qfb-results-label"
<            minwidth="&quickFilterBar.resultsLabel.minWidth;"
<            value=""
<            somefmtstring="&quickFilterBar.resultsLabel.some.formatString;"
<            noresultsstring="&quickFilterBar.resultsLabel.none;"/>
<     <textbox is="search-textbox" id="qfb-qs-textbox"
<              align="center"
<              flex="3"
<              class="searchBox"
<              placeholder=""
<              emptytextbase="&quickFilterBar.textbox.emptyText.base1;"
<              keyLabelNonMac="&quickFilterBar.textbox.emptyText.keyLabel2.nonmac;"
<              keyLabelMac="&quickFilterBar.textbox.emptyText.keyLabel2.mac;"
<              timeout="500"
<              maxlength="100"
<              width="170"
<              minwidth="160">
<     </textbox>
<     <toolbarbutton id="qfb-attachment" type="checkbox"
<                    class="toolbarbutton-1" orient="horizontal"
<                    crop="none" minwidth="16"
<                    label="&quickFilterBar.attachment.label;"
<                    tooltiptext="&quickFilterBar.attachment.tooltip;"/>
4967a4941
> 
4975c4949
<            defaultset="button-getmsg,button-newmsg,button-chat,button-address,separator,button-tag,separator,qfb-sticky,qfb-results-label,qfb-qs-textbox,qfb-attachment,qfb-show-filter-bar,spring,gloda-search,button-appmenu">
---
>            defaultset="button-getmsg,button-newmsg,button-chat,button-address,separator,button-tag,qfb-show-filter-bar,spring,gloda-search,button-appmenu">
5067c5041,5042
<     <vbox id="quick-filter-bar" hidden="true">
---
> 
>     <vbox id="quick-filter-bar">
5076d5050
<                        hidden="true"
5082c5056
<           <toolbarseparator/>
---
>           <toolbarseparator id="qfb-separator"/>
5085,5086c5059
<                          hidden="true"
<                          align="center"
---
>                          crop="none" minwidth="16"
5090c5063
<            <toolbarbutton id="qfb-starred" type="checkbox"
---
>           <toolbarbutton id="qfb-starred" type="checkbox"
5092d5064
<                          hidden="true"
5099d5070
<                          hidden="true"
5106d5076
<                          hidden="true"
5113d5082
<                          hidden="true"
5122d5090
<                hidden="true"
5129d5096
<                  hidden="true"

Notice here the move of the whole section to the mail toolbar section. Also I have adjusted the values so the search bar is smaller. Notice that you can simply hide the quickFilterBar item by adding hidden="true" to the section. I have added the the hidden tak also to the whole quickFilterBar vbox as you wished.

Next you need to patch messageWindow.xul:

diff -r chrome\messenger\content\messenger\messageWindow.xul chrome\messenger\content\messenger\messageWindow.xul
4531c4531
<            defaultset="button-getmsg,button-newmsg,button-chat,button-address,separator,button-tag,separator,qfb-sticky,qfb-results-label,qfb-qs-textbox,qfb-attachment,qfb-show-filter-bar,spring,gloda-search,button-appmenu">
---
>            defaultset="button-getmsg,button-newmsg,button-chat,button-address,separator,button-tag,qfb-show-filter-bar,spring,gloda-search,button-appmenu">

Here you want to remain consisten on the messageWindow too.

Next you need to patch primaryToolbar.css:

diff -r chrome\classic\skin\classic\messenger\primaryToolbar.css chrome\classic\skin\classic\messenger\primaryToolbar.css
479,504d478
< #qfb-sticky {
<   list-style-image: url("chrome://messenger/skin/icons/sticky.svg");
< }
< 
< /*
<  * The coloring based on the matches of the filter is defined at quickFilterBar.js.
<  * It would have to be ported to work within the mail toolbar.
<  *
<  * #qfb-results-label {
<  * color: #4e9a06; // was GrayText
<  * text-align: end;
<  * visibility: hidden;
<  * }
<  * 
<  * #quick-filter-bar[filterActive="matches"] #qfb-results-label {
<  * color: #4e9a06;
<  * }
<  *
<  * #quick-filter-bar[filterActive="nomatches"] #qfb-results-label {
<  * color: #f66;
<  * }
< */
< #qfb-attachment {
<   list-style-image: url("chrome://messenger/skin/icons/attach.svg");
< }
< 

Adding the the images to primaryToolbar.css and also the reference what to do if you want to have different coloring when using the filters.

Last but not the least quickFilterBar.css:

diff -r chrome\messenger\content\messenger\quickFilterBar.css chrome\messenger\content\messenger\quickFilterBar.css
42c42
<   color: #fff200;  /* was GrayText */
---
>   color: GrayText;

The last patching is needed in order for the results to get one nice (yellow) color. The toolbar was able to differentiate if result was found - green color and not found red. This solution show only one color yellow for both branches. You would need to migrate the code from the quickFilterBar.js which could prove to be tricky.

Note: Please don't forget to delete your profile(s) when applying the changes.

After the changes it looks like this

Quick Filter Toolbar moved to the main panel

A patch for linux

As promised I'm now adding a direct patch file for the changes (Using sed (GNU sed) 4.8): Thunderbird quick filter widgets move to main toolbar - patch. This patch patches the move only (not including the previous patches).

Edit2:

If you need for the quick filter search buttons (Sender, Recipients, Subject, Body) to appear you need to comment out this sed:

# hiding the whole box
sed -E -i -e 's:(\s*<\w+\s\w+="quick-filter-bar")(>):\1 hidden="true"\2:' chrome/messenger/content/messenger/messenger.xul

After commenting out, you need to active quick search toolbar again. This will show a black line, the quick search toolbar itself without buttons. The filter buttons (Sender, Recipients, Subject, Body) will then appear when a filter string is entered.

tukan
  • 4,931
  • thank you. But I am having difficulties patching the 4 files. Looks like you are using windows, and the files here have slight differences. Also, I have custom modifications in messenger.xul and messageWindow.xul from my previous bounty. So I cannot simply copy your files. I have uploaded my files here: https://www37.zippyshare.com/v/fHVREc2N/file.html – Martin Vegter May 27 '20 at 05:00
  • @400theCat I have now added a direct patch file with which you can patch your omni.ja file directly. Some of the sed (check the version) were tricky, but I have now tested it and it works as it should. Yes, the original files posted were for windows. I want to have patched both versions. – tukan May 27 '20 at 14:21
  • your script seems to work nicely, it patches the files successfully. But when I then start Thunderbird with the new omni.ja, the changes don't look as expected. The Quick Filter Toolbar disappeared completely, but neither quick filter , nor the pin and attachment appear on the main panel. So basically same as if I simply removed Quick Filter Toolbar altogether. You can try running the sed command on the files I have uploaded above (pre-script). Or I can upload the files after I ran your script. Sorry for the trouble. I see you have put a lot of work into this. – Martin Vegter May 28 '20 at 04:25
  • oh, and I assume by Please don't forget to delete your profile(s) when applying the changes, you meant delete my ~/.cache/thunderbird/<profile>/, not the actual profile in ~/.thunderbird/<profile>/. – Martin Vegter May 28 '20 at 04:28
  • wait. I think it works. I just had to add the items using the "customize" menu. I am testing now if everything works as expected. – Martin Vegter May 28 '20 at 04:59
  • @400theCat It certainly was lot of work :). When I was developing it I was deleting both profiles to make sure everything was vanilla. After applying the patch everything should be visible rightaway. – tukan May 28 '20 at 06:20
  • I did not delete my profile, so I had to add those items from the "customize" menu manually. Another thing, I don't understand what you are trying to do with changing the text color. Now after the changes, the text is on the right from the quick filter textfield, instead on the left. Is this intentional? Is it possible to move it back left, so that the text f=iled is next to the "Attachment" icon? Also, I have now realized I don't want the pin icon at all. Which sed command can I ignore if I don't want it? I made a screenshot: https://paste.pics/b6df6009e0eec470061dd75072cb155e – Martin Vegter May 28 '20 at 06:51
  • @400theCat Changing the text color after the search I'm trying to tell the user (you) that the functionality has changed (there is no more green(found)/red(not found)) differentiation as it was before. Otherwise, it could be rather confusing, why it is green when it did not find anything. You can change it to whatever color suits you. After the patching the text position should appear on the left side of the search field (as you can see on my screenshot). It probably has to do something with you using the customize option. – tukan May 28 '20 at 07:03
  • @400theCat if you do not want the pin button you can ignore this part of the sed command (just remove it): <toolbarbutton id="qfb-sticky" type="checkbox" class="toolbarbutton-1" orient="horizontal" crop="none" minwidth="16" tooltiptext="&quickFilterBar.sticky.tooltip;"/> and you have to remove the qfb-sticky from the first sed command. – tukan May 28 '20 at 07:10
  • thank you. Everything works now. You are a genius. – Martin Vegter May 28 '20 at 08:08
  • actually, one more thing: before, when I used the quick filter, when I started typing, the panel expanded by a second line, which contained: Filter messages by: Sender Recipient Subject Body. This now no longer works. I guess because we removed the original panel. Is there any chance to get this functionality back? The quick filter is pretty much useless, if you cannot choose to search sender, recipient, Subject. I would be happy to open new bounty, if you know how to fix this. I can also provide screenshot, it it is not clear what I mean. – Martin Vegter May 28 '20 at 08:25
  • @400theCat You are welcome. I'm glad it worked out for you. While I would love to be a genius, I only put the required work for code searching and made the changes. It got me interested and as I plan to use Thunderbird, I'll use the patches myself too (little bit modified). It is fascinating how the old addons will disappear but there are no new ones to replace them (for this modification it will be tricky to make an addon). – tukan May 28 '20 at 08:27
  • @400theCat I think I know what you mean, but screenshot will be the best. I'll have to check the source code to see how it behaves and if it can be brought back. – tukan May 28 '20 at 08:29
  • Again, why down-voting without any comment? This solution was tested and is working! – tukan Jul 06 '20 at 08:42
  • 1
    Who is downvoting? I can vouch for the solution. I spent 1000 bounty, accepted the answer, and I am happy with the result. – Martin Vegter Jul 07 '20 at 04:57