yazi: Image/PDF preview is at wrong place with wrong dimensions after closing the terminal with yazi open

What system are you running Yazi on?

Linux X11

What terminal are you running Yazi in?

Suckless Simple Terminal (st)

Did you try the latest main branch to see if the problem got fixed?

Tried, but the problem still

yazi --debug output

Yazi
    yazi 0.2.4 (Arch Linux 2024-03-10)

Environment
    OS: linux-x86_64 (unix)
    Debug: false

Emulator
    Emulator.via_env: ("st-256color", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect: Unknown([])

Adaptor
    Adaptor.matches: X11

tmux
    TMUX: false

Zellij
    ZELLIJ_SESSION_NAME: None

Desktop
    XDG_SESSION_TYPE: Some("x11")
    WAYLAND_DISPLAY: None
    DISPLAY: Some(":0")

Ueberzug
    Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "ueberzugpp 2.9.4\n", stderr: "" })

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

Describe the bug

When I run yazi in the terminal everything works and the preview is looking good. But when I close the terminal without exiting yazi before and then reopen yazi in a new terminal the preview is messed up. This can only be undone by a system restart. image

Expected Behavior

When closing the terminal with yazi open and open it again on another terminal, the preview should still be in place. image

To Reproduce

This is happening on Arch Linux with dwm as window manager and st as terminal emulator.

  • start st
  • run yazi
  • close the window
  • open st again
  • start yazi again

Configuration

[manager]
ratio          = [ 1, 4, 3 ]
sort_by        = "alphabetical"
sort_sensitive = false
sort_reverse   = false
sort_dir_first = true
linemode       = "size"
show_hidden    = false
show_symlink   = true
scrolloff      = 5

[preview]
tab_size        = 2
max_width       = 600
max_height      = 900
cache_dir       = ""
image_filter    = "triangle"
image_quality   = 75
sixel_fraction  = 15
ueberzug_scale  = 1
ueberzug_offset = [ 0, 0, 0, 0 ]

[opener]
edit = [
	{ run = '${EDITOR:=vi} "$@"', desc = "$EDITOR", block = true, for = "unix" },
	{ run = 'code "%*"',          orphan = true, for = "windows" },
]
open = [
	{ run = 'xdg-open "$@"',                desc = "Open", for = "linux" },
	{ run = 'open "$@"',                    desc = "Open", for = "macos" },
	{ run = 'start "" "%1"', orphan = true, desc = "Open", for = "windows" },
    { run = 'zathura "$@"', desc = "Open PDF", for = "unix", mime = "application/pdf" }
]
reveal = [
	{ run = 'open -R "$1"',                          desc = "Reveal", for = "macos" },
	{ run = 'explorer /select, "%1"', orphan = true, desc = "Reveal", for = "windows" },
	{ run = '''exiftool "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show EXIF", for = "unix" },
]
extract = [
	{ run = 'unar "$1"', desc = "Extract here", for = "unix" },
	{ run = 'unar "%1"', desc = "Extract here", for = "windows" },
]
play = [
	{ run = 'mpv "$@"', orphan = true, for = "unix" },
	{ run = 'mpv "%1"', orphan = true, for = "windows" },
	{ run = '''mediainfo "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show media info", for = "unix" },
]

[open]
rules = [
	{ name = "*/", use = [ "edit", "open", "reveal" ] },

	{ mime = "text/*",  use = [ "edit", "reveal" ] },
	{ mime = "image/*", use = [ "open", "reveal" ] },
	{ mime = "video/*", use = [ "play", "reveal" ] },
	{ mime = "audio/*", use = [ "play", "reveal" ] },
	{ mime = "inode/x-empty", use = [ "edit", "reveal" ] },

	{ mime = "application/json", use = [ "edit", "reveal" ] },
	{ mime = "*/javascript",     use = [ "edit", "reveal" ] },

	{ mime = "application/zip",             use = [ "extract", "reveal" ] },
	{ mime = "application/gzip",            use = [ "extract", "reveal" ] },
	{ mime = "application/x-tar",           use = [ "extract", "reveal" ] },
	{ mime = "application/x-bzip",          use = [ "extract", "reveal" ] },
	{ mime = "application/x-bzip2",         use = [ "extract", "reveal" ] },
	{ mime = "application/x-7z-compressed", use = [ "extract", "reveal" ] },
	{ mime = "application/x-rar",           use = [ "extract", "reveal" ] },
	{ mime = "application/xz",              use = [ "extract", "reveal" ] },

	{ mime = "*", use = [ "open", "reveal" ] },
]

[tasks]
micro_workers    = 10
macro_workers    = 25
bizarre_retry    = 5
image_alloc      = 536870912  # 512MB
image_bound      = [ 0, 0 ]
suppress_preload = false

[plugin]

