The Problem With Linux (or)
Getting unread message count from Thunderbird via Terminal
Spent a while figuring this out, maybe it will help someone else.#!/bin/bash
INBOXFILE=/home/me/.thunderbird/dzrvkij6.default/Mail/pop.gmail.com/Inbox
THRESHOLD=200000
tail -$THRESHOLD $INBOXFILE | grep "X-Mozilla-Status:" | cut -d: -f2 | xargs -iZ bash -c 'echo $((10#Z & 1))' | grep -c 0
Searches through last $THRESHOLD lines of Inbox file for status lines. The least significant bit of the status indicates if the message is read, so we do a bitwise AND with 1, making sure to interpret the status as decimal and not octal (since by default bash interprets numbers starting with 0 as octals).
Thunderbird is a XUL application you fucking twat, there's way better ways to get mail over the terminal.
>>55469488
Well, I couldn't find anything. Anything more specific? Can I get Thunderbird's XUL from terminal?
>>55469508
Yes, it's called not using fucking Thunderbird.
>>55469515
All I wanted was an unread message count in my i3 statusbar :(
>>55469391
>Thunderbird, a GUI application, isn't "command line friendly"
>It's the kernel's fault
>>55469529
Fuck off dumb animeposter
>>55469528
use more simple tools for that
>>55469673
go on
>>55469755
There is a new service, they call it google
>>55469856
i spent a ton of time searching for a way to do this, i couldn't find anything (other than getting something like mutt or notmuch).
or do you mean simpler shell commands?
>>55470047
what's wrong with mutt?
Use the limits
http://www.mutt.org/doc/manual/#patterns
like ~O ~N ~U
>>55470224
because I want to use thunderbird to access my e-mail, and didn't want to set up mutt just for getting an unread count.
>>55470243
If you have a gmail account you can access it with curl at
https://mail.google.com/mail/feed/atom
, then filter it with awk, sed commands
>>55470333
For a statusline that updates every few seconds you want me to authorize via OAuth and make a http request? I could keep a local cache of the feed but Thunderbird already does that.
Also, I'm planning on hosting my own mail server at some point in the future.
>>55469755
https://wiki.archlinux.org/index.php/Conky#Display_number_of_new_emails
in general you could use python
>>55471052
It's the same, the OP want thunderbird so...
/thread
>>55469391 (OP)
>>55469529
Anime aside he is right. You are a fucking retard.
Also, what the fuck don't you get about pic related?!
>>>/wsr/
>>>/out/
>>>/reddit/
>>>/kys/