Skip to content

Icons priority #3681

@og900aero

Description

@og900aero

yazi --debug output

Yazi
    Version: 26.2.2 (0aeeb3b0 2026-02-08)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.93.0 (254b5960 2026-01-19)

Ya
    Version: 26.1.22 (4e0acf8 2026-01-22)

Config
    Init             : /home/shyciii/.config/yazi/init.lua (4592 chars)
    Yazi             : /home/shyciii/.config/yazi/yazi.toml (4372 chars)
    Keymap           : /home/shyciii/.config/yazi/keymap.toml (10813 chars)
    Theme            : /home/shyciii/.config/yazi/theme.toml (37362 chars)
    VFS              : /home/shyciii/.config/yazi/vfs.toml (No such file or directory (os error 2))
    Package          : /home/shyciii/.config/yazi/package.toml (1071 chars)
    Dark/light flavor: "" / ""

Emulator
    TERM                : Some("foot")
    TERM_PROGRAM        : None
    TERM_PROGRAM_VERSION: None
    Brand.from_env      : Some(Foot)
    Emulator.detect     : Emulator { kind: Left(Foot), version: "foot(1.25.0)", light: false, csi_16t: (9, 22), force_16t: false }

Adapter
    Adapter.matches    : Sixel
    Dimension.available: Dimension { rows: 53, columns: 213, width: 1917, height: 1166 }

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

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/bin/bash")
    EDITOR             : Some("micro")
    VISUAL             : Some("micro")
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None
    YAZI_ZOXIDE_OPTS   : None
    SSH_AUTH_SOCK      : None
    FZF_DEFAULT_OPTS   : Some("--exact --color=fg:#f8f8f2,hl:#bd93f9 --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4")
    FZF_DEFAULT_COMMAND: Some("find . -type f")

Text Opener
    default     : Some(OpenerRule { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "Text editor", for: None, spread: true })
    block-create: Some(OpenerRule { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "Text editor", for: None, spread: true })
    block-rename: Some(OpenerRule { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "Text editor", for: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : 3.7
    tmux build flags   : enable-sixel=Unsupported
    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: 7.1.3-0 / 7.1.3-0
    pdftoppm      : 25.03.0
    magick        : 7.1.1-43
    fzf           : 0.67.0
    fd/fdfind     : No such file or directory (os error 2) / 10.2.0
    rg            : 14.1.1
    chafa         : 1.18.0
    zoxide        : 0.9.7
    7zz/7z        : No such file or directory (os error 2) / 25.01
    resvg         : No such file or directory (os error 2)
    jq            : 1.7

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

Please describe the problem you're trying to solve

In the filetype section, priority is determined based on the order of the rules. This is a good solution.
However, in the icon section, there is a fixed priority:

globs: glob expressions, e.g., { url = "**/Downloads/*.zip", ... }
dirs: directory names, e.g., { name = "Desktop", ... }
files: file names, e.g., { name = ".bashrc", ... }
exts: extensions, e.g., { name = "mp3", ... }
conds: conditions, e.g., { if = "!dir", ... }

The problem with this is that quite a few options are impossible to solve. For example, I assign a separate icon to the sh extension. This is activated with 4th priority. If I want to set it so that every file that gets execution rights gets the same icon regardless of the extension, then that can't be solved because the cond section has priority 5. However, there are vital elements in the cond section that I think should have higher priority (link, orphan, sock, exec, etc.). .

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

I think it would be worth solving this problem so that the priority is not fixed, but rather follows the order of globs, dirs, files, exts, cons under the [icon] section, so if someone enters it in this order in theme.toml:
globs: glob expressions, e.g., { url = "**/Downloads/*.zip", ... }
conds: conditions, e.g., { if = "!dir", ... }
files: file names, e.g., { name = ".bashrc", ... }
dirs: directory names, e.g., { name = "Desktop", ... }
exts: extensions, e.g., { name = "mp3", ...

Then the priority order should also be the same.

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