From baa1c43d6709e0afebd45153bef7b9a2af411470 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 5 Mar 2024 16:29:09 +0800 Subject: [PATCH] .. --- yazi-plugin/src/utils/layer.rs | 10 ++++++++-- yazi-proxy/src/options/notify.rs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/yazi-plugin/src/utils/layer.rs b/yazi-plugin/src/utils/layer.rs index 3f70ff9e..90bff80a 100644 --- a/yazi-plugin/src/utils/layer.rs +++ b/yazi-plugin/src/utils/layer.rs @@ -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(()) } diff --git a/yazi-proxy/src/options/notify.rs b/yazi-proxy/src/options/notify.rs index c99e047d..bc4f860a 100644 --- a/yazi-proxy/src/options/notify.rs +++ b/yazi-proxy/src/options/notify.rs @@ -23,7 +23,7 @@ impl<'a> TryFrom> for NotifyOpt { fn try_from(t: mlua::Table) -> Result { 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 {