Skip to content

Lack of download-completion event/callback for plugins #3457

@boydaihungst

Description

@boydaihungst

yazi --debug output

Yazi
    Version: 25.9.15 (e7cd663 2025-12-18)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.92.0 (ded5c06c 2025-12-08)

Ya
    Version: 25.9.15 (e7cd663 2025-12-18)

Config
    Yazi             : /home/huyhoang/.config/yazi/yazi.toml (14420 chars)
    Keymap           : /home/huyhoang/.config/yazi/keymap.toml (35268 chars)
    Theme            : /home/huyhoang/.config/yazi/theme.toml (5319 chars)
    VFS              : /home/huyhoang/.config/yazi/vfs.toml (127 chars)
    Package          : /home/huyhoang/.config/yazi/package.toml (2300 chars)
    Dark/light flavor: "" / ""

Emulator
    TERM                : Some("xterm-kitty")
    TERM_PROGRAM        : None
    TERM_PROGRAM_VERSION: None
    Brand.from_env      : Some(Kitty)
    Emulator.detect     : Emulator { kind: Left(Kitty), version: "kitty(0.44.0)", light: false, csi_16t: (16, 32), force_16t: false }

Adapter
    Adapter.matches    : Kgp
    Dimension.available: Dimension { rows: 45, columns: 75, width: 1200, height: 1440 }

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : Some("/run/user/1000/sway-ipc.1000.2263.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/usr/bin/fish")
    EDITOR             : Some("nvim")
    VISUAL             : None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None
    YAZI_ZOXIDE_OPTS   : None
    FZF_DEFAULT_OPTS   : None
    FZF_DEFAULT_COMMAND: None

Text Opener
    default     : Some(OpenerRule { run: "kitty --app-id \"nvim\" -- nvim %s", block: false, orphan: true, desc: "Nvim", for: None, spread: true })
    block-create: None
    block-rename: Some(OpenerRule { run: "nvim %s", block: true, orphan: false, desc: "", for: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : No such file or directory (os error 2)
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file          : 5.46
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 8.0.1 / 8.0.1
    pdftoppm      : 25.12.0
    magick        : 7.1.2-10
    fzf           : 0.67.0
    fd/fdfind     : 10.3.0 / No such file or directory (os error 2)
    rg            : 15.1.0
    chafa         : 1.16.2
    zoxide        : 0.9.8
    7zz/7z        : No such file or directory (os error 2) / 25.01
    resvg         : 0.45.1
    jq            : 1.8.1

Clipboard
    wl-copy/paste: 2.2.1 / 2.2.1
    xclip        : No such file or directory (os error 2)
    xsel         : No such file or directory (os error 2)

Routine
    `file -bL --mime-type`: text/plain


See https://yazi-rs.github.io/docs/plugins/overview#debugging on how to enable logging or debug runtime errors.

Please describe the problem you're trying to solve

Some plugins use external programs to process files. This means they need access to the file’s local path, not a virtual one. Currently, the only way to obtain a local path is to trigger the download command for a virtual file (ya.emit("download", { urls_string })). However, there is no mechanism for a plugin to wait until the download has fully completed. As a result, users must manually trigger the plugin again after the file finishes downloading.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Therefore, I propose the following improvements:

  1. Add a DDS event to notify the plugin when the file download has completed, allowing it to continue processing within the same entry function.

  2. Add a callback mechanism to the download command, for example:
    ya.emit("download", { urls_string, "plugin", "PLUGIN_NAME -- THE_REST_ARGS" }),
    which would automatically trigger the specified plugin after the download finishes.

  3. Add an await-style API, for example:

    local status, local_paths = ya.await("download", { url_string })
    ya.dbg("Files are downloaded, continuing processing...")

Same way to uploading files.

Additional context

No response

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions