Skip to content

Control over shortcut manager in desktop apps #4402

Open
@cortesi

Description

@cortesi

Feature Request

Desktop apps always create an instance of the shortcut registry, which in turn creates an instance of global_hotkey::GlobalHotkeyManager.

shortcut_manager: ShortcutRegistry::new(),

impl ShortcutRegistry {
pub fn new() -> Self {
Self {
manager: GlobalHotKeyManager::new().unwrap(),
shortcuts: RefCell::new(HashMap::new()),
}
}

These must run on the main thread, and only one of them can exist at a time. Creating another from within your app causes a crash (and even if it didn't, would cause conflicts). I would like to be able to optionally disable the shortcut manager for desktop apps to take control of this entirely myself. At the moment the way to work around this is to run a separate hotkey manager in a separate process, which becomes a bit cumbersome.

The use case for this is an app I'm writing that acts as a modal global hotkey manager. The core of this application is built around managing a global_hotkey instance to overlay/clear shortcut modes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions