From b53a1b2ea765562c60bfc25a64fdd8c57ade8245 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 4 Jul 2026 21:12:45 +0200 Subject: [PATCH] feat: add `show_icons` option to disable input popup icons The icon shown on cd/create/rename/shell input popups (added in #4080) had no way to opt out short of clearing all icon rules, which would also remove file-type icons everywhere else. Add a `show_icons` option under `[input]`, enabled by default, that short-circuits the icon lookup for input popups specifically. Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 2 ++ yazi-config/preset/yazi-default.toml | 1 + yazi-config/src/popup/input.rs | 1 + yazi-fm/src/input/input.rs | 6 +++++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e73c2a7..7187fe0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): - Make help menu a command palette ([#4074]) - H/M/L Vim-like motion for moving cursor relative to viewport ([#3970]) - Context-aware icons for inputs ([#4080]) +- New `show_icons` option under `[input]` to toggle icons on input popups ([#4100]) - Show file icons in trash/delete/overwrite confirmations ([#4096]) - Dynamic keymap Lua API ([#4031]) - New `ui.Input` element ([#4040]) @@ -1768,3 +1769,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): [#4074]: https://github.com/sxyazi/yazi/pull/4074 [#4080]: https://github.com/sxyazi/yazi/pull/4080 [#4096]: https://github.com/sxyazi/yazi/pull/4096 +[#4100]: https://github.com/sxyazi/yazi/pull/4100 diff --git a/yazi-config/preset/yazi-default.toml b/yazi-config/preset/yazi-default.toml index 1fc65c7f..feb359c4 100644 --- a/yazi-config/preset/yazi-default.toml +++ b/yazi-config/preset/yazi-default.toml @@ -176,6 +176,7 @@ previewers = [ [input] cursor_blink = false +show_icons = true # cd cd_title = "Change directory:" diff --git a/yazi-config/src/popup/input.rs b/yazi-config/src/popup/input.rs index 83045faa..876f7064 100644 --- a/yazi-config/src/popup/input.rs +++ b/yazi-config/src/popup/input.rs @@ -7,6 +7,7 @@ use yazi_widgets::input::InputOpt; #[derive(Deserialize, DeserializeOver, DeserializeOver2)] pub struct Input { pub cursor_blink: bool, + pub show_icons: bool, // cd pub cd_title: String, diff --git a/yazi-fm/src/input/input.rs b/yazi-fm/src/input/input.rs index 5c71cc12..d86e0c36 100644 --- a/yazi-fm/src/input/input.rs +++ b/yazi-fm/src/input/input.rs @@ -2,7 +2,7 @@ use std::path::Path; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, text::Line, widgets::Widget}; use ratatui_widgets::{block::Block, borders::BorderType}; -use yazi_config::{Icon, THEME}; +use yazi_config::{Icon, THEME, YAZI}; use yazi_core::Core; use yazi_fs::{cha::{Cha, ChaKind}, file::File}; use yazi_shim::path::CROSS_SEPARATOR; @@ -15,6 +15,10 @@ impl<'a> Input<'a> { pub(crate) fn new(core: &'a Core) -> Self { Self { core } } fn icon(&self) -> Option { + if !YAZI.input.show_icons { + return None; + } + let input = &self.core.input.main; let is_dir = input.value().ends_with(CROSS_SEPARATOR);