On Wed, Dec 13, 2000 at 12:56:33PM -0800, Akkana wrote:
> Gary writes:
> > Does anyone have a good mailcap addition for viewing gif or png pics?  I
> > would appreciate it.  
> 
> I use:
> image/gif; xv %s
> image/png; xv %s
> 
> Unfortunately, this makes mutt wait for xv to exit, so I can't compare
> several images, or keep an image up while I read other mail.  I've tried
> various combinations of adding & to the string, but haven't found one
> that makes mutt keep the tmp file around long enough for xv to see it.
> (I thought "xv - -name image.png &" would work, but it doesn't -- it
> apparently still depends on a temp file.)

I put this in my mailcap:

    image/*; mutt_bgrun xv %s; test=RunningX

The script mutt_bgrun takes care of creating a temporary file and
putting the viewer in the background:

    tmpfile=/tmp/$LOGNAME$$${2##*/}
    cp $2 $tmpfile
    (
        $1 $tmpfile
        rm -f $tmpfile
    ) &

> I've had the same "not waiting around long enough" problem with sending
> html messages to Netscape for viewing (as an alternate when they're too
> complicated to read with lynx).  Has anyone found a trick to make mutt
> keep the tmp file around a little longer?  It's not covered in the
> mailcap section of the mutt manual.

I do something similar for Netscape, putting this in my mailcap:

    text/html; mutt_netscape %s; test=RunningX

and using a script, mutt_netscape, containing basically the following:

    tmpfile=/tmp/$LOGNAME$$${1##*/}
    cp $1 $tmpfile
    netscape -remote "openURL(file:$tmpfile, new-window)" 2> /dev/null ||
        netscape $tmpfile

The netscape command returns immediately, so there's no way to know when
it's done with the file.  I have a cron job that periodically cleans out
my old files from /tmp, so I haven't worried about it.

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | RF Communications Product Generation Unit
                             | Spokane, Washington, USA

Reply via email to