[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
how to background mutt external viewer applications
- Subject: how to background mutt external viewer applications
- From: zen at freedbms.net (Zenaan Harkness)
- Date: Sat, 18 May 2019 14:28:14 +1000
A hint is here:
http://www.guckes.net/Mutt/setup.html
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...