This commit is contained in:
sxyazi 2024-03-05 16:29:09 +08:00
parent 4631d20bc0
commit baa1c43d67
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View file

@ -3,7 +3,7 @@ use std::str::FromStr;
use mlua::{ExternalError, ExternalResult, IntoLuaMulti, Lua, Table, Value};
use tokio::sync::mpsc;
use yazi_config::{keymap::{Control, Key}, popup::InputCfg};
use yazi_proxy::InputProxy;
use yazi_proxy::{AppProxy, InputProxy};
use yazi_shared::{emit, event::Cmd, Layer};
use super::Utils;
@ -79,7 +79,13 @@ impl Utils {
})?,
)?;
ya.raw_set("notify", lua.create_function(|lua, t: Table| Ok(()))?)?;
ya.raw_set(
"notify",
lua.create_function(|_, t: Table| {
AppProxy::notify(t.try_into()?);
Ok(())
})?,
)?;
Ok(())
}

View file

@ -23,7 +23,7 @@ impl<'a> TryFrom<mlua::Table<'a>> for NotifyOpt {
fn try_from(t: mlua::Table) -> Result<Self, Self::Error> {
let timeout = t.raw_get::<_, f64>("timeout")?;
if timeout < 0.0 {
return Err("invalid timeout".into_lua_err());
return Err("timeout must be non-negative".into_lua_err());
}
Ok(Self {