Using "viu" to display attached images

Kevin J. McCarthy kevin at 8t8.us
Mon Jul 4 17:29:30 UTC 2022


On Tue, Jun 28, 2022 at 12:01:34PM +0200, Andy Spiegl wrote:
>I think the problem why it doesn't work here is that "reply" is interactive.
>Whatever follows <reply> in the macro is appended to the "To: " prompt.
>
>Is there a way to "wait" until the <reply> operation is done?

There isn't a clean built-in way to do what you want, so you'll have to 
get creative.

One possibility is using the 'test=' mailcap flag and suppressing the 
chafa/viu invocation for replies.

Here's *one* way to go about that, but you'll have to decide what works 
for you.  This creates a file under ~/.mutt/isreply when replying:

.mailcap:
=========
image/*; chafa -c 240 -w 9 -s ${COLUMNS-80} -- %s ; copiousoutput ; test=~/.mutt/bin/isnotreply.pl


.muttrc:
========
reply-hook ~A 'echo `touch ~/.mutt/isreply`'


~/.mutt/bin/isnotreply.pl:
==========================
#!/usr/bin/perl

chdir();
$REPLYFILE = "./.mutt/isreply";

if (-e $REPLYFILE) {
   $mod_time = (stat($REPLYFILE))[9];
   if (time() - $mod_time < 5) {
     exit 1;
   }
   else {
     unlink($REPLYFILE);
     exit 0;
   }
}
else {
   exit 0;
}

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20220704/c4170506/attachment.asc>


More information about the Mutt-users mailing list