Improve SteamOS/GPU detection and Linux packaging
Enhances GPU flag handling for SteamOS and Gamescope by adding early detection and flag injection in main.js. Updates the README with clearer SteamOS instructions, adds a SteamOS-optimized .desktop file, and improves Linux packaging options in package.json for AppImage and deb targets with appropriate flags and metadata.
This commit is contained in:
+21
-13
@@ -21,27 +21,35 @@ This is caused by GPU compositing conflicts between Electron's Chromium renderer
|
|||||||
|
|
||||||
### Solution
|
### Solution
|
||||||
|
|
||||||
**Option 1: Automatic Detection (Recommended)**
|
**Automatic Detection (v1.3.3+)**
|
||||||
The latest version of Nebula automatically detects SteamOS/Gamescope and applies the necessary fixes. Simply update to the latest version.
|
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 2: Manual Launch Script**
|
|
||||||
Use the provided `start-steamos.sh` script:
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x start-steamos.sh
|
# Run the AppImage with SteamOS flags
|
||||||
./start-steamos.sh
|
./Nebula-*.AppImage --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage --disable-features=VizDisplayCompositor
|
||||||
```
|
```
|
||||||
|
|
||||||
**Option 3: Command-line Flags**
|
**Create a custom .desktop file:**
|
||||||
If running manually, add these flags:
|
|
||||||
|
Copy `nebula-steamos.desktop` to `~/.local/share/applications/` for a Steam Deck optimized launcher:
|
||||||
```bash
|
```bash
|
||||||
electron . --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage
|
cp nebula-steamos.desktop ~/.local/share/applications/
|
||||||
```
|
```
|
||||||
|
|
||||||
**Option 4: Environment Variable**
|
**For Development:**
|
||||||
Set the `ELECTRON_OZONE_PLATFORM_HINT` environment variable:
|
|
||||||
```bash
|
```bash
|
||||||
export ELECTRON_OZONE_PLATFORM_HINT=x11
|
npm run start:steamos
|
||||||
npm start
|
```
|
||||||
|
|
||||||
|
**Environment Variable Override:**
|
||||||
|
You can force SteamOS mode by setting an environment variable:
|
||||||
|
```bash
|
||||||
|
export SteamDeck=1
|
||||||
|
./Nebula-*.AppImage
|
||||||
```
|
```
|
||||||
|
|
||||||
## Linux (General)
|
## Linux (General)
|
||||||
|
|||||||
@@ -1,3 +1,66 @@
|
|||||||
|
// ============================================================================
|
||||||
|
// 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 { app, BrowserWindow, ipcMain, session, screen, shell, dialog, Menu, clipboard, webContents } = require('electron');
|
||||||
const { autoUpdater } = require('electron-updater');
|
const { autoUpdater } = require('electron-updater');
|
||||||
const { pathToFileURL } = require('url');
|
const { pathToFileURL } = require('url');
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[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;
|
||||||
+19
-1
@@ -42,7 +42,25 @@
|
|||||||
"icon": "assets/images/Logos/Nebula-Favicon.ico"
|
"icon": "assets/images/Logos/Nebula-Favicon.ico"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"icon": "assets/images/Logos/Nebula-Favicon.png"
|
"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"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user