On Mon 11 Dec 2023 at 10:07:28 (+1100), Zenaan Harkness wrote:
> > Second, how do I fix this so that mutt uses feh to display images?
> 
> Here is my mailcap entry, which works for me - had to deal with
> annoying filename munging by mutt, and getting the "close the viewer"
> bit working - this is quite a few years ago and now I can't even
> remember why the ; test=test -n "$DISPLAY" or the sleep are needed,
> but they were - heuristics annoy, but sometimes they are necessary:

I'm not familiar with the mutt filename munging problem etc. As for
test=test -n "$DISPLAY", I presume it's there to prevent trying to
run graphical commands on a text terminal, where DISPLAY is unset.

> image/*; (mv %s %s-\; feh -Z %s-\; rm -f %s-)& sleep 0.2s; test=test
> -n "$DISPLAY"

I've never trusted feh since the time when its default slideshow mode
had the astonishing behaviour of modifying the source file if you,
say, rotated the display of the image. They may have fixed it, but
I've stuck with alternatives.

I use:

  image/jpeg; /usr/bin/xli -quiet stdin; test=test -n "$DISPLAY"; 
description=JPEG Image
  image/png; /usr/bin/xli -quiet stdin; test=test -n "$DISPLAY"; 
description=PNG Image
  image/gif; /usr/bin/xli -quiet stdin; test=test -n "$DISPLAY"; 
description=GIF Image
  image/webp; convert webp:- jpeg:- | /usr/bin/xli -quiet stdin; test=test -n 
"$DISPLAY"; description=WEBP Image
  image/tiff; convert tiff:- jpeg:- | /usr/bin/xli -quiet stdin; test=test -n 
"$DISPLAY"; description=TIFF Image

> Similarly my mailcap entry for pdf files:
> 
> application/pdf; (mv %s %s-.pdf\; evince %s-.pdf 2\>\&1 \; rm -f
> %s-.pdf)& sleep 0.2s; test=test -n "$DISPLAY"
> image/pdf; /usr/bin/display-im6 %s; test=test -n "$DISPLAY"

Does evince need a mouse click to exit, and is that what you're
referring to with ‘getting the "close the viewer" bit working’?
That would rule it out for me.

I use:

  application/pdf; /usr/bin/xpdf -fullscreen %s; test=test -n "$DISPLAY"; 
description=Portable Document Format; nametemplate=%s.pdf

> Finally, occasionally I need to cleanly dump html, this one seems a bit 
> simpler:
> 
> text/html; lynx -stdin -dump -width=$COLS; copiousoutput; compose=vim %s

I prefer to navigate any structure, with:

  text/html; /usr/bin/lynx -force-html -localhost -stdin

and I find this useful very occasionally:

  text/markdown; /usr/bin/pandoc %s | /usr/bin/lynx -localhost -stdin

Adding -localhost prevents any external links from working.

Cheers,
David.

Reply via email to