sxyazi / yazi

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

image not opened when press enter on it #1201

Closed woshichuanqilz closed 3 days ago

woshichuanqilz commented 6 days ago

What system are you running Yazi on?

Linux X11

What terminal are you running Yazi in?

kitty 0.35.1 created by Kovid Goyal

Did you try the latest code to see if this problem got fixed?

Tried, but the problem still

Describe the bug

when I move cursor on jpg or png file and press Enter.

The file not opened. The file association is set.

> xdg-mime query default image/png                                  ╯
org.kde.gwenview.desktop

> xdg-mime query default image/jpeg                                ─
org.kde.gwenview.desktop

the image file can be opened in dolphin. and other file like html can be open ed in Chrome when press enter Change program to open not work ( I change gwenview to qimgv).

log file

There is a error keep showing in the log file.

  2024-06-24T15:42:56.683806Z ERROR yazi::components::status: runtime error: [string "yazi-plugin/src/lua.rs:50:13"]:2: attempt to index a nil value (field 'hovered')
stack traceback:
    [C]: in metamethod 'index'
    [string "yazi-plugin/src/lua.rs:50:13"]:2: in method 'modified'
    [string "yazi-plugin/src/lua.rs:50:13"]:10: in function <[string "yazi-plugin/src/lua.rs:50:13"]:6>
    at yazi-fm/src/components/status.rs:17

yazi.log

Expected Behavior

open the image with corresponding program.

To Reproduce

Configuration

keymap.toml

# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"

[manager]
prepend_keymap = [
  { on = [ "m" ],      run = "plugin bookmarks --args=save", desc = "Save current position as a bookmark" },
  { on = [ "'" ],      run = "plugin bookmarks --args=jump", desc = "Jump to a bookmark" },
  { on = [ "b", "d" ], run = "plugin bookmarks --args=delete", desc = "Delete a bookmark" },
  { on = [ "b", "D" ], run = "plugin bookmarks --args=delete_all", desc = "Delete all bookmarks" },
  { on = [ "l" ],      run = "plugin --sync smart-enter", desc = "Enter the child directory, or open the file" },
]

