From 3e962f5fa14fe2fc189fe6345742527b1c9d447e Mon Sep 17 00:00:00 2001 From: LukeGus Date: Tue, 4 Nov 2025 21:26:59 -0600 Subject: [PATCH] fix: Linux desktop not opening --- electron/main.cjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/electron/main.cjs b/electron/main.cjs index 86d894d6..14a8e88b 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -10,13 +10,14 @@ const path = require("path"); const fs = require("fs"); const os = require("os"); +app.disableHardwareAcceleration(); +app.commandLine.appendSwitch("--no-sandbox"); 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("--no-sandbox"); app.commandLine.appendSwitch("--disable-setuid-sandbox"); app.commandLine.appendSwitch("--disable-dev-shm-usage"); } @@ -24,6 +25,7 @@ if (process.platform === "linux") { let mainWindow = null; const isDev = process.env.NODE_ENV === "development" || !app.isPackaged; +const appRoot = isDev ? process.cwd() : path.join(__dirname, ".."); const gotTheLock = app.requestSingleInstanceLock(); if (!gotTheLock) { @@ -56,9 +58,7 @@ function createWindow() { minWidth: 800, minHeight: 600, title: "Termix", - icon: isDev - ? path.join(__dirname, "..", "public", "icon.png") - : path.join(process.resourcesPath, "public", "icon.png"), + icon: path.join(appRoot, "public", "icon.png"), webPreferences: { nodeIntegration: false, contextIsolation: true, @@ -92,7 +92,7 @@ function createWindow() { mainWindow.loadURL("http://localhost:5173"); mainWindow.webContents.openDevTools(); } else { - const indexPath = path.join(__dirname, "..", "dist", "index.html"); + const indexPath = path.join(appRoot, "dist", "index.html"); mainWindow.loadFile(indexPath); }