diff --git a/forge.config.js b/forge.config.js index 086e429..3e640be 100644 --- a/forge.config.js +++ b/forge.config.js @@ -53,6 +53,7 @@ module.exports = { categories: ['Science'], finishArgs: [ '--share=ipc', + '--share=network', '--socket=x11', '--socket=wayland', '--device=dri', diff --git a/main.js b/main.js index 1f8229c..cbfe6ff 100644 --- a/main.js +++ b/main.js @@ -1,9 +1,24 @@ +const fsNode = require('fs'); const { app, BrowserWindow, Menu, dialog, ipcMain, fs } = require('electron'); +function isFlatpakRuntime() { + return process.platform === 'linux' && ( + !!process.env.FLATPAK_ID || + process.env.container === 'flatpak' || + fsNode.existsSync('/.flatpak-info') + ); +} + // Some Linux/remote desktop setups expose a broken GPU context to Electron. // Fall back to software rendering instead of crashing on startup. app.disableHardwareAcceleration(); +if (isFlatpakRuntime()) { + // The packaged Flatpak currently runs without chrome-sandbox, so Chromium + // needs the explicit no-sandbox flag at startup. + app.commandLine.appendSwitch('no-sandbox'); +} + if (process.platform === 'linux') { // The XDG portal dialog backend ignores defaultPath on some systems and // may cancel folder selection entirely in X11/SSH sessions.