useGlobalShortcut
Registers a system-wide keyboard shortcut — fires even when the app isn't focused. Ref-counted in the main process, so multiple components registering the same accelerator don't unregister it out from under each other.
const { isRegistered } = useGlobalShortcut('CmdOrCtrl+Shift+K', () => { /* ... */ })
| Param/Member | Type | Notes |
|---|---|---|
accelerator | string | null | Electron accelerator string. Pass null to skip registering. |
callback | () => void | Called when the shortcut fires. |
isRegistered | boolean | false if the OS/another app already reserved the accelerator. |
import { useGlobalShortcut } from 'nextop-app'useGlobalShortcut('CmdOrCtrl+Shift+K', () => setPaletteOpen(true))