tauri-apps/global-hotkey

Control the scope of global hotkeys

Closed this issue · 1 comments

I'd like to grab a hotkey only when the Tauri window is focused and within the window, not globally. But seems there's no way to implement it.

If I register Ctrl + S as a global hotkey, then it will fail everywhere I want to use hotkey Ctrl + S to save something.

Technically, registering a hotkey using JavaScript can restrict the hotkey within the Tauri WebView window, but what if I want to register hotkeys like Ctrl + S and F5? This will be an invalid way.

I'd like to have a choice to choose whether a hotkey should be GLOBALLY or WINDOW FOCUSED ONLY caught. Thanks :)

This is out of the scope of this crate, global hotkeys are global and cannot be scoped at all, doing it in javascript is probably the best way right now, or when we add keyboard events to this enum https://docs.rs/tauri/latest/tauri/enum.WindowEvent.html in the future.