@tauri-apps/plugin-global-shortcut
Register global shortcuts.
Interfaces
ShortcutEvent
Properties
Property | Type | Defined in |
---|---|---|
id | number | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/global-shortcut/guest-js/index.ts#L15 |
shortcut | string | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/global-shortcut/guest-js/index.ts#L14 |
state | "Released" | "Pressed" | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/global-shortcut/guest-js/index.ts#L16 |
Type Aliases
ShortcutHandler()
Parameters
Parameter | Type |
---|---|
event | ShortcutEvent |
Returns
void
Functions
isRegistered()
Determines whether the given shortcut is registered by this application or not.
If the shortcut is registered by another application, it will still return false
.
Parameters
Parameter | Type | Description |
---|---|---|
shortcut | string | shortcut definition, modifiers and key separated by ”+” e.g. CmdOrControl+Q |
Returns
Promise
<boolean
>
Example
Since
2.0.0
register()
Register a global shortcut or a list of shortcuts.
The handler is called when any of the registered shortcuts are pressed by the user.
If the shortcut is already taken by another application, the handler will not be triggered. Make sure the shortcut is as unique as possible while still taking user experience into consideration.
Parameters
Parameter | Type | Description |
---|---|---|
shortcuts | string | string [] | - |
handler | ShortcutHandler | Shortcut handler callback - takes the triggered shortcut as argument |
Returns
Promise
<void
>
Example
Since
2.0.0
unregister()
Unregister a global shortcut or a list of shortcuts.
Parameters
Parameter | Type |
---|---|
shortcuts | string | string [] |
Returns
Promise
<void
>
Example
Since
2.0.0
unregisterAll()
Unregister all global shortcuts.
Returns
Promise
<void
>
Example
Since
2.0.0
© 2024 Tauri Contributors. CC-BY / MIT