{"record":{"id":"6c351fa042e66489","repo":"tonhowtf/omniget","slug":"omnidisc-push-to-talk-status-unavailable","errorCode":null,"errorMessage":"[omnidisc] push-to-talk status unavailable","messagePattern":"\\[omnidisc\\] push-to-talk status unavailable","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-voice-store.svelte.ts","lineNumber":700,"sourceCode":"/**\n * `null` while unknown or while no key is set; `false` when the OS refused to\n * hand the combination over — Windows gives it to whoever asked first, macOS\n * wants Accessibility permission. Both used to fail silently, so the key just\n * did nothing.\n */\nexport function isPttRegistered(): boolean | null {\n  return pttRegistered;\n}\n\nexport async function refreshPttStatus(): Promise<void> {\n  try {\n    const status = await invoke<{ binding: string; registered: boolean }>(\n      \"omnidisc_voice_ptt_status\",\n    );\n    pttRegistered = status.binding ? status.registered : null;\n  } catch (e) {\n    pttRegistered = null;\n    console.warn(\"[omnidisc] push-to-talk status unavailable\", errorText(e));\n  }\n}\n\nexport async function setVadThreshold(db: number): Promise<void> {\n  await updateSettings({ omnidisc: { voice: { vad_threshold_db: db } } });\n}\n\nexport async function setDucking(percent: number): Promise<void> {\n  const clamped = Math.min(100, Math.max(0, Math.round(percent)));\n  try {\n    await invoke(\"omnidisc_voice_set_ducking\", { percent: clamped });\n  } catch (e) {\n    console.warn(\"[omnidisc] ducking failed\", errorText(e));\n  }\n  await updateSettings({ omnidisc: { voice: { ducking_percent: clamped } } });\n}\n\nexport async function setRelayOnly(enabled: boolean): Promise<void> {","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-voice-store.svelte.ts#L682-L718","documentation":"Logged by the PTT status refresher when `omnidisc_voice_ptt_status` fails. It sets pttRegistered to null, meaning 'unknown', so the UI should render an indeterminate push-to-talk binding state. Non-fatal.","triggerScenarios":"Calling the PTT status refresh when the backend command `omnidisc_voice_ptt_status` rejects: global-shortcut subsystem unavailable, voice backend not initialized, or command not registered.","commonSituations":"App startup before voice backend init; platform lacks global hotkey support (some Wayland setups); Tauri global-shortcut plugin not registered; browser dev mode.","solutions":["Check errorText(e) for the backend cause.","Ensure the voice/shortcut backend initializes before this status call (retry on ready).","Verify `omnidisc_voice_ptt_status` and the global-shortcut plugin are registered in Tauri.","Treat pttRegistered === null in the UI as 'unknown' and prompt the user to rebind.","On Wayland, expect global shortcut restrictions; document or fall back to in-app hotkeys."],"exampleFix":"// before\n} catch (e) {\n  pttRegistered = null;\n  console.warn(\"[omnidisc] push-to-talk status unavailable\", errorText(e));\n}\n// after\n} catch (e) {\n  pttRegistered = null;\n  console.warn(\"[omnidisc] push-to-talk status unavailable\", errorText(e));\n  onReady(() => refreshPttStatus()); // retry once the voice backend is initialized\n}","handlingStrategy":"fallback","validationCode":"if (!isTauri()) { pttRegistered = null; return; }","typeGuard":"function isTauri(): boolean {\n  return typeof window !== \"undefined\" && \"__TAURI_INTERNALS__\" in window;\n}","tryCatchPattern":"try {\n  const status = await invoke<{ binding: string; registered: boolean }>(\"omnidisc_voice_ptt_status\");\n  pttRegistered = status.binding ? status.registered : null;\n} catch (e) {\n  pttRegistered = null; // unknown; UI must handle null\n  console.warn(\"[omnidisc] push-to-talk status unavailable\", errorText(e));\n}","preventionTips":["Treat null pttRegistered as 'unknown' in UI, not false.","Retry status fetch once the voice backend signals readiness.","Register the global-shortcut plugin on all platforms.","Document Wayland global-shortcut limitations and provide in-app fallback."],"tags":["tauri","ipc","push-to-talk","shortcuts"],"backgroundTag":"api-request-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}