how to background mutt external viewer applications

Zenaan Harkness zen at
Fri May 17 21:28:14 PDT 2019

A hint is here:

To make it work, do e.g. the following in $HOME/.mailcap as follows
(the following is to be on one line):

application/pdf; (mv %s %s-\; evince %s-\; rm -f %s-)& sleep 0.2s; test=test -n "$DISPLAY"

Couple keys:

 - mv mutt's temp file to a new name, so mutt cannot delete the file
   from under the viewer's feet

 - do the mv, view and rm in a subshell, so that this mini process
   can be backgrounded

 - escape the semi colons in that are part of the viewer mailcap
   entry (ampersand does not need escaping)

 - rm the temp file (using its new name) after viewing is finished

 - sleep for a short bit after backgrounding the viewer, in the hope
   that your kernel will schedule the viewer to do its thing within
   that time - this time is a racy heuristic, so can fail of course

The ideal solution would be another mailcap part of the line, or
option, which specifies that the viewer should be backgrounded, so
that this little dance does not have to be copied for every entry of
interest - although a handful of such entries will likely capture the
bulk of daily requirements...

More information about the cypherpunks mailing list