diff --git a/yazi-config/src/manager/manager.rs b/yazi-config/src/manager/manager.rs index 923b7dc1..42e0171d 100644 --- a/yazi-config/src/manager/manager.rs +++ b/yazi-config/src/manager/manager.rs @@ -26,6 +26,10 @@ pub struct Manager { pub scrolloff: u8, pub mouse_events: MouseEvents, pub title_format: String, + + // TODO: remove this in Yazi 0.4.2 + #[serde(default)] + pub _v4_suppress_deprecation_warnings: bool, } impl FromStr for Manager { diff --git a/yazi-plugin/src/bindings/cha.rs b/yazi-plugin/src/bindings/cha.rs index b67c3248..de1b2bc8 100644 --- a/yazi-plugin/src/bindings/cha.rs +++ b/yazi-plugin/src/bindings/cha.rs @@ -18,10 +18,9 @@ impl> From for Cha { fn from(cha: T) -> Self { Self(cha.into()) } } -static WARNED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); - #[inline] fn warn_deprecated(id: Option<&str>) { + static WARNED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); if !WARNED.swap(true, std::sync::atomic::Ordering::Relaxed) { let id = match id { Some(id) => format!("`{id}.yazi` plugin"), diff --git a/yazi-proxy/src/app.rs b/yazi-proxy/src/app.rs index bef61e18..83302bbd 100644 --- a/yazi-proxy/src/app.rs +++ b/yazi-proxy/src/app.rs @@ -1,6 +1,7 @@ use std::time::Duration; use tokio::sync::oneshot; +use yazi_config::MANAGER; use yazi_macro::emit; use yazi_shared::{Layer, event::Cmd}; @@ -23,6 +24,10 @@ impl AppProxy { #[inline] pub fn notify(opt: NotifyOpt) { + if MANAGER._v4_suppress_deprecation_warnings && opt.title.contains("Deprecated") { + return; + } + emit!(Call(Cmd::new("notify").with_any("option", opt), Layer::App)); }