Flatpak builder works without the need for --no-sandbox

This commit is contained in:
2026-04-15 17:36:09 +02:00
parent 5c552f8e2e
commit 939ea3ca98
2 changed files with 20 additions and 33 deletions
+20 -18
View File
@@ -1,25 +1,16 @@
const fs = require('fs');
const path = require('path');
module.exports = {
packagerConfig: {
icon: 'appicons/icons/png/1024x1024.png',
extraResource: ['resources/bin'],
ignore: ['Readme.md', 'ToDo.txt', 'TrimSP.cfg', 'fortran/*'],
},
hooks: {
postPackage: async (_forgeConfig, packageResult) => {
if (process.env.FORGE_FLATPAK !== '1') {
return;
}
for (const outputPath of packageResult.outputPaths) {
const sandboxHelper = path.join(outputPath, 'chrome-sandbox');
if (fs.existsSync(sandboxHelper)) {
fs.rmSync(sandboxHelper, { force: true });
}
}
},
ignore: [
'Readme.md',
'ToDo.txt',
'TrimSP.cfg',
'fortran/*',
'\\.flatpak-builder($|/)',
'\\.tmp-flatpak-manual($|/)',
'out-flatpak-test($|/)',
],
},
makers: [
{
@@ -50,6 +41,17 @@ module.exports = {
description: 'TRIM.SP simulation GUI for ion implantation studies.',
baseVersion: '24.08',
runtimeVersion: '24.08',
icon: {
'16x16': 'appicons/icons/png/16x16.png',
'24x24': 'appicons/icons/png/24x24.png',
'32x32': 'appicons/icons/png/32x32.png',
'48x48': 'appicons/icons/png/48x48.png',
'64x64': 'appicons/icons/png/64x64.png',
'128x128': 'appicons/icons/png/128x128.png',
'256x256': 'appicons/icons/png/256x256.png',
'512x512': 'appicons/icons/png/512x512.png',
},
modules: [],
categories: ['Science'],
finishArgs: [
'--share=ipc',
-15
View File
@@ -1,24 +1,9 @@
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.