awrit icon indicating copy to clipboard operation
awrit copied to clipboard

Warn if trying to use through tmux/screen

Open chase opened this issue 2 years ago • 4 comments

A user reported that it failed with a vague error message but they apparently were using tmux which is not supported.

Before starting, awrit should check if the Kitty graphics protocol is supported and exit with a message saying that it isn't supported in tmux, screen or other terminals that don't support the Kitty graphics protocol

chase avatar May 17 '23 04:05 chase

It seems kitty graphics protocol now supports running inside tmux. At least timg supports it.

amosbird avatar Sep 17 '23 08:09 amosbird

In order to use Kitty graphics protocol under tmux, it seems you have to use passthrough mode. https://github.com/kovidgoyal/kitty/blob/ce2e1b08132831fe770ec48d1e73eb4edd21c5b5/kittens/icat/transmit.go#L38-L43

See man tmux for detail:

OPTIONS
    ...
    Available server options are:
    ...
    allow-passthrough [on | off]
        Allow programs in the pane to bypass tmux using a terminal escape sequence (\ePtmux;...\e\\).

aiotter avatar Feb 21 '24 10:02 aiotter

Actually, Virtual Placements (Unicode Placeholders; the recent addition for multiplexer support) might not even be required for the use case of this project, since, in particular, the terminal screen will actually never be scrolled while running awrit.

Just wrapping the current graphics control sequences being used with the passthrough might be sufficient to make things work in tmux and screen and is worth giving a try first.

By the way, I recall they both have length limits for their passthrough payloads (at least, for screen). Hence, the graphics sequences might have to be chucked.

AnonymouX47 avatar Feb 21 '24 14:02 AnonymouX47

Anyone got luck on make it work on Tmux? In my current setup if I run kitten icat img.png inside tmux it works as expected, but when I try to execute awrit it shows a bunch of "BAD SIZE 1908360" messages, even having set -g allow-passthrough on in my .tmux.conf.

ddiegosr avatar Sep 18 '24 22:09 ddiegosr

Yes, I have gotten the old version to work, can't even get electron to work normally.

TogiFerretFerret avatar Mar 04 '25 21:03 TogiFerretFerret

Hey @TogiFerretFerret , which version are you using? Also, what did you do to make it work?

ddiegosr avatar Mar 12 '25 21:03 ddiegosr

Hey @TogiFerretFerret , which version are you using? Also, what did you do to make it work?

He's referring to v1.0.0 on the main branch. Using awrit through tmux isn't supported.

chase avatar Mar 12 '25 21:03 chase

On that note, this can probably be closed:

https://github.com/chase/awrit/blob/electron/src/index.ts#L79-L89

chase avatar Mar 13 '25 00:03 chase