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 <noreply@anthropic.com>
This commit is contained in:
greg 2026-07-04 21:12:45 +02:00
parent d6af2ebf80
commit b53a1b2ea7
4 changed files with 9 additions and 1 deletions

View file

@ -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]) - Make help menu a command palette ([#4074])
- H/M/L Vim-like motion for moving cursor relative to viewport ([#3970]) - H/M/L Vim-like motion for moving cursor relative to viewport ([#3970])
- Context-aware icons for inputs ([#4080]) - 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]) - Show file icons in trash/delete/overwrite confirmations ([#4096])
- Dynamic keymap Lua API ([#4031]) - Dynamic keymap Lua API ([#4031])
- New `ui.Input` element ([#4040]) - 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 [#4074]: https://github.com/sxyazi/yazi/pull/4074
[#4080]: https://github.com/sxyazi/yazi/pull/4080 [#4080]: https://github.com/sxyazi/yazi/pull/4080
[#4096]: https://github.com/sxyazi/yazi/pull/4096 [#4096]: https://github.com/sxyazi/yazi/pull/4096
[#4100]: https://github.com/sxyazi/yazi/pull/4100

View file

@ -176,6 +176,7 @@ previewers = [
[input] [input]
cursor_blink = false cursor_blink = false
show_icons = true
# cd # cd
cd_title = "Change directory:" cd_title = "Change directory:"

View file

@ -7,6 +7,7 @@ use yazi_widgets::input::InputOpt;
#[derive(Deserialize, DeserializeOver, DeserializeOver2)] #[derive(Deserialize, DeserializeOver, DeserializeOver2)]
pub struct Input { pub struct Input {
pub cursor_blink: bool, pub cursor_blink: bool,
pub show_icons: bool,
// cd // cd
pub cd_title: String, pub cd_title: String,

View file

@ -2,7 +2,7 @@ use std::path::Path;
use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, text::Line, widgets::Widget}; use ratatui_core::{buffer::Buffer, layout::{Margin, Rect}, text::Line, widgets::Widget};
use ratatui_widgets::{block::Block, borders::BorderType}; use ratatui_widgets::{block::Block, borders::BorderType};
use yazi_config::{Icon, THEME}; use yazi_config::{Icon, THEME, YAZI};
use yazi_core::Core; use yazi_core::Core;
use yazi_fs::{cha::{Cha, ChaKind}, file::File}; use yazi_fs::{cha::{Cha, ChaKind}, file::File};
use yazi_shim::path::CROSS_SEPARATOR; use yazi_shim::path::CROSS_SEPARATOR;
@ -15,6 +15,10 @@ impl<'a> Input<'a> {
pub(crate) fn new(core: &'a Core) -> Self { Self { core } } pub(crate) fn new(core: &'a Core) -> Self { Self { core } }
fn icon(&self) -> Option<Icon> { fn icon(&self) -> Option<Icon> {
if !YAZI.input.show_icons {
return None;
}
let input = &self.core.input.main; let input = &self.core.input.main;
let is_dir = input.value().ends_with(CROSS_SEPARATOR); let is_dir = input.value().ends_with(CROSS_SEPARATOR);