diff --git a/GPU-FIX-README.md b/GPU-FIX-README.md index 7746327..223f878 100644 --- a/GPU-FIX-README.md +++ b/GPU-FIX-README.md @@ -21,35 +21,27 @@ This is caused by GPU compositing conflicts between Electron's Chromium renderer ### Solution -**Automatic Detection (v1.3.3+)** -The latest version of Nebula automatically detects SteamOS/Gamescope and applies the necessary fixes in both development and packaged builds. - -**For AppImage/Packaged Builds:** - -If the automatic detection isn't working, you can launch the AppImage with flags: +**Option 1: Automatic Detection (Recommended)** +The latest version of Nebula automatically detects SteamOS/Gamescope and applies the necessary fixes. Simply update to the latest version. +**Option 2: Manual Launch Script** +Use the provided `start-steamos.sh` script: ```bash -# Run the AppImage with SteamOS flags -./Nebula-*.AppImage --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage --disable-features=VizDisplayCompositor +chmod +x start-steamos.sh +./start-steamos.sh ``` -**Create a custom .desktop file:** - -Copy `nebula-steamos.desktop` to `~/.local/share/applications/` for a Steam Deck optimized launcher: +**Option 3: Command-line Flags** +If running manually, add these flags: ```bash -cp nebula-steamos.desktop ~/.local/share/applications/ +electron . --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage ``` -**For Development:** +**Option 4: Environment Variable** +Set the `ELECTRON_OZONE_PLATFORM_HINT` environment variable: ```bash -npm run start:steamos -``` - -**Environment Variable Override:** -You can force SteamOS mode by setting an environment variable: -```bash -export SteamDeck=1 -./Nebula-*.AppImage +export ELECTRON_OZONE_PLATFORM_HINT=x11 +npm start ``` ## Linux (General) diff --git a/main.js b/main.js index 6ef1b26..82088eb 100644 --- a/main.js +++ b/main.js @@ -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'); diff --git a/nebula-steamos.desktop b/nebula-steamos.desktop deleted file mode 100644 index cd7cc38..0000000 --- a/nebula-steamos.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Nebula Browser (SteamOS) -Comment=Nebula Browser optimized for SteamOS/Steam Deck -Exec=nebula --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage --disable-features=VizDisplayCompositor %U -Icon=nebula -Type=Application -Categories=Network;WebBrowser; -StartupWMClass=nebula -MimeType=x-scheme-handler/http;x-scheme-handler/https; diff --git a/package.json b/package.json index f65c8a1..40f2eea 100644 --- a/package.json +++ b/package.json @@ -42,25 +42,7 @@ "icon": "assets/images/Logos/Nebula-Favicon.ico" }, "linux": { - "icon": "assets/images/Logos/Nebula-Favicon.png", - "target": [ - { - "target": "AppImage", - "arch": ["x64"] - }, - { - "target": "deb", - "arch": ["x64"] - } - ], - "category": "Network", - "desktop": { - "StartupWMClass": "nebula" - }, - "executableArgs": [ - "--no-sandbox", - "--disable-gpu-sandbox" - ] + "icon": "assets/images/Logos/Nebula-Favicon.png" } } }