Register a system-wide hotkey that fires even when your app isn't focused (a launcher, quick-capture tool, etc.). Capability: globalShortcut — prompts once per accelerator on first registration.
List the accelerators in "shortcuts" in the manifest, then register one with a callback:
// app.json: { "capabilities": ["globalShortcut"], "shortcuts": ["CmdOrCtrl+Shift+K"] }
const ok = await window.chatoss.shortcuts.register('CmdOrCtrl+Shift+K', () => {
// fires on every press, even when another app is focused
});
// later:
await window.chatoss.shortcuts.unregister('CmdOrCtrl+Shift+K');
- You can only register accelerators you listed in
"shortcuts". - The first registration of each prompts the user once (
okisfalseif they deny). - Shortcuts are released automatically when your app closes.