Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass self - table to builtin previewers/preloaders #1653

Closed
2 of 3 tasks
0xkept opened this issue Sep 17, 2024 · 3 comments · Fixed by #1666
Closed
2 of 3 tasks

Pass self - table to builtin previewers/preloaders #1653

0xkept opened this issue Sep 17, 2024 · 3 comments · Fixed by #1666
Assignees
Labels
feature New feature request

Comments

@0xkept
Copy link

0xkept commented Sep 17, 2024

yazi --debug output

Yazi
    Version: 0.3.3 (Arch Linux 2024-09-05)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (Arch Linux 2024-09-05)

Emulator
    Emulator.via_env: ("foot", "")
    Emulator.via_csi: Ok(Foot)
    Emulator.detect : Foot

Adapter
    Adapter.matches: Sixel

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: Some("9a09eac79b85c846e3a865a9078a3f8ff65a9259_1726583606_854248493")
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

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

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

Multiplexers
    TMUX               : false
    tmux version       : No such file or directory (os error 2)
    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.3
    magick           : No such file or directory (os error 2)
    fzf              : 0.55.0
    fd               : 10.2.0
    rg               : 14.1.1
    chafa            : No such file or directory (os error 2)
    zoxide           : 0.9.5
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1


--------------------------------------------------

Please describe the problem you're trying to solve

The current builtin preview/preloader plugin logic does not allow passing the self table -- provided when defining custom preloaders/previewers. The use case is the ability to add a condition to the preloaders/previewers while still using the builtin lua modules.

local function(self)
  if condition then return 1 end
  return require("image").preload(self) and 1 or 2
end
return { preload = preload }

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Ability to pass self table to builtin preloaders/previewers

Additional context

No response

Validations

  • I have searched the existing issues
  • The latest nightly build of Yazi doesn't already have this feature
@sxyazi
Copy link
Owner

sxyazi commented Sep 20, 2024

Please try #1666

@0xkept
Copy link
Author

0xkept commented Sep 20, 2024

Please try #1666

Based on initial testing, seems to work perfectly. 🎉

Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request
Projects
None yet
2 participants