From 939ea3ca9856d513b6c6422e69723a0500608747 Mon Sep 17 00:00:00 2001 From: salman Date: Wed, 15 Apr 2026 17:36:09 +0200 Subject: [PATCH] Flatpak builder works without the need for --no-sandbox --- forge.config.js | 38 ++++++++++++++++++++------------------ main.js | 15 --------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/forge.config.js b/forge.config.js index 3e640be..829a428 100644 --- a/forge.config.js +++ b/forge.config.js @@ -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', diff --git a/main.js b/main.js index cbfe6ff..1f8229c 100644 --- a/main.js +++ b/main.js @@ -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.