work on linux release
Linux release not fully working as well as windows, will investigate later
This commit is contained in:
+30
-5
@@ -5,7 +5,7 @@ const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const {
|
||||
app, BrowserWindow, ipcMain, dialog, shell, nativeTheme, globalShortcut,
|
||||
clipboard, nativeImage, screen, powerSaveBlocker, session,
|
||||
clipboard, nativeImage, screen, powerSaveBlocker, session, desktopCapturer,
|
||||
} = require('electron');
|
||||
|
||||
const { GuideStore } = require('../core/store');
|
||||
@@ -95,6 +95,11 @@ function createWindow() {
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
spellcheck: Boolean(settings.get('spellcheck')),
|
||||
// During a recording the window is minimized (Linux) or hidden (Windows).
|
||||
// A throttled renderer stops processing capture:added events, so the step
|
||||
// list and capture bar appear "stuck" even though steps are saved. Keep
|
||||
// the renderer live so the UI updates in real time while recording.
|
||||
backgroundThrottling: false,
|
||||
},
|
||||
});
|
||||
mainWindow.loadFile(path.join(__dirname, 'renderer', 'index.html'));
|
||||
@@ -835,14 +840,34 @@ if (!gotLock) {
|
||||
textIntel,
|
||||
});
|
||||
|
||||
// Allow the hidden capture-worker renderer to open a desktop media stream
|
||||
// via getUserMedia. Electron 29+ requires an explicit permission grant for
|
||||
// display-capture in renderer windows; without it the getUserMedia call
|
||||
// fails, the stream backend never starts, and every capture falls back to
|
||||
// Allow the hidden capture-worker renderer to open a desktop media stream.
|
||||
// Electron 29+ requires an explicit permission grant for display-capture in
|
||||
// renderer windows; without it getUserMedia/getDisplayMedia fails, the
|
||||
// stream backend never starts, and every capture falls back to
|
||||
// desktopCapturer.getSources() — which triggers the portal dialog on Linux
|
||||
// on every single capture. StepForge is fully local/offline so allowing
|
||||
// all permissions for our own content is safe.
|
||||
session.defaultSession.setPermissionCheckHandler(() => true);
|
||||
session.defaultSession.setPermissionRequestHandler((_wc, _perm, cb) => cb(true));
|
||||
|
||||
// On GNOME Wayland the only working screen-capture path is the portal-backed
|
||||
// getDisplayMedia (desktopCapturer source ids fail with "device not found").
|
||||
// The worker calls getDisplayMedia; this handler answers it. Calling
|
||||
// getSources() *inside* the handler is the documented Wayland path: it
|
||||
// drives the XDG portal picker (shown once when a recording starts), and
|
||||
// the chosen source then streams for the whole session. (useSystemPicker is
|
||||
// macOS-only today, harmless elsewhere.)
|
||||
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
||||
desktopCapturer.getSources({ types: ['screen'] })
|
||||
.then((sources) => {
|
||||
console.log(`[stepforge] display-media request resolved: ${sources.length} screen source(s)`);
|
||||
callback(sources.length ? { video: sources[0] } : {});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(`[stepforge] display-media getSources failed: ${err && err.message}`);
|
||||
callback({});
|
||||
});
|
||||
}, { useSystemPicker: true });
|
||||
|
||||
applyTheme();
|
||||
setupIpc();
|
||||
|
||||
Reference in New Issue
Block a user