Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.48k stars 228 forks source link

Image preview in WezTerm over SSH on Windows #505

Open blumenschwein opened 2 years ago

blumenschwein commented 2 years ago

High-resolution image preview (kitty graphics protocol) in broot does not work, when logging from a Windows computer to an Ubuntu computer using WezTerm and SSH.

Settings

What works

When accessing B from C using SSH and WezTerm (TERM_PROGRAM=WezTerm and TERM_PROGRAM_VERSION=20220213-203140-4a1c4b55 are exported accordingly), image preview works in broot. The resolution of the preview is high.

What does not work

When accessing B or C from A using SSH and WezTerm without exporting TERM_PROGRAM and TERM_PROGRAM_VERSION, broot shows low-resolution image previews. After exporting TERM_PROGRAM=WezTerm and TERM_PROGRAM_VERSION=20220213-203140-4a1c4b55, broot does not show any image preview (the preview region is black). The command wezterm imgcat shows high-resolution preview.

wez commented 2 years ago

if you are using the standalone ssh executable then you are most likely running into a limitation of the conpty layer where it doesn't understand the iterm or kitty image protocols.

You may wish to try using wezterm ssh B to connect to B using wezterm's integrated ssh client; that doesn't need to use conpty and should work with both kitty and iterm image protocols.

Canop commented 2 years ago

@blumenschwein If you can confirm what @wez said, I'll add an entry in the FAQ

blumenschwein commented 2 years ago

Thanks @wez @Canop . I have made more tests, but unfortunately, using wezterm ssh alone does not seem to change much.

Test 1

Now I tried wezterm ssh B and adapted the AcceptEnv settings in /etc/ssh/sshd_config on B accordingly, so that variables TERM_PROGRAM etc. are set automatically at login. But this does not change much. Instead of showing a black region, now broot shows previews in low resolution.

There are some warnings regarding OpenGL:

>wezterm ssh user_name@computer_B

2022-02-17T11:09:10.121Z WARN  window::os::windows::window > EGL init failed Config says to avoid EGL, fall back to WGL
2022-02-17T11:09:10.270Z INFO  wezterm_gui::termwindow     > OpenGL initialized! Intel(R) UHD Graphics 4.5.0 - Build 26.20.100.7870 is_context_loss_possible=true wezterm version: 20220213-203140-4a1c4b55
2022-02-17T11:09:38.502Z WARN  wezterm_term::terminalstate > unhandled DecPrivateMode SetDecPrivateMode(Unspecified(1015))

Besides, the command wezterm imgcat always shows high-resolution previews, both with standalone ssh and with wezterm ssh. I got low-resolution previews or black region only when using broot.

Test 2

I also installed WSL2 on A and used the Linux version of WezTerm from there to accessed B. It works with standalone ssh and exporting TERM_PROGRAM etc. manually, and broot shows high-resolution previews in this case. But just like in Test 1, with wezterm ssh broot shows only low-resolution previews. Also here, the command wezterm imgcat always shows high-resolution previews, both for standalone ssh and wezterm ssh.

AeliusSaionji commented 1 month ago

This is probably a duplicate of #509 Unless OP can attest otherwise, broot's high res image preview does not work under Windows at all, and it's not related to ssh.

i-api commented 1 month ago

Am also using wezterm, but on Mac. Image preview with broot over ssh is low quality.

But I can confirm if you export these variables (in your ssh session), high quality image preview will work with broot:

    export TERM_PROGRAM="WezTerm"
    export TERM_PROGRAM_VERSION="20240203-110809-5046fc22"
AeliusSaionji commented 1 month ago

huh!

Image preview over ssh is working on Windows for me, thanks for prompting me to try setting the variables on the remote host.

So I guess this issue is resolved.

Unfortunately I still cannot get broot to show previews in hq for Windows locally.

i-api commented 1 month ago

Am also using wezterm, but on Mac. Image preview with broot over ssh is low quality.

But I can confirm if you export these variables (in your ssh session), high quality image preview will work with broot:

    export TERM_PROGRAM="WezTerm"
    export TERM_PROGRAM_VERSION="20240203-110809-5046fc22"

I opened up a new issue - broot 1.34+ breaks the high quality image preview, but broot version 1.33 works fine: https://github.com/Canop/broot/issues/910