Function tauri_wasm::plugin::global_shortcut::register

source ·
pub async fn register(shortcut: &str) -> Result<impl Stream<Item = ()>>
Expand description

Register a global shortcut.

The returned Future will automatically clean up it’s underlying event listener when dropped, so no manual unlisten function needs to be called.

§Examples

use tauri_sys::global_shortcut::register;
use web_sys::console;

let events = register("CommandOrControl+Shift+C").await?;

while let Some(_) in events.next().await {
    console::log_1(&"Shortcut triggered".into());
}