euporie icon indicating copy to clipboard operation
euporie copied to clipboard

tmux support

Open wpalace opened this issue 1 year ago • 4 comments

This program is fantastic! Thanks for creating it!

I just started experimenting with it and noticed if I remote into a tmux session which I prefer to do, images will not display. I have kitty installed on both the host and remote machines.

This works: ssh user@somehost -t

This does not work: ssh user@somehost -t "tmux new-session -A -s mysesh"

image

wpalace avatar Sep 30 '24 09:09 wpalace

Hi,

Thanks for the kind words.

Only recent versions of tmux support sixel graphics (tmux>=3.4), and for this to work tmux has to be compiled with sixel support enabled. It doesn't support the kitty graphics protocol unfortunately.

It is possible to bypass tmux and send graphics commands directly to the terminal, but this is rather temperamental. You can try this by running euporie using the following command line options:

euporie-console --multiplexer-passthrough --force-graphics --graphics=kitty

(Please note that running euporie over SSH means that images may not be displayed at the correct size, as it's not always possible to detect the terminal size over SSH).

I hope that helps

joouha avatar Sep 30 '24 10:09 joouha

Thanks for the quick response. Running the command you provided gives me a blank area where the image should be; however, if I run just the command below, I get back the graphic but it is pixelated wrong (blocky): euporie-console --multiplexer-passthrough Is there any way to manually set my terminal pixel size? If so, I suspect might get it working.

wpalace avatar Sep 30 '24 13:09 wpalace

Can you tell if it's blocky because it's using ANSI-art style graphics, or is it using kitty graphics but just very low resolution?

Do graphics work as expected for you over SSH when you are not using tmux?

joouha avatar Oct 01 '24 08:10 joouha

Yes, the graphics work as expected on Kitty when I use SSH (either with or without -t) without tmux. I cannot tell which graphics protocol is being used when I SSH to tmux and omit the --force-graphics parameters. To investigate further, I tried another terminal. It turns out that WezTerm works as expected with SSH to tmux, and I did not need to pass any parameters to euporie-console. Sweet!

My goal is to pass lines of code from neovim, where I can quickly edit with AI assist, to euporie-console in the most efficient means possible. I tried launching euporie-console from neovim's terminal mode, but the graphics did not work from there. I tried this with various terminals, both local and remote. This appears to be a neovim issue, not euporie. The best alternative I have so far is to use two tmux windows or panes and copy-paste, but this involves a lot of keystrokes. I haven't played around with WezTerm's multiplexing features yet. Do you have any suggestions on how to achieve this most efficiently?

This project looks promising: https://github.com/mrjones2014/smart-splits.nvim?tab=readme-ov-file#tmux

wpalace avatar Oct 02 '24 08:10 wpalace

Hi! I have the same problem, but with notebooks. I use tmux + kitty.

Here is euporie-notebook --multiplexer-passthrough --force-graphics --graphics=kitty (in tmux): image

Here is how it looks in just kitty: image

Notice also different colors for some reason. Maybe because my terminal and tmux has different themes.

In wezterm, terminal that supports sixel, launching notebooks in tmux with multiplexer_passthrough = false shows the images, but they are for some reason flashing (appearing and disappearing) while scrolling.

I would like to see kitty + tmux result with multiplexer passthrough working right. What I missing?

Also tried to render just images in kitty + tmux and it works fine. Also yazi work fine with images too.

EDIT: noticed error in my conf

helf4ch avatar Oct 30 '24 12:10 helf4ch

There was a slight issue with multiplexer passthrough which is now fixed in dev, but it's still pretty buggy - i.e. graphics end up in the wrong place:

Also tried to render just images in kitty + tmux and it works fine. Also yazi work fine with images too.

This is very interesting. It appears that kitty icat uses unicode placeholders when running in tmux to make this work, rather than using multiplexer passthrough (as does yazi).

I could implement a new graphics renderer which uses unicode placeholders. They are not yet supported by other terminals with support for kitty graphics (konsole fails to place the graphics correctly, and wezterm fails to render them at all), so it would only by usable in kitty for the time being.

joouha avatar Nov 05 '24 09:11 joouha

Just to let you know, I've implemented kitty unicode placeholder graphics in the dev branch (here: f463e0ca0690f11b318d203e52d866c1ccada7ca)

You can test it by running the following in tmux inside a kitty terminal:

uv tool run --from 'git+https://github.com/joouha/euporie.git@dev' euporie-notebook --graphics=kitty-unicode --force-graphics --multiplexer-passthrough

Image

This will be included in the next release

joouha avatar Jan 24 '25 12:01 joouha

Hey! Thank you for your work! It's now looking great in my kitty + tmux setup

Image

helf4ch avatar Jan 24 '25 12:01 helf4ch

This is now released in v2.8.6

joouha avatar Jan 29 '25 10:01 joouha