Skip to main content

KeyboardHook

Trait KeyboardHook 

Source
pub trait KeyboardHook: Send + Sync {
    // Provided methods
    fn on_key_pressed(&mut self, _key: &KeyEvent) -> KeyboardHookResult { ... }
    fn on_key_combo(&mut self, _combo: &KeyCombo) -> KeyboardHookResult { ... }
}
Expand description

Hook for intercepting keyboard events.

Provided Methods§

Source

fn on_key_pressed(&mut self, _key: &KeyEvent) -> KeyboardHookResult

Called when a key is pressed.

Return KeyboardHookResult::Handled to prevent the default handler.

Source

fn on_key_combo(&mut self, _combo: &KeyCombo) -> KeyboardHookResult

Called when a key combination is pressed (e.g., Ctrl+S).

Implementors§