sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
14.45k stars 330 forks source link

Image preview is not work correctly in Tmux #1502

Closed dhay3 closed 4 weeks ago

dhay3 commented 4 weeks ago

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

konsole 24.05.2

yazi --debug output

On Konsole(Yakuake) with Tmux configuration is unset

Yazi
    Version: 0.3.1 (99a3b3a 2024-08-16)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.1 (99a3b3a 2024-08-16)

Emulator
    Emulator.via_env: ("screen-256color", "tmux")
    Emulator.via_csi: Ok(Konsole)
    Emulator.detect : Kitty

Adapter
    Adapter.matches: Kitty

Desktop
    XDG_SESSION_TYPE: Some("wayland")
    WAYLAND_DISPLAY : Some("wayland-0")
    DISPLAY         : Some(":1")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL              : Some("/usr/bin/zsh")
    EDITOR             : Some("/usr/bin/vim")
    VISUAL             : Some("/usr/bin/vim")
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "${EDITOR:-vim} \"${@}\"", block: true, orphan: false, desc: "Edit file in $EDITOR", for_: None, spread: false })
    block  : Some(Opener { run: "${EDITOR:-vim} \"${@}\"", block: true, orphan: false, desc: "Edit file in $EDITOR", for_: None, spread: false })

Multiplexers
    TMUX               : true
    tmux version       : 3.4
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : No such file or directory (os error 2)
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-36
    fzf              : 0.54.3
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : 1.14.1
    zoxide           : 0.9.4
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1

On Konsole(Yakuake) with Tmux configuration is set


Yazi
    Version: 0.3.1 (99a3b3a 2024-08-16)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.1 (99a3b3a 2024-08-16)

Emulator
    Emulator.via_env: ("xterm-256color", "tmux")
    Emulator.via_csi: Ok(Konsole)
    Emulator.detect : Konsole

Adapter
    Adapter.matches: Wayland

Desktop
    XDG_SESSION_TYPE: Some("wayland")
    WAYLAND_DISPLAY : Some("wayland-0")
    DISPLAY         : Some(":1")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL              : Some("/usr/bin/zsh")
    EDITOR             : Some("/usr/bin/vim")
    VISUAL             : Some("/usr/bin/vim")
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "${EDITOR:-vim} \"${@}\"", block: true, orphan: false, desc: "Edit file in $EDITOR", for_: None, spread: false })
    block  : Some(Opener { run: "${EDITOR:-vim} \"${@}\"", block: true, orphan: false, desc: "Edit file in $EDITOR", for_: None, spread: false })

Multiplexers
    TMUX               : true
    tmux version       : 3.4
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : No such file or directory (os error 2)
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-36
    fzf              : 0.54.3
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : 1.14.1
    zoxide           : 0.9.4
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1

Did you try the latest nightly build to see if the problem got fixed?

Yes, and I updated the debug information above (yazi --debug) to the nightly that I tried

Describe the bug

Some preview image drift to left with some red square blocks in right panel on Konsole(Yakuake) which has opened a Tmux session. However Kitty works correctly with Tmux. When the configuration of Tmux is not set which is followed by yazi's official docs.

set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM

On Konsole(Yakuake) with Tmux

Rendered with red square blocks image

On Kitty with Tmux

image

And when the configuration of Tmux is set and restart Tmux. Either Konsole(Yakuake) or Kitty do not show the image preview.

On Konsole(Yakuake) with Tmux

image

On Kitty with Tmux

image

It dims the Emulator.detect is mess up for some reason.

Minimal reproducer

  1. add the following configuration in ~/.tmux.conf
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
  1. Browse images in yazi

Anything else?

No response

sxyazi commented 4 weeks ago

This is because Konsole currently only correctly implements the old Kitty protocol, which doesn't work under tmux.

There's nothing Yazi can do about this; we can only wait for Konsole to implement the new Kitty unicode placeholders or fix the bug in its Inline Images protocol implementation that can't properly erase images.

sxyazi commented 4 weeks ago

Regarding the mentioned issue with Kitty and tmux, please make sure that both Kitty and tmux are the latest official versions. Older versions of Kitty do not support displaying images in tmux.

Edit: Regarding the issue where kitty is recognized as Konsole after setting up tmux, have you set any environment variables? What is the output of echo $KONSOLE_VERSION? This setting is no longer necessary after Yazi 0.3. If setting it causes problems, you can just remove it.

dhay3 commented 2 weeks ago

Sorry for the late reply, I use kitty instead now, everything works like a charm :)