⌨
Global Shortcuts
We allow you to register global keyboard shortcuts that work when your app doesn't have keyboard focus.
Promise<Boolean> - Whether your application has registered the accelerator (shortcut).
Note if another application has taken the accelerator this will still return
false
await todesktop.shortcut.isRegistered("Command+G")
Promise<Boolean> - Whether the shortcut was registered successfully.
Registers the global shortcut of
accelerator
. The callback is called when the user presses the shortcut. Note when the accelerator is already taken by other applications, this call will silently fail.
todesktop.shortcut.register("Command+G", () => {
console.log("The shortcut was pressed");
});
Promise<Boolean> - Whether the shortcut was successfully unregistered
Unregisters the global shortcut of
accelerator
.todesktop.shortcut.unregister("Command+G");
Promise<Boolean> - Whether all shortcuts were successfully removed
todesktop.shortcut.unregisterAll();
Last modified 1yr ago