Nnextop / app

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/MemberTypeNotes
acceleratorstring | nullElectron accelerator string. Pass null to skip registering.
callback() => voidCalled when the shortcut fires.
isRegisteredbooleanfalse if the OS/another app already reserved the accelerator.
import { useGlobalShortcut } from 'nextop-app'
useGlobalShortcut('CmdOrCtrl+Shift+K', () => setPaletteOpen(true))