yazi/yazi-proxy/src/which.rs
2026-03-31 19:18:18 +08:00

19 lines
448 B
Rust

use tokio::sync::mpsc;
use yazi_config::keymap::ChordCow;
use yazi_core::which::WhichOpt;
use yazi_macro::{emit, relay};
pub struct WhichProxy;
impl WhichProxy {
pub async fn activate(cands: Vec<ChordCow>, silent: bool) -> Option<ChordCow> {
let (tx, mut rx) = mpsc::unbounded_channel();
emit!(Call(relay!(which:activate).with_any("opt", WhichOpt {
tx: Some(tx),
cands,
silent,
times: 0,
})));
Some(rx.recv().await??.0)
}
}