preloaders = [
	{ name = "*", cond = "!mime", run = "mime", multi = true, prio = "high" },
	# Image
	{ mime = "image/vnd.djvu", run = "noop" },
	{ mime = "image/*",        run = "image" },
	# Video
	{ mime = "video/*", run = "video" },
	# PDF
	{ mime = "application/pdf", run = "pdf" },
]
previewers = [
	{ name = "*/", run = "folder", sync = true },
	# Code
	{ mime = "text/*",                 run = "code" },
	{ mime = "*/xml",                  run = "code" },
	{ mime = "*/javascript",           run = "code" },
	{ mime = "*/x-wine-extension-ini", run = "code" },
	# JSON
	{ mime = "application/json", run = "json" },
	# Image
	{ mime = "image/vnd.djvu", run = "noop" },
	{ mime = "image/*",        run = "image" },
	# Video
	{ mime = "video/*", run = "video" },
    # PDF
    { mime = "application/pdf", run = "pdf" },
	# Archive
	{ mime = "application/zip",             run = "archive" },
	{ mime = "application/gzip",            run = "archive" },
	{ mime = "application/x-tar",           run = "archive" },
	{ mime = "application/x-bzip",          run = "archive" },
	{ mime = "application/x-bzip2",         run = "archive" },
	{ mime = "application/x-7z-compressed", run = "archive" },
	{ mime = "application/x-rar",           run = "archive" },
	{ mime = "application/xz",              run = "archive" },
	# Fallback
	{ name = "*", run = "file" },
]

[input]
# cd
cd_title  = "Change directory:"
cd_origin = "top-center"
cd_offset = [ 0, 2, 50, 3 ]

# create
create_title  = "Create:"
create_origin = "top-center"
create_offset = [ 0, 2, 50, 3 ]

# rename
rename_title  = "Rename:"
rename_origin = "hovered"
rename_offset = [ 0, 1, 50, 3 ]

# trash
trash_title 	= "Move {n} selected file{s} to trash? (y/N)"
trash_origin	= "top-center"
trash_offset	= [ 0, 2, 50, 3 ]

# delete
delete_title 	= "Delete {n} selected file{s} permanently? (y/N)"
delete_origin	= "top-center"
delete_offset	= [ 0, 2, 50, 3 ]

# filter
filter_title  = "Filter:"
filter_origin = "top-center"
filter_offset = [ 0, 2, 50, 3 ]

# find
find_title  = [ "Find next:", "Find previous:" ]
find_origin = "top-center"
find_offset = [ 0, 2, 50, 3 ]

# search
search_title  = "Search via {n}:"
search_origin = "top-center"
search_offset = [ 0, 2, 50, 3 ]

# shell
shell_title  = [ "Shell:", "Shell (block):" ]
shell_origin = "top-center"
shell_offset = [ 0, 2, 50, 3 ]

# overwrite
overwrite_title  = "Overwrite an existing file? (y/N)"
overwrite_origin = "top-center"
overwrite_offset = [ 0, 2, 50, 3 ]

# quit
quit_title  = "{n} task{s} running, sure to quit? (y/N)"
quit_origin = "top-center"
quit_offset = [ 0, 2, 50, 3 ]

[select]
open_title  = "Open with:"
open_origin = "hovered"
open_offset = [ 0, 1, 50, 7 ]

[which]
sort_by        = "none"
sort_sensitive = false
sort_reverse   = false

[log]
enabled = false

Anything else?

This is the log output

  2024-04-10T13:17:23.988113Z ERROR yazi_scheduler::preload::preload: Preload task `image` returned 2
    at yazi-scheduler/src/preload/preload.rs:42

  2024-04-10T13:17:23.995369Z ERROR yazi_scheduler::preload::preload: Preload task `image` returned 2
    at yazi-scheduler/src/preload/preload.rs:42

  2024-04-10T13:17:27.733784Z  WARN yazi_adaptor::emulator: [Adaptor] No special environment variables detected
    at yazi-adaptor/src/emulator.rs:64

  2024-04-10T13:17:27.733808Z  WARN yazi_adaptor::emulator: [Adaptor] Unknown TERM_PROGRAM: 
    at yazi-adaptor/src/emulator.rs:77

  2024-04-10T13:17:27.733810Z  WARN yazi_adaptor::emulator: [Adaptor] Unknown TERM: st-256color
    at yazi-adaptor/src/emulator.rs:84

  2024-04-10T13:17:34.985808Z  WARN yazi_adaptor::emulator: [Adaptor] No special environment variables detected
    at yazi-adaptor/src/emulator.rs:64

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Hey @Ornanovitch, this might be due to the failure of image preloading, which is unrelated to the reported Überzug++ bug, since Überzug++ is not handled by the task scheduling system of Yazi, it won’t cause the progress bar to appear.

If the issue occurs again, press w to open the task manager, then hover on the task and press <Enter> to inspect it, and copy the error information to file a new issue.

Downgrading ueberzugpp to 2.8.8 worked! 👍 Thanks so much for the help!

It might be related to https://github.com/jstkdng/ueberzugpp/issues/170.

Hi @BennyOe, could you try rolling back ueberzugpp to a version before 2.9.4 to see if it works? As I noticed your ueberzugpp version is also 2.9.4.

No, when I kill the terminal the ueberzugpp process is gone too. I didn’t try it with other terminals yet but will later and report. Also I will try with the latest code and report later. Thanks for investigating with me and for this awesome piece of software 😃