diff --git a/yazi-config/src/headsup/headsup.rs b/yazi-config/src/headsup/headsup.rs deleted file mode 100644 index 062725fa..00000000 --- a/yazi-config/src/headsup/headsup.rs +++ /dev/null @@ -1,34 +0,0 @@ -use serde::{Deserialize, Deserializer}; - -use crate::MERGED_YAZI; - -#[derive(Debug)] -pub struct Headsup { - // TODO: remove this once Yazi 0.3 is released -- - pub disable_exec_warn: bool, -} - -impl Default for Headsup { - fn default() -> Self { toml::from_str(&MERGED_YAZI).unwrap() } -} - -impl<'de> Deserialize<'de> for Headsup { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - #[derive(Deserialize)] - struct Outer { - headsup: Shadow, - } - #[derive(Deserialize)] - struct Shadow { - #[serde(default)] - disable_exec_warn: bool, - } - - let outer = Outer::deserialize(deserializer)?; - - Ok(Self { disable_exec_warn: outer.headsup.disable_exec_warn }) - } -} diff --git a/yazi-config/src/headsup/mod.rs b/yazi-config/src/headsup/mod.rs deleted file mode 100644 index 82e85f0a..00000000 --- a/yazi-config/src/headsup/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod headsup; - -pub use headsup::*; diff --git a/yazi-config/src/keymap/control.rs b/yazi-config/src/keymap/control.rs index adbfb626..5ad84928 100644 --- a/yazi-config/src/keymap/control.rs +++ b/yazi-config/src/keymap/control.rs @@ -1,14 +1,14 @@ -use std::{borrow::Cow, collections::VecDeque, sync::atomic::Ordering}; +use std::{borrow::Cow, collections::VecDeque}; -use serde::{Deserialize, Deserializer}; +use serde::Deserialize; use yazi_shared::event::Cmd; use super::Key; -use crate::DEPRECATED_EXEC; -#[derive(Debug, Default)] +#[derive(Debug, Default, Deserialize)] pub struct Control { pub on: Vec, + #[serde(deserialize_with = "super::run_deserialize")] pub run: Vec, pub desc: Option, } @@ -40,33 +40,3 @@ impl Control { || self.on().to_lowercase().contains(&s) } } - -// TODO: remove this once Yazi 0.3 is released -impl<'de> Deserialize<'de> for Control { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - #[derive(Deserialize)] - pub struct Shadow { - pub on: Vec, - pub run: Option, - pub exec: Option, - pub desc: Option, - } - - let shadow = Shadow::deserialize(deserializer)?; - - #[derive(Deserialize)] - struct VecCmd(#[serde(deserialize_with = "super::run_deserialize")] Vec); - - if shadow.exec.is_some() { - DEPRECATED_EXEC.store(true, Ordering::Relaxed); - } - let Some(run) = shadow.run.or(shadow.exec) else { - return Err(serde::de::Error::custom("missing field `run` within `[keymap]`")); - }; - - Ok(Self { on: shadow.on, run: run.0, desc: shadow.desc }) - } -} diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index 5b6b0798..513f88fb 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -2,7 +2,6 @@ use yazi_shared::{RoCell, Xdg}; -pub mod headsup; pub mod keymap; mod layout; mod log; @@ -24,17 +23,12 @@ pub(crate) use pattern::*; pub(crate) use preset::*; pub use priority::*; -// TODO: remove this once Yazi 0.3 is released -- -pub static DEPRECATED_EXEC: std::sync::atomic::AtomicBool = - std::sync::atomic::AtomicBool::new(false); - static MERGED_YAZI: RoCell = RoCell::new(); static MERGED_KEYMAP: RoCell = RoCell::new(); static MERGED_THEME: RoCell = RoCell::new(); pub static LAYOUT: RoCell> = RoCell::new(); -pub static HEADSUP: RoCell = RoCell::new(); pub static KEYMAP: RoCell = RoCell::new(); pub static LOG: RoCell = RoCell::new(); pub static MANAGER: RoCell = RoCell::new(); @@ -55,7 +49,6 @@ pub fn init() -> anyhow::Result<()> { LAYOUT.with(Default::default); - HEADSUP.with(Default::default); KEYMAP.with(Default::default); LOG.with(Default::default); MANAGER.with(Default::default); @@ -68,18 +61,5 @@ pub fn init() -> anyhow::Result<()> { SELECT.with(Default::default); WHICH.with(Default::default); - // TODO: remove this once Yazi 0.3 is released -- - if !HEADSUP.disable_exec_warn && DEPRECATED_EXEC.load(std::sync::atomic::Ordering::Relaxed) { - eprintln!( - r#" -WARNING: `exec` will be deprecated in the next major version v0.3 and replaced by `run`. - -Please replace all `exec = ...` with `run = ...`, in your `yazi.toml` and `keymap.toml`. - ---- -Add `disable_exec_warn = true` to your `yazi.toml` under `[headsup]` to suppress this warning. -"# - ); - } Ok(()) } diff --git a/yazi-config/src/open/opener.rs b/yazi-config/src/open/opener.rs index 40409c7b..9d298eb8 100644 --- a/yazi-config/src/open/opener.rs +++ b/yazi-config/src/open/opener.rs @@ -1,9 +1,5 @@ -use std::sync::atomic::Ordering; - use serde::{Deserialize, Deserializer}; -use crate::DEPRECATED_EXEC; - #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Opener { pub run: String, @@ -36,9 +32,7 @@ impl<'de> Deserialize<'de> for Opener { { #[derive(Deserialize)] pub struct Shadow { - run: Option, - // TODO: remove this once Yazi 0.3 is released -- - exec: Option, + run: String, #[serde(default)] block: bool, #[serde(default)] @@ -50,13 +44,7 @@ impl<'de> Deserialize<'de> for Opener { let shadow = Shadow::deserialize(deserializer)?; - // TODO: remove this once Yazi 0.3 is released -- - if shadow.exec.is_some() { - DEPRECATED_EXEC.store(true, Ordering::Relaxed); - } - let run = shadow.run.or(shadow.exec).unwrap_or_default(); - // TODO: -- remove this once Yazi 0.3 is released - + let run = shadow.run; if run.is_empty() { return Err(serde::de::Error::custom("`run` cannot be empty")); } diff --git a/yazi-config/src/plugin/props.rs b/yazi-config/src/plugin/props.rs index 410bb73f..91035c60 100644 --- a/yazi-config/src/plugin/props.rs +++ b/yazi-config/src/plugin/props.rs @@ -11,6 +11,6 @@ pub struct PluginProps { impl From<&PluginRule> for PluginProps { fn from(rule: &PluginRule) -> Self { - Self { id: rule.id, name: rule.cmd.name.to_owned(), multi: rule.multi, prio: rule.prio } + Self { id: rule.id, name: rule.run.name.to_owned(), multi: rule.multi, prio: rule.prio } } } diff --git a/yazi-config/src/plugin/rule.rs b/yazi-config/src/plugin/rule.rs index 57c223f5..b08c20e4 100644 --- a/yazi-config/src/plugin/rule.rs +++ b/yazi-config/src/plugin/rule.rs @@ -1,19 +1,22 @@ -use std::sync::atomic::Ordering; - -use serde::{Deserialize, Deserializer}; +use serde::Deserialize; use yazi_shared::{event::Cmd, Condition}; -use crate::{Pattern, Priority, DEPRECATED_EXEC}; +use crate::{Pattern, Priority}; -#[derive(Debug)] +#[derive(Debug, Deserialize)] pub struct PluginRule { + #[serde(skip)] pub id: u8, pub cond: Option, pub name: Option, pub mime: Option, - pub cmd: Cmd, + #[serde(deserialize_with = "super::run_deserialize")] + pub run: Cmd, + #[serde(default)] pub sync: bool, + #[serde(default)] pub multi: bool, + #[serde(default)] pub prio: Priority, } @@ -24,51 +27,3 @@ impl PluginRule { #[inline] pub fn any_dir(&self) -> bool { self.name.as_ref().is_some_and(|p| p.any_dir()) } } - -// TODO: remove this once Yazi 0.3 is released -impl<'de> Deserialize<'de> for PluginRule { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - #[derive(Deserialize)] - pub struct Shadow { - #[serde(default)] - pub id: u8, - pub cond: Option, - pub name: Option, - pub mime: Option, - pub run: Option, - pub exec: Option, - #[serde(default)] - pub sync: bool, - #[serde(default)] - pub multi: bool, - #[serde(default)] - pub prio: Priority, - } - - let shadow = Shadow::deserialize(deserializer)?; - - #[derive(Deserialize)] - struct WrappedCmd(#[serde(deserialize_with = "super::run_deserialize")] Cmd); - - if shadow.exec.is_some() { - DEPRECATED_EXEC.store(true, Ordering::Relaxed); - } - let Some(run) = shadow.run.or(shadow.exec) else { - return Err(serde::de::Error::custom("missing field `run` within `[plugin]`")); - }; - - Ok(Self { - id: shadow.id, - cond: shadow.cond, - name: shadow.name, - mime: shadow.mime, - cmd: run.0, - sync: shadow.sync, - multi: shadow.multi, - prio: shadow.prio, - }) - } -} diff --git a/yazi-core/src/manager/commands/seek.rs b/yazi-core/src/manager/commands/seek.rs index a80c57c2..5beb7a17 100644 --- a/yazi-core/src/manager/commands/seek.rs +++ b/yazi-core/src/manager/commands/seek.rs @@ -32,6 +32,6 @@ impl Manager { }; let opt = opt.into() as Opt; - isolate::seek_sync(&previewer.cmd, hovered.clone(), opt.units); + isolate::seek_sync(&previewer.run, hovered.clone(), opt.units); } } diff --git a/yazi-core/src/tab/commands/jump.rs b/yazi-core/src/tab/commands/jump.rs deleted file mode 100644 index 810abbbf..00000000 --- a/yazi-core/src/tab/commands/jump.rs +++ /dev/null @@ -1,55 +0,0 @@ -use std::time::Duration; - -use yazi_proxy::{options::{NotifyLevel, NotifyOpt}, AppProxy}; -use yazi_shared::{emit, event::Cmd, Layer}; - -use crate::tab::Tab; - -pub struct Opt { - type_: OptType, -} - -#[derive(PartialEq, Eq)] -pub enum OptType { - None, - Fzf, - Zoxide, -} - -impl From for Opt { - fn from(mut c: Cmd) -> Self { - Self { - type_: match c.take_first_str().as_deref() { - Some("fzf") => OptType::Fzf, - Some("zoxide") => OptType::Zoxide, - _ => OptType::None, - }, - } - } -} - -impl Tab { - // TODO: Remove this once Yazi v0.2.7 is released - pub fn jump(&self, opt: impl Into) { - AppProxy::notify(NotifyOpt { - title: "Jump".to_owned(), - content: r#"The `jump` command has been deprecated in Yazi v0.2.5. -Please replace `jump fzf` with `plugin fzf`, and `jump zoxide` with `plugin zoxide`, in your `keymap.toml`. - -See https://github.com/sxyazi/yazi/issues/865 for more details."#.to_owned(), - level: NotifyLevel::Warn, - timeout: Duration::from_secs(15), - }); - - let opt = opt.into() as Opt; - if opt.type_ == OptType::None { - return; - } - - if opt.type_ == OptType::Fzf { - emit!(Call(Cmd::args("plugin", vec!["fzf".to_owned()]), Layer::App)); - } else { - emit!(Call(Cmd::args("plugin", vec!["zoxide".to_owned()]), Layer::App)); - } - } -} diff --git a/yazi-core/src/tab/commands/mod.rs b/yazi-core/src/tab/commands/mod.rs index 8f0c6467..87f2fde6 100644 --- a/yazi-core/src/tab/commands/mod.rs +++ b/yazi-core/src/tab/commands/mod.rs @@ -8,7 +8,6 @@ mod filter; mod find; mod forward; mod hidden; -mod jump; mod leave; mod linemode; mod preview; diff --git a/yazi-core/src/tab/preview.rs b/yazi-core/src/tab/preview.rs index 0b7b560e..d5c8db7b 100644 --- a/yazi-core/src/tab/preview.rs +++ b/yazi-core/src/tab/preview.rs @@ -32,9 +32,9 @@ impl Preview { self.abort(); if previewer.sync { - isolate::peek_sync(&previewer.cmd, file, self.skip); + isolate::peek_sync(&previewer.run, file, self.skip); } else { - self.previewer_ct = Some(isolate::peek(&previewer.cmd, file, self.skip)); + self.previewer_ct = Some(isolate::peek(&previewer.run, file, self.skip)); } } diff --git a/yazi-fm/src/executor.rs b/yazi-fm/src/executor.rs index 2da363c9..e16c6f72 100644 --- a/yazi-fm/src/executor.rs +++ b/yazi-fm/src/executor.rs @@ -108,7 +108,6 @@ impl<'a> Executor<'a> { on!(ACTIVE, hidden); on!(ACTIVE, linemode); on!(ACTIVE, search); - on!(ACTIVE, jump); // Filter on!(ACTIVE, filter); diff --git a/yazi-plugin/preset/components/header.lua b/yazi-plugin/preset/components/header.lua index 72cffa03..b22eed20 100644 --- a/yazi-plugin/preset/components/header.lua +++ b/yazi-plugin/preset/components/header.lua @@ -56,26 +56,6 @@ function Header:tabs() return ui.Line(spans) end --- TODO: remove this function after v0.2.5 release -function Header:layout(area) - if not ya.deprecated_header_layout then - ya.deprecated_header_layout = true - ya.notify { - title = "Deprecated API", - content = "`Header:layout()` is deprecated, please apply the latest `Header:render()` in your `init.lua`", - timeout = 5, - level = "warn", - } - end - - self.area = area - - return ui.Layout() - :direction(ui.Layout.HORIZONTAL) - :constraints({ ui.Constraint.Percentage(50), ui.Constraint.Percentage(50) }) - :split(area) -end - function Header:render(area) self.area = area diff --git a/yazi-scheduler/src/scheduler.rs b/yazi-scheduler/src/scheduler.rs index db83c69c..f51186b6 100644 --- a/yazi-scheduler/src/scheduler.rs +++ b/yazi-scheduler/src/scheduler.rs @@ -221,7 +221,7 @@ impl Scheduler { pub fn preload_paged(&self, rule: &PluginRule, targets: Vec<&yazi_shared::fs::File>) { let id = self.ongoing.lock().add( TaskKind::Preload, - format!("Run preloader `{}` with {} target(s)", rule.cmd.name, targets.len()), + format!("Run preloader `{}` with {} target(s)", rule.run.name, targets.len()), ); let plugin = rule.into();