Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(app): reach Save Diagnostics from the menu and tray, not nowhere
EtienneLescota6a22a9c6e28
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.tsindex 0f20dd564..958ef6d96 100644--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@ -1664,6 +1664,66 @@ async function resolveMediaLinksForVideo(videoPath: string): Promise<{return { resolvedVia: "none" };}+/**+ * Writes the diagnostic bundle a bug report needs: app/OS facts, the native+ * helpers' raw stdout/stderr (which is where `[stop-timing]` and+ * `encoder-selection` land — see nativeWindowsCaptureStop.ts), and the main+ * process's own recent console output. Shared by the renderer's IPC call and+ * the menu/tray "Save Diagnostics" entry point in main.ts, which has no+ * renderer-side `projectState`/`logs` to offer and does not need to.+ */+export async function exportDiagnosticFile(payload: {+ error: string;+ stack?: string;+ projectState: unknown;+ logs: string[];+}) {+ const { filePath, canceled } = await dialog.showSaveDialog({+ title: "Save Diagnostic File",+ defaultPath: `openscreen-diagnostic-${Date.now()}.json`,+ filters: [{ name: "JSON", extensions: ["json"] }],+ });++ if (canceled || !filePath) return { success: false, canceled: true };++ const HELPER_OUTPUT_MAX_BYTES = 64 * 1024;+ const tail = (s: string, max: number) => (s.length <= max ? s : s.slice(s.length - max));++ const diagnostic = {+ timestamp: new Date().toISOString(),+ appVersion: app.getVersion(),+ platform: process.platform,+ arch: process.arch,+ // The same fact the About box leads with, and for the same reason: it is what+ // explains why a copy does or does not offer an update check. This file is the+ // artifact users actually attach, so it must not be the one that omits it.+ channel: getInstallChannel(),+ osRelease: os.release(),+ osVersion: os.version(),+ totalMemoryMB: Math.round(os.totalmem() / 1024 / 1024),+ nodeVersion: process.versions.node,+ electronVersion: process.versions.electron,+ chromeVersion: process.versions.chrome,+ error: payload.error,+ stack: payload.stack,+ projectState: payload.projectState,+ recentLogs: payload.logs,+ helperOutput: {+ windows: tail(nativeWindowsCaptureOutput, HELPER_OUTPUT_MAX_BYTES),+ mac: tail(nativeMacCaptureOutput, HELPER_OUTPUT_MAX_BYTES),+ },+ mainProcessLogs: mainLogBuffer.snapshot(),+ };++ try {+ await fs.writeFile(filePath, JSON.stringify(diagnostic, null, 2), "utf-8");+ return { success: true, path: filePath };+ } catch (error) {+ console.error("Failed to write diagnostic file:", error);+ return { success: false, error: String(error) };+ }+}+export function registerIpcHandlers(createEditorWindow: () => void,createSourceSelectorWindow: () => BrowserWindow,@@ -4092,55 +4152,8 @@ export function registerIpcHandlers(ipcMain.handle("save-diagnostic",- async (- _,- payload: { error: string; stack?: string; projectState: unknown; logs: string[] },- ) => {- const { filePath, canceled } = await dialog.showSaveDialog({- title: "Save Diagnostic File",- defaultPath: `openscreen-diagnostic-${Date.now()}.json`,- filters: [{ name: "JSON", extensions: ["json"] }],- });-- if (canceled || !filePath) return { success: false, canceled: true };-- const HELPER_OUTPUT_MAX_BYTES = 64 * 1024;- const tail = (s: string, max: number) => (s.length <= max ? s : s.slice(s.length - max));-- const diagnostic = {- timestamp: new Date().toISOString(),- appVersion: app.getVersion(),- platform: process.platform,- arch: process.arch,- // The same fact the About box leads with, and for the same reason: it is what- // explains why a copy does or does not offer an update check. This file is the- // artifact users actually attach, so it must not be the one that omits it.- channel: getInstallChannel(),- osRelease: os.release(),- osVersion: os.version(),- totalMemoryMB: Math.round(os.totalmem() / 1024 / 1024),- nodeVersion: process.versions.node,- electronVersion: process.versions.electron,- chromeVersion: process.versions.chrome,- error: payload.error,- stack: payload.stack,- projectState: payload.projectState,- recentLogs: payload.logs,- helperOutput: {- windows: tail(nativeWindowsCaptureOutput, HELPER_OUTPUT_MAX_BYTES),- mac: tail(nativeMacCaptureOutput, HELPER_OUTPUT_MAX_BYTES),- },- mainProcessLogs: mainLogBuffer.snapshot(),- };-- try {- await fs.writeFile(filePath, JSON.stringify(diagnostic, null, 2), "utf-8");- return { success: true, path: filePath };- } catch (error) {- console.error("Failed to write diagnostic file:", error);- return { success: false, error: String(error) };- }- },+ async (_, payload: { error: string; stack?: string; projectState: unknown; logs: string[] }) =>+ exportDiagnosticFile(payload),);// One instance each, not one per call. DocumentService serialises saves of adiff --git a/electron/main.ts b/electron/main.tsindex 85eb063b8..6f2538587 100644--- a/electron/main.ts+++ b/electron/main.ts@@ -41,7 +41,11 @@ import {} from "./globalShortcut";import { mainT, setMainLocale } from "./i18n";import { getInstallChannel, offersUpdateCheck, platformOwnsUpdates } from "./install-channel";-import { getSelectedDesktopSource, registerIpcHandlers } from "./ipc/handlers";+import {+ exportDiagnosticFile,+ getSelectedDesktopSource,+ registerIpcHandlers,+} from "./ipc/handlers";import { installMainProcessErrorGuards } from "./main-process-errors";import { registerSttIpc, shutdownStt } from "./stt";import { checkLatestRelease } from "./update-checker";@@ -211,6 +215,11 @@ function setupApplicationMenu() {role: "about",label: mainT("common", "actions.about") || "About OpenScreen",},+ { type: "separator" as const },+ {+ label: mainT("common", "actions.saveDiagnostics") || "Save Diagnostics",+ click: runSaveDiagnostics,+ },// Omitted entirely — here, in the Help menu and in the tray — where a package// manager owns the update. See `canOfferUpdateCheck`....(canOfferUpdateCheck()@@ -369,6 +378,11 @@ function setupApplicationMenu() {label: mainT("common", "actions.about") || "About OpenScreen",click: runAboutDialog,},+ { type: "separator" as const },+ {+ label: mainT("common", "actions.saveDiagnostics") || "Save Diagnostics",+ click: runSaveDiagnostics,+ },],});}@@ -519,6 +533,31 @@ function runUpdateCheck() {});}+/**+ * Menu and tray entry point for exporting a diagnostic bundle. The backend+ * (`exportDiagnosticFile`) and its "Save Diagnostics" label already existed —+ * nothing in the app ever called it (getopenscreen/openscreen#460). Reveals+ * the written file on success, the same confirmation the export flow's "Show+ * in folder" gives, so there is no need for a second dialog on top of the+ * native Save dialog the user already went through.+ *+ * No renderer `projectState`/`logs` to attach from here, unlike the in-app+ * crash path this shares a payload shape with — the diagnostic value for a+ * capture bug is almost entirely `helperOutput`/`mainProcessLogs`, which+ * `exportDiagnosticFile` reads straight from the main process regardless.+ */+function runSaveDiagnostics() {+ exportDiagnosticFile({ error: "Manual diagnostic export", projectState: null, logs: [] })+ .then((result) => {+ if (result.success && result.path) {+ shell.showItemInFolder(result.path);+ }+ })+ .catch((error) => {+ console.error("[diagnostics] save failed", error);+ });+}+/** Mirrors the flag that already drives the tray icon. An update must never interrupt a take —* and on Windows it physically cannot, because the capture helpers spawn from inside the* install directory and NSIS cannot overwrite a running .exe. */@@ -730,6 +769,14 @@ function updateTrayMenu(recording: boolean = false) {label: mainT("common", "actions.about") || "About OpenScreen",click: runAboutDialog,},+ // Right next to About, and reachable without opening any window: this is the+ // one place in the app most likely to still be usable right after a recording+ // failed to stop, which is exactly when the [stop-timing]/encoder-selection+ // lines this exports are worth the most (getopenscreen/openscreen#460).+ {+ label: mainT("common", "actions.saveDiagnostics") || "Save Diagnostics",+ click: runSaveDiagnostics,+ },{ type: "separator" as const },{label: mainT("common", "actions.quit") || "Quit",diff --git a/src/i18n/locales/ar/common.json b/src/i18n/locales/ar/common.jsonindex ef0d6736f..b63cd0265 100644--- a/src/i18n/locales/ar/common.json+++ b/src/i18n/locales/ar/common.json@@ -40,7 +40,8 @@"services": "خدمات","hide": "إخفاء OpenScreen","hideOthers": "إخفاء الآخرين",- "unhide": "إظهار الكل"+ "unhide": "إظهار الكل",+ "saveDiagnostics": "حفظ التشخيصات"},"updates": {"available": "يتوفر OpenScreen {{latestVersion}}. الإصدار المثبت هو {{currentVersion}}.",diff --git a/src/i18n/locales/en/common.json b/src/i18n/locales/en/common.jsonindex 4f303ee62..6eac95830 100644--- a/src/i18n/locales/en/common.json+++ b/src/i18n/locales/en/common.json@@ -40,7 +40,8 @@"services": "Services","hide": "Hide OpenScreen","hideOthers": "Hide Others",- "unhide": "Show All"+ "unhide": "Show All",+ "saveDiagnostics": "Save Diagnostics"},"updates": {"available": "OpenScreen {{latestVersion}} is available. You are using {{currentVersion}}.",diff --git a/src/i18n/locales/es/common.json b/src/i18n/locales/es/common.jsonindex 3c92583a6..29a364265 100644--- a/src/i18n/locales/es/common.json+++ b/src/i18n/locales/es/common.json@@ -40,7 +40,8 @@"services": "Servicios","hide": "Ocultar OpenScreen","hideOthers": "Ocultar otros",- "unhide": "Mostrar todo"+ "unhide": "Mostrar todo",+ "saveDiagnostics": "Guardar diagnósticos"},"updates": {"available": "OpenScreen {{latestVersion}} está disponible. Estás usando {{currentVersion}}.",diff --git a/src/i18n/locales/fr/common.json b/src/i18n/locales/fr/common.jsonindex de72f3139..c74ef66b8 100644--- a/src/i18n/locales/fr/common.json+++ b/src/i18n/locales/fr/common.json@@ -40,7 +40,8 @@"services": "Services","hide": "Masquer OpenScreen","hideOthers": "Masquer les autres",- "unhide": "Tout afficher"+ "unhide": "Tout afficher",+ "saveDiagnostics": "Enregistrer les diagnostics"},"updates": {"available": "OpenScreen {{latestVersion}} est disponible. Vous utilisez la version {{currentVersion}}.",diff --git a/src/i18n/locales/it/common.json b/src/i18n/locales/it/common.jsonindex df18ace13..24f10fc61 100644--- a/src/i18n/locales/it/common.json+++ b/src/i18n/locales/it/common.json@@ -40,7 +40,8 @@"services": "Servizi","hide": "Nascondi OpenScreen","hideOthers": "Nascondi gli altri",- "unhide": "Mostra tutto"+ "unhide": "Mostra tutto",+ "saveDiagnostics": "Salva dati diagnostici"},"updates": {"available": "OpenScreen {{latestVersion}} è disponibile. Stai usando la versione {{currentVersion}}.",diff --git a/src/i18n/locales/ja-JP/common.json b/src/i18n/locales/ja-JP/common.jsonindex 88899975b..0d3ca001b 100644--- a/src/i18n/locales/ja-JP/common.json+++ b/src/i18n/locales/ja-JP/common.json@@ -40,7 +40,8 @@"services": "サービス","hide": "OpenScreenを隠す","hideOthers": "ほかを隠す",- "unhide": "すべて表示"+ "unhide": "すべて表示",+ "saveDiagnostics": "診断情報を保存"},"updates": {"available": "OpenScreen {{latestVersion}} を利用できます。現在のバージョンは {{currentVersion}} です。",diff --git a/src/i18n/locales/ko-KR/common.json b/src/i18n/locales/ko-KR/common.jsonindex 964fdd631..2ca4d25a5 100644--- a/src/i18n/locales/ko-KR/common.json+++ b/src/i18n/locales/ko-KR/common.json@@ -40,7 +40,8 @@"services": "서비스","hide": "OpenScreen 숨기기","hideOthers": "다른 항목 숨기기",- "unhide": "모두 보기"+ "unhide": "모두 보기",+ "saveDiagnostics": "Save Diagnostics"},"updates": {"available": "OpenScreen {{latestVersion}} 버전을 사용할 수 있습니다. 현재 버전은 {{currentVersion}}입니다.",diff --git a/src/i18n/locales/pt-BR/common.json b/src/i18n/locales/pt-BR/common.jsonindex af25d126d..d74e5b215 100644--- a/src/i18n/locales/pt-BR/common.json+++ b/src/i18n/locales/pt-BR/common.json@@ -40,7 +40,8 @@"services": "Serviços","hide": "Ocultar OpenScreen","hideOthers": "Ocultar Outros",- "unhide": "Mostrar Todos"+ "unhide": "Mostrar Todos",+ "saveDiagnostics": "Salvar Diagnósticos"},"updates": {"available": "O OpenScreen {{latestVersion}} está disponível. Você está usando a versão {{currentVersion}}.",diff --git a/src/i18n/locales/ru/common.json b/src/i18n/locales/ru/common.jsonindex d7ec15ae6..141e8b984 100644--- a/src/i18n/locales/ru/common.json+++ b/src/i18n/locales/ru/common.json@@ -40,7 +40,8 @@"services": "Сервисы","hide": "Скрыть OpenScreen","hideOthers": "Скрыть остальные",- "unhide": "Показать все"+ "unhide": "Показать все",+ "saveDiagnostics": "Сохранить диагностику"},"updates": {"available": "Доступен OpenScreen {{latestVersion}}. Установлена версия {{currentVersion}}.",diff --git a/src/i18n/locales/tr/common.json b/src/i18n/locales/tr/common.jsonindex e36c2dc33..923079b1e 100644--- a/src/i18n/locales/tr/common.json+++ b/src/i18n/locales/tr/common.json@@ -40,7 +40,8 @@"services": "Servisler","hide": "OpenScreen’i Gizle","hideOthers": "Diğerlerini Gizle",- "unhide": "Tümünü Göster"+ "unhide": "Tümünü Göster",+ "saveDiagnostics": "Teşhis Verilerini Kaydet"},"updates": {"available": "OpenScreen {{latestVersion}} kullanılabilir. Mevcut sürümünüz {{currentVersion}}.",diff --git a/src/i18n/locales/vi/common.json b/src/i18n/locales/vi/common.jsonindex 544cf3b89..089cf992a 100644--- a/src/i18n/locales/vi/common.json+++ b/src/i18n/locales/vi/common.json@@ -40,7 +40,8 @@"services": "Dịch vụ","hide": "Ẩn OpenScreen","hideOthers": "Ẩn ứng dụng khác",- "unhide": "Hiển thị tất cả"+ "unhide": "Hiển thị tất cả",+ "saveDiagnostics": "Lưu thông tin chẩn đoán"},"updates": {"available": "Đã có OpenScreen {{latestVersion}}. Bạn đang dùng phiên bản {{currentVersion}}.",diff --git a/src/i18n/locales/zh-CN/common.json b/src/i18n/locales/zh-CN/common.jsonindex 30b018cc1..0a7b2bd9b 100644--- a/src/i18n/locales/zh-CN/common.json+++ b/src/i18n/locales/zh-CN/common.json@@ -40,7 +40,8 @@"services": "服务","hide": "隐藏 OpenScreen","hideOthers": "隐藏其他",- "unhide": "显示全部"+ "unhide": "显示全部",+ "saveDiagnostics": "保存诊断信息"},"updates": {"available": "OpenScreen {{latestVersion}} 已发布。当前版本为 {{currentVersion}}。",diff --git a/src/i18n/locales/zh-TW/common.json b/src/i18n/locales/zh-TW/common.jsonindex 07d66259c..c54dc17ed 100644--- a/src/i18n/locales/zh-TW/common.json+++ b/src/i18n/locales/zh-TW/common.json@@ -40,7 +40,8 @@"services": "服務","hide": "隱藏 OpenScreen","hideOthers": "隱藏其他",- "unhide": "全部顯示"+ "unhide": "全部顯示",+ "saveDiagnostics": "儲存診斷資料"},"updates": {"available": "OpenScreen {{latestVersion}} 已推出。目前版本為 {{currentVersion}}。",