Trait tauri::GlobalShortcutManager
pub trait GlobalShortcutManager: Debug {
fn is_registered(&self, accelerator: &str) -> Result<bool, Error>;
fn register<F>(
&mut self,
accelerator: &str,
handler: F
) -> Result<(), Error>
where
F: 'static + Fn() + Send;
fn unregister_all(&mut self) -> Result<(), Error>;
fn unregister(&mut self, accelerator: &str) -> Result<(), Error>;
}
Expand description
A global shortcut manager.
#
Required methodsis_registered(&self, accelerator: &str) -> Result<bool, Error>#
fnWhether the application has registered the given accelerator
.
#
Panics- Panics if the event loop is not running yet, usually when called on the
tauri::Builder#setup
closure. - Panics when called on the main thread, usually on the
tauri::App#run
closure.
You can spawn a task to use the API using tauri::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
register<F>(&mut self, accelerator: &str, handler: F) -> Result<(), Error> where F: 'static + Fn() + Send,#
fnRegister a global shortcut of accelerator
.
#
Panics- Panics if the event loop is not running yet, usually when called on the
tauri::Builder#setup
closure. - Panics when called on the main thread, usually on the
tauri::App#run
closure.
You can spawn a task to use the API using tauri::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
unregister_all(&mut self) -> Result<(), Error>#
fnUnregister all accelerators registered by the manager instance.
#
Panics- Panics if the event loop is not running yet, usually when called on the
tauri::Builder#setup
closure. - Panics when called on the main thread, usually on the
tauri::App#run
closure.
You can spawn a task to use the API using tauri::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
unregister(&mut self, accelerator: &str) -> Result<(), Error>#
fnUnregister the provided accelerator
.
#
Panics- Panics if the event loop is not running yet, usually when called on the
tauri::Builder#setup
closure. - Panics when called on the main thread, usually on the
tauri::App#run
closure.
You can spawn a task to use the API using tauri::async_runtime::spawn
or std::thread::spawn
to prevent the panic.