zerolaunch-plugin-api 0.2.1

ZeroLaunch plugin SDK — traits, data types, host API surface.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::host::error::HostApiError;
use crate::services::hotkey::types::{Hotkey, HotkeyCallback, HotkeyEventFilter};
use async_trait::async_trait;

/// 按键管理器 trait,定义平台原语。
#[async_trait]
pub trait HotkeyManager: Send + Sync {
    async fn register_hotkey(&self, hotkey: &Hotkey) -> Result<(), HostApiError>;
    async fn unregister_hotkey(&self, hotkey: &Hotkey) -> Result<(), HostApiError>;
    async fn unregister_all(&self) -> Result<(), HostApiError>;
    async fn set_double_ctrl_enabled(&self, enabled: bool) -> Result<(), HostApiError>;
    async fn start_listening(&self) -> Result<(), HostApiError>;
    async fn stop_listening(&self) -> Result<(), HostApiError>;
    fn is_listening(&self) -> bool;
    fn register_callback(&self, id: &str, filter: HotkeyEventFilter, callback: HotkeyCallback);
    fn unregister_callback(&self, id: &str);
}