Global Shortcuts
5 in apps0 in games
Methods
Register Shortcut Apps only
Sets the app to listen for the specific keys to be pressed, even if the app is not in focus.
When the accelerator is already taken by other applications, this call will silently fail. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.
await window.deskifier.shortcuts.register({ arguments })
Arguments
acceleratorString
The specific trigger keys. Check here for available keys.idString (Optional)
The ID of the shortcut. If none is given, one will be randomly generated.
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.idString
The ID of the shortcut. If none is given, one will be randomly generated.
Example
const result = await window.deskifier.shortcuts.register({
accelerator: 'CommandOrControl+Y',
id: 'abc123'
});
console.log(result.id); // abc123
Unregister Shortcut Apps only
Unregisters the shortcut.
await window.deskifier.shortcuts.unregister({ arguments })
Arguments
idString (Required)
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.
Unregister All Shortcuts Apps only
Unregisters all shortcuts.
await window.deskifier.shortcuts.unregisterAll()
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.
Properties
Get Shortcuts Apps only
Retrieves all of the registered shortcuts by the application.
If a registered accelerator is already taken by other applications, this call will still return it as registered. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.
await window.deskifier.shortcuts.getAll()
Returns
successBoolean
If the action was successful.messageString
Additional confirmation, or error details if action was unsuccessful.shortcutsArray of Objects, each with:acceleratorStringidString
Events
Shortcut Triggered Apps only
Fires when a shortcut is used.
window.deskifier.shortcuts.onTriggered((data) => { })
Arguments
acceleratorStringidString