MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / registerQuickCaptureHotkey

Function registerQuickCaptureHotkey

apps/desktop/src/main/index.ts:3091–3113  ·  view source on GitHub ↗
(hotkey: string)

Source from the content-addressed store, hash-verified

3089}
3090
3091function registerQuickCaptureHotkey(hotkey: string): { ok: boolean; error?: string } {
3092 unregisterQuickCaptureHotkey()
3093 const trimmed = hotkey.trim()
3094 if (!trimmed) return { ok: true }
3095 try {
3096 const ok = globalShortcut.register(trimmed, () => {
3097 console.info(`[zen:quick-capture] hotkey pressed: ${trimmed}`)
3098 void toggleQuickCaptureWindow()
3099 })
3100 if (!ok) {
3101 return { ok: false, error: `Failed to register quick capture hotkey: ${trimmed}` }
3102 }
3103 if (!globalShortcut.isRegistered(trimmed)) {
3104 return { ok: false, error: `Quick capture hotkey was not registered by the system: ${trimmed}` }
3105 }
3106 registeredQuickCaptureHotkey = trimmed
3107 console.info(`[zen:quick-capture] registered hotkey: ${trimmed}`)
3108 return { ok: true }
3109 } catch (err) {
3110 const message = err instanceof Error ? err.message : String(err)
3111 return { ok: false, error: message }
3112 }
3113}
3114
3115// Set the app name before the ready event so the dock / menu bar /
3116// About panel all show "ZenNotes" instead of the default "Electron"

Callers 2

registerIpcFunction · 0.85
index.tsFile · 0.85

Calls 2

toggleQuickCaptureWindowFunction · 0.85

Tested by

no test coverage detected