@tauri-apps/plugin-global-shortcut
이 콘텐츠는 아직 번역되지 않았습니다.
Register global shortcuts.
Interfaces
Section titled “Interfaces”ShortcutEvent
Section titled “ShortcutEvent”Properties
Section titled “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
Section titled “Type Aliases”ShortcutHandler()
Section titled “ShortcutHandler()”type ShortcutHandler: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | ShortcutEvent |
Returns
Section titled “Returns”void
Functions
Section titled “Functions”isRegistered()
Section titled “isRegistered()”function isRegistered(shortcut): Promise<boolean>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
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
shortcut | string | shortcut definition, modifiers and key separated by ”+” e.g. CmdOrControl+Q |
Returns
Section titled “Returns”Promise<boolean>
Example
Section titled “Example”import { isRegistered } from '@tauri-apps/plugin-global-shortcut';const isRegistered = await isRegistered('CommandOrControl+P');2.0.0
register()
Section titled “register()”function register(shortcuts, handler): Promise<void>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
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
shortcuts | string | string[] | - |
handler | ShortcutHandler | Shortcut handler callback - takes the triggered shortcut as argument |
Returns
Section titled “Returns”Promise<void>
Example
Section titled “Example”import { register } from '@tauri-apps/plugin-global-shortcut';
// register a single hotkeyawait register('CommandOrControl+Shift+C', (event) => { if (event.state === "Pressed") { console.log('Shortcut triggered'); }});
// or register multiple hotkeys at onceawait register(['CommandOrControl+Shift+C', 'Alt+A'], (event) => { console.log(`Shortcut ${event.shortcut} triggered`);});2.0.0
unregister()
Section titled “unregister()”function unregister(shortcuts): Promise<void>Unregister a global shortcut or a list of shortcuts.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
shortcuts | string | string[] |
Returns
Section titled “Returns”Promise<void>
Example
Section titled “Example”import { unregister } from '@tauri-apps/plugin-global-shortcut';
// unregister a single hotkeyawait unregister('CmdOrControl+Space');
// or unregister multiple hotkeys at the same timeawait unregister(['CmdOrControl+Space', 'Alt+A']);2.0.0
unregisterAll()
Section titled “unregisterAll()”function unregisterAll(): Promise<void>Unregister all global shortcuts.
Returns
Section titled “Returns”Promise<void>
Example
Section titled “Example”import { unregisterAll } from '@tauri-apps/plugin-global-shortcut';await unregisterAll();2.0.0
© 2026 Tauri Contributors. CC-BY / MIT