keymap = [
    { on = [ "<Esc>" ], run = "escape",             desc = "Exit visual mode, clear selected, or cancel search" },
    { on = [ "q" ],     run = "quit",               desc = "Exit the process" },
    { on = [ "Q" ],     run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
    { on = [ "<C-q>" ], run = "close",              desc = "Close the current tab, or quit if it is last tab" },
    { on = [ "<C-z>" ], run = "suspend",            desc = "Suspend the process" },

    # Navigation
    { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
    { on = [ "j" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
    { on = [ "J" ], run = "arrow 5",  desc = "Move cursor down 5 lines" },

    { on = [ "<S-Up>" ],   run = "arrow -5", desc = "Move cursor up 5 lines" },
    { on = [ "<S-Down>" ], run = "arrow 5",  desc = "Move cursor down 5 lines" },

    { on = [ "<C-u>" ], run = "arrow -50%",  desc = "Move cursor up half page" },
    { on = [ "<C-d>" ], run = "arrow 50%",   desc = "Move cursor down half page" },
    { on = [ "<C-b>" ], run = "arrow -100%", desc = "Move cursor up one page" },
    { on = [ "<C-f>" ], run = "arrow 100%",  desc = "Move cursor down one page" },

    { on = [ "<C-PageUp>" ],   run = "arrow -50%",  desc = "Move cursor up half page" },
    { on = [ "<C-PageDown>" ], run = "arrow 50%",   desc = "Move cursor down half page" },
    { on = [ "<PageUp>" ],     run = "arrow -100%", desc = "Move cursor up one page" },
    { on = [ "<PageDown>" ],   run = "arrow 100%",  desc = "Move cursor down one page" },

    { on = [ "h" ], run = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" },
    { on = [ "l" ], run = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" },

    { on = [ "<A-a>" ], run = "back",    desc = "Go back to the previous directory" },
    { on = [ "<A-d>" ], run = "forward", desc = "Go forward to the next directory" },

    { on = [ "<A-k>" ], run = "seek -5", desc = "Seek up 5 units in the preview" },
    { on = [ "<A-j>" ], run = "seek 5",  desc = "Seek down 5 units in the preview" },
    { on = [ "<A-PageUp>" ],   run = "seek -5", desc = "Seek up 5 units in the preview" },
    { on = [ "<A-PageDown>" ], run = "seek 5",  desc = "Seek down 5 units in the preview" },

    { on = [ "<Up>" ],    run = "arrow -1", desc = "Move cursor up" },
    { on = [ "<Down>" ],  run = "arrow 1",  desc = "Move cursor down" },
    { on = [ "<Left>" ],  run = "leave",    desc = "Go back to the parent directory" },
    { on = [ "<Right>" ], run = "enter",    desc = "Enter the child directory" },

    { on = [ "g", "g" ], run = "arrow -99999999", desc = "Move cursor to the top" },
    { on = [ "G" ],      run = "arrow 99999999",  desc = "Move cursor to the bottom" },

    # Selection
    { on = [ "<Space>" ], run = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" },
    { on = [ "v" ],       run = "visual_mode",                        desc = "Enter visual mode (selection mode)" },
    { on = [ "V" ],       run = "visual_mode --unset",                desc = "Enter visual mode (unset mode)" },
    { on = [ "<C-a>" ],   run = "select_all --state=true",            desc = "Select all files" },
    { on = [ "<C-r>" ],   run = "select_all --state=none",            desc = "Inverse selection of all files" },

    # Operation
    # { on = [ "o" ],         run = "open",                                                 desc = "Open the selected files" },
    { on = [ "e" ],         run = "open",                                                 desc = "Open the selected files" },
    # { on = [ "l" ],         run = "open",                                                 desc = "Open the selected files" },
    { on = [ "O" ],         run = "open --interactive",                                   desc = "Open the selected files interactively" },
    { on = [ "<Enter>" ],   run = "open",                                                 desc = "Open the selected files" },
    { on = [ "<C-Enter>" ], run = "open --interactive",                                   desc = "Open the selected files interactively" },
    { on = [ "y" ],         run = [ "yank", "escape --visual --select" ],                 desc = "Copy the selected files" },
    { on = [ "d" ],         run = [ "yank --cut", "escape --visual --select" ],           desc = "Cut the selected files" },
    { on = [ "p" ],         run = "paste",                                                desc = "Paste the files" },
    { on = [ "P" ],         run = "paste --force",                                        desc = "Paste the files (overwrite if the destination exists)" },
    { on = [ "-" ],         run = "link",                                                 desc = "Symlink the absolute path of files" },
    { on = [ "_" ],         run = "link --relative",                                      desc = "Symlink the relative path of files" },
    { on = [ "x" ],         run = [ "remove", "escape --visual --select" ],               desc = "Move the files to the trash" },
    { on = [ "X" ],         run = [ "remove --permanently", "escape --visual --select" ], desc = "Permanently delete the files" },
    { on = [ "a" ],         run = "create",                                               desc = "Create a file or directory (ends with / for directories)" },
    { on = [ "r" ],         run = "rename --cursor=before_ext",                           desc = "Rename a file or directory" },
    { on = [ ";" ],         run = "shell",                                                desc = "Run a shell command" },
    { on = [ ":" ],         run = "shell --block",                                        desc = "Run a shell command (block the UI until the command finishes)" },
    { on = [ "." ],         run = "hidden toggle",                                        desc = "Toggle the visibility of hidden files" },
    { on = [ "s" ],         run = "search fd",                                            desc = "Search files by name using fd" },
    { on = [ "S" ],         run = "search rg",                                            desc = "Search files by content using ripgrep" },
    { on = [ "<C-s>" ],     run = "search none",                                          desc = "Cancel the ongoing search" },
    { on = [ "z" ],         run = "plugin zoxide",                                          desc = "Jump to a directory using zoxide" },
    { on = [ "o" ],         run = "plugin zoxide",                                          desc = "Jump to a directory using zoxide" },
    { on = [ "Z" ],         run = "jump fzf",                                             desc = "Jump to a directory, or reveal a file using fzf" },

    # Linemode
    { on = [ "m", "s" ], run = "linemode size",        desc = "Set linemode to size" },
    { on = [ "m", "p" ], run = "linemode permissions", desc = "Set linemode to permissions" },
    { on = [ "m", "m" ], run = "linemode mtime",       desc = "Set linemode to mtime" },
    { on = [ "m", "n" ], run = "linemode none",        desc = "Set linemode to none" },

    # Copy
    { on = [ "c", "c" ], run = "copy path",             desc = "Copy the absolute path" },
    { on = [ "c", "d" ], run = "copy dirname",          desc = "Copy the path of the parent directory" },
    { on = [ "c", "f" ], run = "copy filename",         desc = "Copy the name of the file" },
    { on = [ "c", "n" ], run = "copy name_without_ext", desc = "Copy the name of the file without the extension" },

    # Filter
    { on = [ "f" ], run = "filter --smart", desc = "Filter the files" },

    # Find
    { on = [ "/" ], run = "find --smart",            desc = "Find next file" },
    { on = [ "?" ], run = "find --previous --smart", desc = "Find previous file" },
    { on = [ "n" ], run = "find_arrow",              desc = "Go to next found file" },
    { on = [ "N" ], run = "find_arrow --previous",   desc = "Go to previous found file" },

    # Sorting
    { on = [ ",", "m" ], run = "sort modified --dir-first",               desc = "Sort by modified time" },
    { on = [ ",", "M" ], run = "sort modified --reverse --dir-first",     desc = "Sort by modified time (reverse)" },
    { on = [ ",", "c" ], run = "sort created --dir-first",                desc = "Sort by created time" },
    { on = [ ",", "C" ], run = "sort created --reverse --dir-first",      desc = "Sort by created time (reverse)" },
    { on = [ ",", "e" ], run = "sort extension --dir-first",               desc = "Sort by extension" },
    { on = [ ",", "E" ], run = "sort extension --reverse --dir-first",    desc = "Sort by extension (reverse)" },
    { on = [ ",", "a" ], run = "sort alphabetical --dir-first",           desc = "Sort alphabetically" },
    { on = [ ",", "A" ], run = "sort alphabetical --reverse --dir-first", desc = "Sort alphabetically (reverse)" },
    { on = [ ",", "n" ], run = "sort natural --dir-first",                desc = "Sort naturally" },
    { on = [ ",", "N" ], run = "sort natural --reverse --dir-first",      desc = "Sort naturally (reverse)" },
    { on = [ ",", "s" ], run = "sort size --dir-first",                   desc = "Sort by size" },
    { on = [ ",", "S" ], run = "sort size --reverse --dir-first",         desc = "Sort by size (reverse)" },

    # Tabs
    { on = [ "t" ], run = "tab_create --current", desc = "Create a new tab using the current path" },

    { on = [ "1" ], run = "tab_switch 0", desc = "Switch to the first tab" },
    { on = [ "2" ], run = "tab_switch 1", desc = "Switch to the second tab" },
    { on = [ "3" ], run = "tab_switch 2", desc = "Switch to the third tab" },
    { on = [ "4" ], run = "tab_switch 3", desc = "Switch to the fourth tab" },
    { on = [ "5" ], run = "tab_switch 4", desc = "Switch to the fifth tab" },
    { on = [ "6" ], run = "tab_switch 5", desc = "Switch to the sixth tab" },
    { on = [ "7" ], run = "tab_switch 6", desc = "Switch to the seventh tab" },
    { on = [ "8" ], run = "tab_switch 7", desc = "Switch to the eighth tab" },
    { on = [ "9" ], run = "tab_switch 8", desc = "Switch to the ninth tab" },

    { on = [ ">" ], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
    { on = [ "<" ], run = "tab_switch 1 --relative",  desc = "Switch to the next tab" },

    { on = [ "{" ], run = "tab_swap -1", desc = "Swap the current tab with the previous tab" },
    { on = [ "}" ], run = "tab_swap 1",  desc = "Swap the current tab with the next tab" },

    # Tasks
    { on = [ "w" ], run = "tasks_show", desc = "Show the tasks manager" },

    # Goto
    { on = [ "g", "h" ],       run = "cd ~",             desc = "Go to the home directory" },
    { on = [ "g", "c" ],       run = "cd ~/.config",     desc = "Go to the config directory" },
    { on = [ "g", "d" ],       run = "cd ~/Downloads",   desc = "Go to the downloads directory" },
    { on = [ "g", "t" ],       run = "cd /tmp",          desc = "Go to the temporary directory" },
    { on = [ "g", "<Space>" ], run = "cd --interactive", desc = "Go to a directory interactively" },

    # Help
    { on = [ "~" ], run = "help", desc = "Open help" },
]

[tasks]

keymap = [
    { on = [ "<Esc>" ], run = "close", desc = "Hide the task manager" },
    { on = [ "<C-q>" ], run = "close", desc = "Hide the task manager" },
    { on = [ "w" ],     run = "close", desc = "Hide the task manager" },

    { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
    { on = [ "j" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "<Up>" ],   run = "arrow -1", desc = "Move cursor up" },
    { on = [ "<Down>" ], run = "arrow 1",  desc = "Move cursor down" },

    # { on = [ "<Enter>" ], run = "inspect", desc = "Inspect the task" },
    { on = [ "x" ],       run = "cancel",  desc = "Cancel the task" },

    { on = [ "~" ], run = "help", desc = "Open help" }
]

[select]

keymap = [
    { on = [ "<C-q>" ],   run = "close",          desc = "Cancel selection" },
    { on = [ "<Esc>" ],   run = "close",          desc = "Cancel selection" },
    { on = [ "<Enter>" ], run = "close --submit", desc = "Submit the selection" },

    { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
    { on = [ "j" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
    { on = [ "J" ], run = "arrow 5",  desc = "Move cursor down 5 lines" },

    { on = [ "<Up>" ],   run = "arrow -1", desc = "Move cursor up" },
    { on = [ "<Down>" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "<S-Up>" ],   run = "arrow -5", desc = "Move cursor up 5 lines" },
    { on = [ "<S-Down>" ], run = "arrow 5",  desc = "Move cursor down 5 lines" },

    { on = [ "~" ], run = "help", desc = "Open help" }
]

[input]

keymap = [
    { on = [ "<C-q>" ],   run = "close",          desc = "Cancel input" },
    { on = [ "<Enter>" ], run = "close --submit", desc = "Submit the input" },
    { on = [ "<Esc>" ],   run = "escape",         desc = "Go back the normal mode, or cancel input" },

    # Mode
    { on = [ "i" ], run = "insert",                              desc = "Enter insert mode" },
    { on = [ "a" ], run = "insert --append",                     desc = "Enter append mode" },
    { on = [ "I" ], run = [ "move -999", "insert" ],             desc = "Move to the BOL, and enter insert mode" },
    { on = [ "A" ], run = [ "move 999", "insert --append" ],     desc = "Move to the EOL, and enter append mode" },
    { on = [ "v" ], run = "visual",                              desc = "Enter visual mode" },
    { on = [ "V" ], run = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" },

    # Character-wise movement
    { on = [ "h" ],       run = "move -1", desc = "Move back a character" },
    { on = [ "l" ],       run = "move 1",  desc = "Move forward a character" },
    { on = [ "<Left>" ],  run = "move -1", desc = "Move back a character" },
    { on = [ "<Right>" ], run = "move 1",  desc = "Move forward a character" },
    { on = [ "<C-b>" ],   run = "move -1", desc = "Move back a character" },
    { on = [ "<C-f>" ],   run = "move 1",  desc = "Move forward a character" },

    # Word-wise movement
    { on = [ "b" ],     run = "backward",              desc = "Move back to the start of the current or previous word" },
    { on = [ "w" ],     run = "forward",               desc = "Move forward to the start of the next word" },
    { on = [ "e" ],     run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
    { on = [ "<A-b>" ], run = "backward",              desc = "Move back to the start of the current or previous word" },
    { on = [ "<A-f>" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },

    # Line-wise movement
    { on = [ "0" ],     run = "move -999", desc = "Move to the BOL" },
    { on = [ "$" ],     run = "move 999",  desc = "Move to the EOL" },
    { on = [ "<C-a>" ], run = "move -999", desc = "Move to the BOL" },
    { on = [ "<C-e>" ], run = "move 999",  desc = "Move to the EOL" },

    # Delete
    { on = [ "<Backspace>" ], run = "backspace",            desc = "Delete the character before the cursor" },
    { on = [ "<C-h>" ],       run = "backspace",         desc = "Delete the character before the cursor" },
    { on = [ "<C-d>" ],       run = "backspace --under", desc = "Delete the character under the cursor" },

    # Kill
    { on = [ "<C-u>" ], run = "kill bol",      desc = "Kill backwards to the BOL" },
    { on = [ "<C-k>" ], run = "kill eol",      desc = "Kill forwards to the EOL" },
    { on = [ "<C-w>" ], run = "kill backward", desc = "Kill backwards to the start of the current word" },
    # { on = [ "<A-d>" ], run = "kill forward",  desc = "Kill forwards to the end of the current word" },

    # Cut/Yank/Paste
    { on = [ "d" ], run = "delete --cut",                              desc = "Cut the selected characters" },
    { on = [ "D" ], run = [ "delete --cut", "move 999" ],              desc = "Cut until the EOL" },
    { on = [ "c" ], run = "delete --cut --insert",                     desc = "Cut the selected characters, and enter insert mode" },
    { on = [ "C" ], run = [ "delete --cut --insert", "move 999" ],     desc = "Cut until the EOL, and enter insert mode" },
    { on = [ "x" ], run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" },
    { on = [ "y" ], run = "yank",           desc = "Copy the selected characters" },
    { on = [ "p" ], run = "paste",          desc = "Paste the copied characters after the cursor" },
    { on = [ "P" ], run = "paste --before", desc = "Paste the copied characters before the cursor" },

    # Undo/Redo
    { on = [ "u" ],     run = "undo", desc = "Undo the last operation" },
    { on = [ "<C-r>" ], run = "redo", desc = "Redo the last operation" },

    # Help
    { on = [ "~" ], run = "help", desc = "Open help" }
]

[completion]

keymap = [
    { on = [ "<C-q>" ],   run = "close",                                      desc = "Cancel completion" },
    { on = [ "<Tab>" ],   run = "close --submit",                             desc = "Submit the completion" },
    { on = [ "<Enter>" ], run = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" },

    { on = [ "<A-k>" ], run = "arrow -1", desc = "Move cursor up" },
    { on = [ "<A-j>" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "<Up>" ],   run = "arrow -1", desc = "Move cursor up" },
    { on = [ "<Down>" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "~" ], run = "help", desc = "Open help" }
]

[help]

keymap = [
    { on = [ "<Esc>" ], run = "escape", desc = "Clear the filter, or hide the help" },
    { on = [ "q" ],     run = "close",  desc = "Exit the process" },
    { on = [ "<C-q>" ], run = "close",  desc = "Hide the help" },

    # Navigation
    { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" },
    { on = [ "j" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" },
    { on = [ "J" ], run = "arrow 5",  desc = "Move cursor down 5 lines" },

    { on = [ "<Up>" ],   run = "arrow -1", desc = "Move cursor up" },
    { on = [ "<Down>" ], run = "arrow 1",  desc = "Move cursor down" },

    { on = [ "<S-Up>" ],   run = "arrow -5", desc = "Move cursor up 5 lines" },
    { on = [ "<S-Down>" ], run = "arrow 5",  desc = "Move cursor down 5 lines" },

    # Filtering
    { on = [ "/" ], run = "filter", desc = "Apply a filter for the help items" },
]

yazi.toml

# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/yazi.json"

[manager]
ratio          = [ 1, 4, 3 ]
sort_by        = "alphabetical"
sort_sensitive = true
sort_reverse   = true
sort_dir_first = true
linemode       = "none"
show_hidden    = true
show_symlink   = true
mouse_events   = ["click"]

[preview]
tab_size        = 2
max_width       = 1600
max_height      = 2400
cache_dir       = ""
ueberzug_scale  = 1
ueberzug_offset = [ 0, 0, 0, 0 ]
image_quality = 90

[opener]
edit = [
    { run = '$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" }
]
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/html",  use = [ "open", "edit" ] },
    { 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 = "bottom-left"
filter_offset = [ 16, 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 ]

[log]
enabled = false

Anything else?

No response

yazi --debug output

```sh Yazi Version: 0.2.5 (Arch Linux 2024-04-27) OS: linux-x86_64 (unix) Debug: false Emulator Emulator.via_env: ("xterm-kitty", "") Emulator.via_csi: Ok(Unknown([])) Emulator.detect: Kitty Adaptor Adaptor.matches: X11 Desktop XDG_SESSION_TYPE: Some("x11") WAYLAND_DISPLAY: None DISPLAY: Some(":0") SSH shared.in_ssh_connection: false WSL /proc/sys/fs/binfmt_misc/WSLInterop: false Variables SHELL: Some("/usr/bin/fish") EDITOR: Some("nvim") ZELLIJ_SESSION_NAME: Some("拼搏与梦想") YAZI_FILE_ONE: None YAZI_CONFIG_HOME: None file(1) Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "file-5.45\nmagic file from /usr/share/file/misc/magic\nseccomp support included\n", stderr: "" }) Text Opener default: Some(Opener { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true }) block: Some(Opener { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true }) tmux TMUX: false Ueberzug++ Version: Err(Os { code: 2, kind: NotFound, message: "No such file or directory" }) -------------------------------------------------- When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time. You can find it in the "/home/lizhe/.local/state/yazi" directory. ```
sxyazi commented 6 days ago

Please fill out the bug report template correctly (bug description, steps to reproduce, etc.), otherwise I'm not sure what action to take.

woshichuanqilz commented 6 days ago

Please fill out the bug report template correctly (bug description, steps to reproduce, etc.), otherwise I'm not sure what action to take.

I post everything I know may related to this issue.

The reproduce I can write here again

  1. install yazi
  2. config yazi use the file I posted.
  3. press enter on a jpg/png file in yazi.
  4. the image file wont open in the corresponding program like gwenview or qimgv

I don't know what else do you need ?

sxyazi commented 6 days ago

Ah the reproducer has folded into the "yazi --debug output".

Next time you submit a bug report, don't add these to the <details> tag. Reopen it.

sxyazi commented 6 days ago

What happens when you run file -bL mime-type /path/to/your-image-file and xdg-open /path/to/your-image-file? Is this issue still with the default Yazi config?

woshichuanqilz commented 6 days ago
sxyazi commented 6 days ago

Please upload the failed file

zaeboba commented 5 days ago

image

I also don't have a preview for any file.

https://0x0.st/XAFK.log - log

sxyazi commented 5 days ago

@zaeboba Please create a new bug report and fill out the template. I need to know your specific environment information and the steps to reproduce the issue.

woshichuanqilz commented 5 days ago

Please upload the failed file

what failed file? The log file with default config to press enter on the image contains nothing.

image

sxyazi commented 5 days ago

what failed file?

The image file failed to open

woshichuanqilz commented 5 days ago

what failed file?

The image file failed to open

The images seems ok. It can be opened in dolphin

0016 0017 0018 Snipaste_2024-06-25_21-37-16

sxyazi commented 5 days ago

Weird, I can't reproduce it with your image on my Linux VM

https://github.com/sxyazi/yazi/assets/17523360/63ad092f-1e3a-41a3-96c6-ba1775ab6b88

This is my Yazi version:

Yazi 0.2.5 (9a5b756 2024-06-25)

The mime-type of this image on my side (file-5.45):

file -bL --mime-type 342757779-af05c837-ebb4-4948-a0c9-04843766237d.jpg
image/jpeg

And I'm using the default config of Yazi

woshichuanqilz commented 5 days ago

Weird, I can't reproduce it with your image on my Linux VM

screenshot-000832.mp4 This is my Yazi version:

Yazi 0.2.5 (9a5b756 2024-06-25)

The mime-type of this image on my side (file-5.45):

file -bL --mime-type 342757779-af05c837-ebb4-4948-a0c9-04843766237d.jpg
image/jpeg

And I'm using the default config of Yazi

I want to add some code in the yazi, compile it with source code and check the log. Seems there is no log file currently about what happened when I press enter on image file .

Can you tell me which part of the code should I read? I don't know where to add the log code

sxyazi commented 5 days ago

You can try:

  1. Press O on the image and see what the first opener is.
  2. Copy the command of that opener, run it in the terminal, and see what happens.
woshichuanqilz commented 5 days ago

You can try:

  1. Press O on the image and see what the first opener is.
  2. Copy the command of that opener, run it in the terminal, and see what happens.

This? Cant see the opener. I use qimgv as the default program to open images. It works from command line image

xfzv commented 5 days ago

Curious as to what would happen with a custom opener that explicitly uses qimgv:

[opener]
open-image = [{ run = 'qimgv "$@"', orphan = true, desc = "qimgv" }]

[open]
rules = [
  { mime = "image/*", use = [
    "open-image",
    "reveal",
  ] },
]

Then use O and select qimgv in the pop-up menu

woshichuanqilz commented 5 days ago

Curious as to what would happen with a custom opener that explicitly uses qimgv:

[opener]
open-image = [{ run = 'qimgv "$@"', orphan = true, desc = "qimgv" }]

[open]
rules = [
  { mime = "image/*", use = [
    "open-image",
    "reveal",
  ] },
]

Then use O and select qimgv in the pop-up menu

Oh it worked with your config. Why is that ? I can press enter on the image and the image will be open

xfzv commented 5 days ago

Oh it worked with your config. Why is that ? I can press enter on the image and the image will be open

Good question. I don't know why

% xdg-open /path/to/file

works for you but the same command doesn't when run from yazi.

Can your reproduce the issue with other TUI file managers such as joshuto or lf? If not, I don't think the issue is with yazi.

Is there any other file type that open fine with Dolphin but won't open from yazi or does it only happen with images?

What is the content of ~/.config/mimeapps.list (if it exists)?

woshichuanqilz commented 5 days ago

Oh it worked with your config. Why is that ? I can press enter on the image and the image will be open

Good question. I don't know why

% xdg-open /path/to/file

works for you but the same command doesn't when run from yazi.

Can your reproduce the issue with other TUI file managers such as joshuto or lf? If not, I don't think the issue is with yazi.

Is there any other file type that open fine with Dolphin but won't open from yazi or does it only happen with images?

What is the content of ~/.config/mimeapps.list (if it exists)?

[Default Applications] application/x-extension-htm=firefox.desktop application/x-extension-html=firefox.desktop application/x-extension-shtml=firefox.desktop application/x-extension-xht=firefox.desktop application/x-extension-xhtml=firefox.desktop application/xhtml+xml=firefox.desktop text/html=google-chrome.desktop x-scheme-handler/baiduyunguanjia=baidunetdisk.desktop x-scheme-handler/chrome=firefox.desktop x-scheme-handler/clash=clash_win.desktop x-scheme-handler/http=google-chrome.desktop; x-scheme-handler/https=google-chrome.desktop; x-scheme-handler/jetbrains=jetbrains-toolbox.desktop x-scheme-handler/x-github-client=github-desktop.desktop x-scheme-handler/x-github-desktop-auth=github-desktop.desktop x-scheme-handler/mailto=google-chrome.desktop text.html=google-chrome.desktop image/png=qimgv.desktop image/jpeg=qimgv.desktop

sxyazi commented 5 days ago

If you use the config from @xfzv but just change qimgv to xdg-open what will happen? And what will happen if you run xdg-open on the image using the built-in shell by clicking ; or :?

woshichuanqilz commented 5 days ago

If you use the config from @xfzv but just change qimgv to xdg-open what will happen?

works.

And what will happen if you run xdg-open on the image using the built-in shell by clicking ; or :?

works too.

And if I remove the @xfzv 's config. Not work again

sxyazi commented 5 days ago

Version: 0.2.5 (Arch Linux 2024-04-27)

Are you sure you're using the latest code?

woshichuanqilz commented 5 days ago

Version: 0.2.5 (Arch Linux 2024-04-27)

Are you sure you're using the latest code?

Add some log code for this issue may find the reason

image

sxyazi commented 5 days ago

Why is your build date 2024-04-27?

woshichuanqilz commented 5 days ago

Why is your build date 2024-04-27?

I download from aur. I just download the yazi from the release build date 4-23. Same issue

sxyazi commented 5 days ago

What does yazi -V output?

woshichuanqilz commented 5 days ago

What does yazi -V output?

What is the differences with --version ?

╰─❯ yazi --version                                                  ─╯
Yazi 0.2.5 (c65a14c 2024-04-23)

╭─ ~/Applications                                                 ─╮
╰─❯ yazi -V                                                         ─╯
Yazi 0.2.5 (c65a14c 2024-04-23)
xfzv commented 5 days ago

@woshichuanqilz -V and --version is the same (short/long):

% yazi --help
  -V, --version                        Print version

What if you replace

open = [
  { run = 'xdg-open "$@"', desc = "Open", for = "linux" },

with

open = [
  { run = 'xdg-open "$@"', orphan = true, desc = "Open" },

?

sxyazi commented 5 days ago

What does yazi -V output?

What is the differences with --version ?

╰─❯ yazi --version                                                  ─╯
Yazi 0.2.5 (c65a14c 2024-04-23)

╭─ ~/Applications                                                 ─╮
╰─❯ yazi -V                                                         ─╯
Yazi 0.2.5 (c65a14c 2024-04-23)

No, this is not the latest code, please verify if this problem exists in the latest code

woshichuanqilz commented 4 days ago

What does yazi -V output?

What is the differences with --version ?

╰─❯ yazi --version                                                  ─╯
Yazi 0.2.5 (c65a14c 2024-04-23)

╭─ ~/Applications                                                 ─╮
╰─❯ yazi -V                                                         ─╯
Yazi 0.2.5 (c65a14c 2024-04-23)

No, this is not the latest code, please verify if this problem exists in the latest code

use the latest version with command cargo install --locked --git https://github.com/sxyazi/yazi.git yazi-fm yazi-cli. Same issue

yazi -V ─╯ Yazi 0.2.5 (c64530b 2024-06-26)

woshichuanqilz commented 4 days ago

@woshichuanqilz -V and --version is the same (short/long):

% yazi --help
  -V, --version                        Print version

What if you replace

open = [
  { run = 'xdg-open "$@"', desc = "Open", for = "linux" },

with

open = [
  { run = 'xdg-open "$@"', orphan = true, desc = "Open" },

?

Still work

sxyazi commented 4 days ago

In that case, I think we can simply add orphan = true to the default xdg-open opener rule to fix it. I don't know why, but it works.

sxyazi commented 3 days ago

I tried again and still couldn't reproduce the issue. I'm not sure if adding orphan = true to the default config is reasonable, so I've decided not to add it atm - I'll see if anyone else reports the same problem.

For now, please override the default image opener in your yazi.toml as a workaround.