@tauri-apps/plugin-global-shortcut
Register global shortcuts.
Interfaces
ShortcutEvent
Properties
Property | Type |
---|---|
id | number |
shortcut | string |
state | "Released" | "Pressed" |
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.
Parameters
Parameter | Type | Description |
---|---|---|
shortcut | string | Shortcut definition, modifiers and key separated by ”+” e.g. CmdOrControl+Q |
handler | ShortcutHandler | Shortcut handler callback - takes the triggered shortcut as argument |
Returns
Promise
<void
>
Example
Since
2.0.0
registerAll()
Register a collection of global shortcuts.
Parameters
Parameter | Type | Description |
---|---|---|
shortcuts | string [] | Array of shortcut definitions, modifiers and key separated by ”+” e.g. CmdOrControl+Q |
handler | ShortcutHandler | Shortcut handler callback - takes the triggered shortcut as argument |
Returns
Promise
<void
>
Example
Since
2.0.0
unregister()
Unregister a global shortcut.
Parameters
Parameter | Type | Description |
---|---|---|
shortcut | string | shortcut definition, modifiers and key separated by ”+” e.g. CmdOrControl+Q |
Returns
Promise
<void
>
Example
Since
2.0.0
unregisterAll()
Unregisters all shortcuts registered by the application.
Returns
Promise
<void
>
Example
Since
2.0.0
© 2024 Tauri Contributors. CC-BY / MIT