Re: Using "viu" to display attached images

2022-06-20 Thread Kevin J. McCarthy

On Tue, Jun 21, 2022 at 08:47:31AM +1000, Cameron Simpson wrote:

On 20Jun2022 11:15, Kevin J. McCarthy  wrote:

With $allow_ansi, Mutt will interpret ansi sequences _it understands_
and convert them to curses calls.  I don't currently have viu available
to play with, but perhaps it's emitting sequences Mutt doesn't
understand.


How hard is it to extend this? Not asking you to do it, asking how
painful it is. I'd like to add pass through for SIXEL support


The existing code isn't that complicated, because it's just converting 
the sequences into ncurses attribute calls.


Handling bitmaps is a different story.  First, because you'd need to 
find out what (if any) support there is with ncurses.  But on top of 
that the Mutt pager rendering would need to be expanded to take them 
into account, along with all the fun options involving line wrapping, 
markers, etc.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Using "viu" to display attached images

2022-06-20 Thread Cameron Simpson
On 20Jun2022 11:15, Kevin J. McCarthy  wrote:
>With $allow_ansi, Mutt will interpret ansi sequences _it understands_ 
>and convert them to curses calls.  I don't currently have viu available 
>to play with, but perhaps it's emitting sequences Mutt doesn't 
>understand.

How hard is it to extend this? Not asking you to do it, asking how 
painful it is. I'd like to add pass through for SIXEL support, which 
both Kitty and iTerm support (iTerm also has its own alternate image 
coding, but I switched to SIXEL recently and haven't looked back, 
because it is more portable and works well).

I've been using img2sixel (not yet in mutt); "viu" has a sixel mode, 
also.  I imagine it falls back to some rust flavour of libaa otherwise.

Cheers,
Cameron Simpson 


Re: Using "viu" to display attached images

2022-06-20 Thread Kevin J. McCarthy

On Mon, Jun 20, 2022 at 01:20:16PM -0400, Rob Pyott wrote:
Hi, is there a way to get viu running without a .mailcap file? (I have 
a basic rc file.). Thanks! Rob


No, mailcap (and mime.types) is the way to configure attachment handling 
in Mutt.  There's a whole chapter in the manual about this, worth at 
least perusing: .


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Using "viu" to display attached images

2022-06-20 Thread Kevin J. McCarthy

On Mon, Jun 20, 2022 at 11:15:50AM -0700, Kevin J. McCarthy wrote:
However, if this also happens with a regular mailcap invocation (using 
 and an entry without the copiousflag setting), then 
something else may be going on.


Re-reading the thread, I just noticed you have TERM set to xterm.

Try setting TERM=xterm-256color, or add "xterm.termName: xterm-256color" 
to your .Xresources file, `xrdb -merge .Xresources`, and launch a new 
xterm.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Using "viu" to display attached images

2022-06-20 Thread Kevin J. McCarthy

On Mon, Jun 20, 2022 at 07:40:17PM +0200, Andy Spiegl wrote:

The copiousoutput flag could be making a difference here.  That will cause
Mutt to render the output of the command internally, which by default will
strip all ansi output.

Even if I set "allow_ansi"?


With $allow_ansi, Mutt will interpret ansi sequences _it understands_ 
and convert them to curses calls.  I don't currently have viu available 
to play with, but perhaps it's emitting sequences Mutt doesn't 
understand.


