Skip to main content

GlobalShortcutService

Trait GlobalShortcutService 

Source
pub trait GlobalShortcutService:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn register<'life0, 'async_trait>(
        &'life0 self,
        shortcut: Shortcut,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unregister<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Registers global shortcuts.

The host reports a press as a typed event (ARCHITECTURE.md rule 9), never as a callback the product registers by string. A headless or CLI build gets a no-op.

Required Methods§

Source

fn register<'life0, 'async_trait>( &'life0 self, shortcut: Shortcut, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Register shortcut, or replace an existing one with the same id.

Source

fn unregister<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unregister by id. Unregistering an unknown id succeeds.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§