On 13Feb2021 19:29, Bhaskar Chowdhury <unixbhas...@gmail.com> wrote:
>On 07:40 Sat 13 Feb 2021, Cameron Simpson wrote:
>>On 12Feb2021 09:36, Kevin J. McCarthy <ke...@8t8.us> wrote:
>>>On Fri, Feb 12, 2021 at 09:59:38AM +0530, Bhaskar Chowdhury wrote:
>>>>The problem it pops up for every new mail arrive. [...]
>>>For more sophisticated notification, you'll need to use another tool.
>>
>>For xample, my own new mail desktop notifications happen from my mail
>>filer, not from mutt. This has the advantage that they still happen when
>>mutt is closed (if you can call that an advantage).
>>
>How?? Show us...share with the people ..

Ok....

I collect my email with getmail, deliver to my local "+spool" mail 
folder, a Maildir (~/mail/spool).

I filter my messages using mailfer:

    https://pypi.org/project/cs.app.mailfiler/

which monitors multiple Maildirs for new messages, and files them 
according to per-folder rules.

So it watches spool, spool-in, spool-out, spool-to-phone etc. "spool" 
winnows some spam and lets the rest through to spool-in. spool-in files 
to my inbox, various mailing list folders etc. Anything not matched 
lands in +UNKNOWN. It is mostly spam.  spool-out is what mutt's $record 
is set to - mutt saves sent mail there and mailfiler refiles it.  
spool-to-phone just has a rule to forward to my phone's email account.

So, alerts.

Mailfiler rules are usually quite simple, like this:

    !me      Work          from:(ALERT)

which says to match messages from addresses in the group "alert" and do 
2 things:

- "me" save a copy in my +me folder, my "priority inbox"
- "!" run the $ALERT command with the message and save a copy to the 
  targets named in $ALERT_TARGETS

They're set like this:

    ALERT=alert
    ALERT_TARGETS="F,spool-to-phone"

So $ALERT runs my "alert" command, a script. Details below.
$ALERT_TARGETS says:

- "F" (F)lag the message (same as mutt's (F)lag command) so that it is 
  highlighted in mutt's index
- "spool-to-phone" save a copy in my +spool-to-phone folder, which 
  mailfiler also monitors (its rules say forward a copy to my phone's 
  email account)

The desktop popup comes from my "alert"r script:

    https://hg.sr.ht/~cameron-simpson/css/browse/bin/alert?rev=tip

That will issue alerts to a variety of places depending on envvars and 
options particularly my dlog (a timestamped text log I use for reviewing 
things, since my invoicing system is a ghastly hack held together with 
string) and to the desktop.

The "desktop alert" part of that script is in the $to_desktop 
if-statement at the bottom. Presently I'm on a Mac and use the 
"terminal-notifier" command to issue a normal Mac Notification popup.  
I'd be using whatever Linux desktop notification command line were 
suitable were I on Linux.

I presume there _is_ a standard way to issue a popup alert on Linux 
systems these days? I used to just always run a permanent very short 
full-width terminal across the top of the screen tailing a log file 
myself, crude but effective. The same terminal also accepted commands if 
you typed them.

Anyway, that is how this is hooked into my email.

Suggestions for current Linux or other UNIX desktop popup command line 
tools welcomed.

Cheers,
Cameron Simpson <c...@cskk.id.au>

Reply via email to