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

Add "linktoexec" as a "is" condition #1518

Closed
1 of 3 tasks
PoisonFrog opened this issue Aug 18, 2024 · 2 comments
Closed
1 of 3 tasks

Add "linktoexec" as a "is" condition #1518

PoisonFrog opened this issue Aug 18, 2024 · 2 comments
Labels
invalid This doesn't seem right

Comments

@PoisonFrog
Copy link

PoisonFrog commented Aug 18, 2024

yazi --debug output

Yazi
    Version: 0.3.1 (Arch Linux 2024-08-17)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.1 (Arch Linux 2024-08-17)

Emulator
    Emulator.via_env: ("xterm-kitty", "")
    Emulator.via_csi: Ok(Kitty)
    Emulator.detect : Kitty

Adapter
    Adapter.matches: Kitty

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

SSH
    shared.in_ssh_connection: false

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

Variables
    SHELL              : Some("/usr/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       : 3.4
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : 2.9.6
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-36
    fzf              : 0.54.3
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : 1.14.2
    zoxide           : 0.9.4
    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

Right now with Yazi we can color files that link to an executable with the same color as a regular executable or the same color of a regular link. I'm trying to emulate the theme I had in ranger with symlinks being cyan, executables being bold green, and symlinks that are linking to an executable are bold cyan to differentiate them from a regular executable or link. Unfortunately this is not possible in Yazi right now.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

I think a good solution would be to create an is condition called linktoexec or something like that so people that want to differentiate their symlinks that link to an executable from a regular link or executable can do that.

Additional context

No response

Validations

  • I have searched the existing issues
  • The latest nightly build of Yazi doesn't already have this feature
@PoisonFrog PoisonFrog added the feature New feature request label Aug 18, 2024
@sxyazi
Copy link
Owner

sxyazi commented Aug 19, 2024

It's totally possible; you just need to override the Entity.style method and layer on any conditions you want, like this:

local old_style = Entity.style
Entity.style = function(self)
  local cha, sty = self._file.cha, old_style(self)
  if sty and cha.is_link and cha.is_exec and not cha.is_dir then
    sty:patch(ui.Style():bold():fg("cyan"))
  end
  return sty
end

screenshot-001970


BTW I plan to redesign the filetype handling in Yazi v0.4, similar to how icons work, using cond instead of is. When that's done, you'll be able to achieve this in toml as well.

@sxyazi sxyazi closed this as completed Aug 19, 2024
@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
@sxyazi sxyazi added invalid This doesn't seem right and removed feature New feature request labels Aug 19, 2024
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 Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants