Revert "Improve SteamOS/GPU detection and Linux packaging"

This reverts commit a92e3e4652.
This commit is contained in:
2025-12-28 12:01:29 +13:00
parent ba40586910
commit 8843185fd6
4 changed files with 14 additions and 112 deletions
-63
View File
@@ -1,66 +1,3 @@
// ============================================================================
// CRITICAL: GPU flags must be applied BEFORE Electron loads
// These must be at the VERY TOP of main.js for packaged apps
// ============================================================================
if (process.platform === 'linux') {
const fs = require('fs');
// Detect SteamOS/Gamescope environment
let isSteamOS = false;
try {
if (fs.existsSync('/etc/steamos-release')) isSteamOS = true;
else if (fs.existsSync('/usr/share/steamos/steamos.conf')) isSteamOS = true;
else if (process.env.GAMESCOPE_WAYLAND_DISPLAY) isSteamOS = true;
else if (process.env.SteamDeck) isSteamOS = true;
else if (process.env.SteamAppId) isSteamOS = true;
else if (fs.existsSync('/etc/os-release')) {
const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
if (osRelease.includes('SteamOS') || osRelease.includes('steamos')) isSteamOS = true;
}
} catch (e) {}
// Apply flags via app.commandLine BEFORE requiring electron
// We need to do this via process.argv for packaged apps
const linuxFlags = [
'--disable-gpu-sandbox',
'--no-sandbox',
'--disable-dev-shm-usage'
];
if (isSteamOS || process.env.GAMESCOPE_WAYLAND_DISPLAY) {
console.log('[GPU] SteamOS/Gamescope detected at startup - applying critical flags');
linuxFlags.push(
'--ozone-platform=x11',
'--disable-gpu-compositing',
'--disable-gpu-vsync',
'--disable-accelerated-2d-canvas',
'--use-gl=desktop',
'--disable-features=VizDisplayCompositor',
'--enable-features=UseOzonePlatform'
);
} else {
// General Linux - detect Wayland vs X11
const waylandDisplay = process.env.WAYLAND_DISPLAY;
const x11Display = process.env.DISPLAY;
if (waylandDisplay && !x11Display) {
linuxFlags.push('--ozone-platform=wayland', '--enable-features=UseOzonePlatform,WaylandWindowDecorations');
} else if (x11Display) {
linuxFlags.push('--ozone-platform=x11');
}
linuxFlags.push('--disable-features=VizDisplayCompositor');
}
// Add flags that aren't already present
linuxFlags.forEach(flag => {
const flagName = flag.split('=')[0];
if (!process.argv.some(arg => arg.startsWith(flagName))) {
process.argv.push(flag);
}
});
}
// ============================================================================
const { app, BrowserWindow, ipcMain, session, screen, shell, dialog, Menu, clipboard, webContents } = require('electron');
const { autoUpdater } = require('electron-updater');
const { pathToFileURL } = require('url');