I've tested against chafa in the past:
 image/*; chafa -c 240 -w 9 -s ${COLUMNS-80} -- %s ; copiousoutput
so you might try that too.

However, if this also happens with a regular mailcap invocation (using 
 and an entry without the copiousflag setting), then 
something else may be going on.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Using "viu" to display attached images

2022-06-20 Thread Andy Spiegl
Kevin,

> The copiousoutput flag could be making a difference here.  That will cause
> Mutt to render the output of the command internally, which by default will
> strip all ansi output.
Even if I set "allow_ansi"?

> If you really want to view it inside Mutt's pager, you could set
> $allow_ansi.
Yes, that's what I want.  If I unset allow_ansi then I see even less.

I'm using mutt version 2.2.3-2.

Thanks!
 Andy


-- 
 If you make people think they're thinking, they'll love you;
 but if you really make them think, they'll hate you.
   (Harlan Ellison)


Re: Using "viu" to display attached images

2022-06-20 Thread Rob Pyott
Hi, is there a way to get viu running without a .mailcap file? (I have a
basic rc file.). Thanks! Rob

On Mon, Jun 20, 2022, 1:02 PM Kevin J. McCarthy  wrote:

> On Mon, Jun 20, 2022 at 12:19:13AM +0200, Andy Spiegl wrote:
> >Hi,
> >
> >recently I discovered the command line program "viu" (
> https://github.com/atanunq/viu)
> >which very nicely displays images in terminal windows.  I added this line
> to my .mailcap:
> >
> > image/*; viu -t -n %s ; copiousoutput
>
> The copiousoutput flag could be making a difference here.  That will
> cause Mutt to render the output of the command internally, which by
> default will strip all ansi output.
>
> It sounds like you tried Oleg's suggestion, without the copiousoutput
> flag, but I mention that just in case.
>
> If you really want to view it inside Mutt's pager, you could set
> $allow_ansi.  However, first be sure to read the documentation on that
> option to make sure you understand the security issues.  Second, I
> recommend updating to at least Mutt 2.1, because that version added
> support for 256-color ansi escape sequences.
>
> --
> Kevin J. McCarthy
> GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
>


Re: Using "viu" to display attached images

2022-06-20 Thread Kevin J. McCarthy

On Mon, Jun 20, 2022 at 12:19:13AM +0200, Andy Spiegl wrote:

Hi,

recently I discovered the command line program "viu" 
(https://github.com/atanunq/viu)
which very nicely displays images in terminal windows.  I added this line to my 
.mailcap:

image/*; viu -t -n %s ; copiousoutput


The copiousoutput flag could be making a difference here.  That will 
cause Mutt to render the output of the command internally, which by 
default will strip all ansi output.


It sounds like you tried Oleg's suggestion, without the copiousoutput 
flag, but I mention that just in case.


If you really want to view it inside Mutt's pager, you could set 
$allow_ansi.  However, first be sure to read the documentation on that 
option to make sure you understand the security issues.  Second, I 
recommend updating to at least Mutt 2.1, because that version added 
support for 256-color ansi escape sequences.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Two questions regarding header display

2022-06-20 Thread raf via Mutt-users
On Mon, Jun 20, 2022 at 08:15:13AM +1000, Cameron Simpson  
wrote:

> On 07Jun2022 09:56, raf  wrote:
> >And I'm not sure I can do anything about it.
> 
> There are many things you can do. I see you've already shifted to just 
> using "bold" etc in your color directives, but also:
> - run a personal terminfo record without the color capabilities; 
>   decompile the provided terminfo with untic, edit to remove the colours 
>   (or change the colours to "mono" escape sequences, build new entry 
>   with tic, set $TERMINFO to refer to it
> - run mutt itself from a script or alias which sets $TERM just for mutt 
>   i.e. overriding the $TERM provided by screen (which will be describing 
>   the terminal capabilities of screen itself)
> - switch from screen to tmux
> 
> Cheers,
> Cameron Simpson 

Thanks.

cheers,
raf



Re: Two questions regarding header display

2022-06-20 Thread Patrick Shanahan
* Bastian  [06-20-22 08:33]:
> I did not follow the entire thread, sorry for potential double post.
> On 20Jun22 08:15+1000, Cameron Simpson wrote:
> > On 07Jun2022 09:56, raf  wrote:
> > >And I'm not sure I can do anything about it.
> > There are many things you can do. I see you've already shifted to just 
> > using "bold" etc in your color directives, but also:
> 
> On my systems, mutt is built and linked against ncurses. I could not 
> make it use 256 colors. I do not recall where, but I read somewhere on 
> the internet (and thus it must be true :) ) that mutt needs to be built 
> against slang to support 256 colors. I never tried that actually and I 
> just accept to only have the 16 default colors set in my Xdefaults.
> Of course this might be total nonsense.

my mutt is built against ncurses 6.3.20220612
and I have 256 colors

mutt -v |grep -i color
+HAVE_COLOR  +HAVE_START_COLOR


-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  @ptilopteri
http://en.opensuse.orgopenSUSE Community Memberfacebook/ptilopteri
Photos: http://wahoo.no-ip.org/piwigo   paka @ IRCnet oftc


Re: Using "viu" to display attached images

2022-06-20 Thread Andy Spiegl
Hi Oleg,

thanks for your reply.

> Below works for me (displays image until pressing any key):
> 
> image/*; viu -t %s && read -n 1

Doesn't work for me. :-(

Actually, it's not ALL black but mixed black and white blocks.
If I maximize the size of the xterm I can vaguely recognize the image.

Thus, viu (version 1.4.0) somehow seems to think it has only a b terminal?
But why would that be different inside mutt?
Does mutt not spawn a "normal" subshell for mailcap?

Thanks,
 Andy

-- 
 It's a small world. Then the airline loses your luggage.


Re: Using "viu" to display attached images

2022-06-20 Thread Oleg A. Mamontov

Hello,

On Mon, Jun 20, 2022 at 12:19:13AM +0200, Andy Spiegl wrote:

Hi,

recently I discovered the command line program "viu" 
(https://github.com/atanunq/viu)
which very nicely displays images in terminal windows.  I added this line to my 
.mailcap:

image/*; viu -t -n %s ; copiousoutput


Below works for me (displays image until pressing any key):

image/*; viu -t %s && read -n 1


Now mutt calls viu for all attached images.
But only a black rectangle is shown instead of the image.

Do you have any idea why this happens?
I compared the env variables inside a mutt shell but found no relevant
differences.  TERM is still set to "xterm".  And if I start a subshell from
within mutt and then call viu, the image is displayed nicely.  I'm a bit 
clueless...

Thanks for any hint,
Andy

--
If your parents never had children, chances are you won't, either.
  (Dick Cavett)


--
Cheers,
Oleg A. Mamontov

email: o...@mamontov.net
phone: +7 (903) 798-1352