Changing the search bar text outside of Thunderbird

June 29, 2019

I run Thunderbird on a shared Samba drive. Because of that, it crashes. I know, it’s not supported. But I want to be able to load the profile from multiple clients – one at a time – and can live with it.

Frustratingly, sometimes it doesn’t crash. That means every time I start Thunderbird, the text in the search bar is the thing I searched for back in 2018. I finally got annoyed enough at that to figure out how to change it.

In the Thunderbird profile is a file called session.json which includes what the last session state was. Inside that is the “quickFilter”, which determines what the filter shows. Mine was:

{"quickFilter":{"filterValues" : {"text" : {"text" : "thing I didn't want to search for anymore", "states" : {"sender" : true, "recipients" : true, "subject" : true, "body" : false}}, "results" : 8}, "visible" : true}}

I replaced “thing I didn’t want to search for anymore” with “” and life was good. Incidentally, I usually want to quick filter by sender, recipients, subject but not body – you can set all those with the appropriate booleans.

If you never want to see the quick filter, “visible” : false is your friend.

Let me know (mail me) when there’s an error

September 5, 2018

I’ve got a shell script where I’d like to know when an error happens. Typically when that happens, something gets written to stdout or stderr – and I’d like to see that. But when things are just peachy, I don’t want to be bothered.

Here’s an easy way to achieve that. At the beginning of my script, I have:


(Did I mention this is a script for a weather station? Yep.)

Then in the body of the script, I have:

/usr/local/bin/do-the-thing > ${WEATHEROUT} 2> ${WEATHERERR}
/usr/local/bin/do-the-other-thing >> ${WEATHEROUT} 2>> ${WEATHERERR}

Finally, at the end of the script, there’s:

if [ -s ${WEATHERERR} -o -s ${WEATHEROUT} ]; then
   cat ${WEATHEROUT} ${WEATHERERR} | /usr/bin/mail -s "Weather command error" me@myaddr

That’s all!

Migrating from Pegasus to Thunderbird

December 20, 2012

I’ve been on Pegasus Mail for ages. It’s OK, but not open source, and I’ve always had the vague fear that some day my email will be locked away due to a format change. In addition, its HTML handling is not the best, and the way it does multiple accounts is a little weird. Finally, it was getting slow on my Windows XP PC due to the file system – and migrating it from one PC to another is a pain, especially if you’re changing the drive the data lives on.

So I resolved to move to Thunderbird. I started from here:

and here:

and when I did the MBox method, it seemed to work fine. Until I looked at the folder on Thunderbird and saw more messages than I’d counted on.

It appears that Thunderbird uses “\n\nFrom .*\n” to filter its messages. Ok, but Pegaus doesn’t quote the From in “From the editor:” which appears at the start of the line in some of my messages. Argh! This left me with lots of messages split in half, with weird dates and strange subjects / from / to lines.

I hacked up the following awk script, which I put in a file called peg2tbird:

/^From / && ! /\?\?\?\@\?\?\?/ { printf ">%s\n", $0 }
!(/^From / && ! /\?\?\?\@\?\?\?/ ) { printf "%s\n", $0 }

This takes any line that matches “From ” but doesn’t match “From ???@???” and puts a > in front of the From. All other lines it leaves as-is.

Then I ran:
\cygwin\bin\gawk -f peg2tbird < unx01234.mbx > tbird-mbox-file

Then I copied tbird-mbox-file to my Thunderbird Profile directory (in Mail\Local Folders).

This makes the messages look a little strange in Thunderbird – they look like “>From the editor:”. Also, some messages ended up showing with today’s date – inserted by Pegasus. (I think it was just those generated by a virus checker, so they were probably less well-formed than real messages.) Sigh. Oh well, that’s good enough for me to get my old messages migrated.