feat: add ind-hidden and key-hidden DDS events

This commit is contained in:
IcEarthlight 2026-03-09 02:24:30 +11:00 committed by sxyazi
parent 8932ddd66d
commit 147e727367
No known key found for this signature in database
5 changed files with 25 additions and 5 deletions

View file

@ -50,6 +50,7 @@ impl Actor for Cd {
err!(Pubsub::pub_after_cd(tab.id, tab.cwd()));
act!(mgr:displace, cx)?;
cx.source = yazi_shared::Source::Ind;
act!(mgr:hidden, cx)?;
act!(mgr:sort, cx).ok();
act!(mgr:hover, cx)?;

View file

@ -1,9 +1,10 @@
use anyhow::Result;
use yazi_core::tab::Folder;
use yazi_dds::spark::SparkKind;
use yazi_fs::FolderStage;
use yazi_macro::{act, render, render_and, succ};
use yazi_parser::mgr::HiddenOpt;
use yazi_shared::data::Data;
use yazi_shared::{Source, data::Data};
use crate::{Actor, Ctx};
@ -50,4 +51,12 @@ impl Actor for Hidden {
succ!()
}
fn hook(cx: &Ctx, _: &Self::Options) -> Option<SparkKind> {
match cx.source() {
Source::Ind => Some(SparkKind::IndHidden),
Source::Key => Some(SparkKind::KeyHidden),
_ => None,
}
}
}

View file

@ -5,6 +5,9 @@ pub enum SparkKind {
// app:title
IndAppTitle,
// mgr:hidden
KeyHidden,
IndHidden,
// mgr:sort
KeySort,
IndSort,
@ -27,6 +30,9 @@ impl AsRef<str> for SparkKind {
// app:title
Self::IndAppTitle => "ind-app-title",
// mgr:hidden
Self::KeyHidden => "key-hidden",
Self::IndHidden => "ind-hidden",
// mgr:sort
Self::KeySort => "key-sort",
Self::IndSort => "ind-sort",

View file

@ -161,6 +161,9 @@ impl<'a> Spark<'a> {
// app:title
IndAppTitle => Self::AppTitle(<_>::from_lua(value, lua)?),
// mgr:hidden
KeyHidden => Self::Hidden(<_>::from_lua(value, lua)?),
IndHidden => Self::Hidden(<_>::from_lua(value, lua)?),
// mgr:sort
KeySort => Self::Sort(<_>::from_lua(value, lua)?),
IndSort => Self::Sort(<_>::from_lua(value, lua)?),

View file

@ -1,10 +1,11 @@
use std::str::FromStr;
use mlua::{ExternalError, FromLua, IntoLua, Lua, Value};
use mlua::{FromLua, IntoLua, Lua, LuaSerdeExt, Value};
use serde::{Deserialize, Serialize};
use yazi_binding::SER_OPT;
use yazi_shared::event::ActionCow;
#[derive(Debug, Default)]
#[derive(Debug, Default, Deserialize, Serialize)]
pub struct HiddenOpt {
pub state: HiddenOptState,
}
@ -18,11 +19,11 @@ impl TryFrom<ActionCow> for HiddenOpt {
}
impl FromLua for HiddenOpt {
fn from_lua(_: Value, _: &Lua) -> mlua::Result<Self> { Err("unsupported".into_lua_err()) }
fn from_lua(value: Value, lua: &Lua) -> mlua::Result<Self> { lua.from_value(value) }
}
impl IntoLua for HiddenOpt {
fn into_lua(self, _: &Lua) -> mlua::Result<Value> { Err("unsupported".into_lua_err()) }
fn into_lua(self, lua: &Lua) -> mlua::Result<Value> { lua.to_value_with(&self, SER_OPT) }
}
// --- State