diff --git a/electron-builder.json b/electron-builder.json index f0d7ff75..218153e1 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -51,7 +51,6 @@ }, "linux": { "artifactName": "termix_linux_${arch}_portable.${ext}", - "executableArgs": ["--no-sandbox"], "target": [ { "target": "AppImage", diff --git a/electron/main.cjs b/electron/main.cjs index 14a8e88b..9f86fce0 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -10,16 +10,30 @@ const path = require("path"); const fs = require("fs"); const os = require("os"); -app.disableHardwareAcceleration(); -app.commandLine.appendSwitch("--no-sandbox"); +// Only disable hardware acceleration if explicitly requested or on older systems +if (process.env.DISABLE_GPU === "1") { + app.disableHardwareAcceleration(); +} + app.commandLine.appendSwitch("--ignore-certificate-errors"); app.commandLine.appendSwitch("--ignore-ssl-errors"); app.commandLine.appendSwitch("--ignore-certificate-errors-spki-list"); app.commandLine.appendSwitch("--enable-features=NetworkService"); if (process.platform === "linux") { - app.commandLine.appendSwitch("--disable-setuid-sandbox"); + // Use GPU acceleration on Linux + app.commandLine.appendSwitch("--enable-features", "VaapiVideoDecoder"); app.commandLine.appendSwitch("--disable-dev-shm-usage"); + + // Only disable sandboxing if running in problematic environments + // Check if we're in an AppImage or if CHROME_DEVEL_SANDBOX is not set properly + const isAppImage = process.env.APPIMAGE != null; + const hasProperSandbox = process.env.CHROME_DEVEL_SANDBOX != null; + + if (isAppImage && !hasProperSandbox) { + // AppImage environments often have sandbox issues + app.commandLine.appendSwitch("--no-sandbox"); + } } let mainWindow = null;