Game Mode compatability
- Browser will now launch into big picture mode if device is in game mode - Controllers work
This commit is contained in:
@@ -42,3 +42,7 @@ Notes
|
||||
- `--no-sandbox` reduces Chromium sandboxing; prefer fixing `chrome-sandbox` and enabling sandboxing when possible.
|
||||
- Using the AppDir avoids AppImage/FUSE dependency on target systems.
|
||||
- Test on a clean SteamOS/Deck image before publishing.
|
||||
|
||||
Big Picture auto-start (SteamOS Gaming Mode)
|
||||
- If Nebula is launched from SteamOS Gaming Mode, it will auto-start in Big Picture Mode.
|
||||
- To force/disable via Steam Launch Options: `--big-picture` or `--no-big-picture`.
|
||||
|
||||
@@ -42,6 +42,14 @@ Nebula Browser includes a **Big Picture Mode** - a controller-friendly, console-
|
||||
### Automatic Detection
|
||||
If Nebula detects a Steam Deck-sized display (1280x800), it will suggest Big Picture Mode in settings.
|
||||
|
||||
### Auto-start in SteamOS Gaming Mode
|
||||
When Nebula is launched from SteamOS **Gaming Mode** (gamescope / Steam gamepad UI), it will automatically start in **Big Picture Mode**.
|
||||
|
||||
You can override this behavior:
|
||||
- Force Big Picture at launch: launch options `--big-picture` (or `--bigpicture`)
|
||||
- Disable Big Picture auto-start: launch options `--no-big-picture` (or `--no-bigpicture`)
|
||||
- Environment overrides: `NEBULA_BIG_PICTURE=1` / `NEBULA_NO_BIG_PICTURE=1`
|
||||
|
||||
## Navigation Sections
|
||||
|
||||
| Section | Description |
|
||||
|
||||
@@ -72,6 +72,53 @@ ipcMain.removeHandler('window-close');
|
||||
// BIG PICTURE MODE - Steam Deck / Console UI
|
||||
// =============================================================================
|
||||
|
||||
function envTruthy(value) {
|
||||
if (value === undefined || value === null) return false;
|
||||
const s = String(value).trim().toLowerCase();
|
||||
return s === '1' || s === 'true' || s === 'yes' || s === 'on';
|
||||
}
|
||||
|
||||
function argvHasFlag(flag) {
|
||||
return process.argv.includes(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Heuristic: detect Steam Deck / SteamOS Gaming Mode (gamescope) launches.
|
||||
*
|
||||
* This is intentionally conservative and only used for picking the *default*
|
||||
* startup UI. Users can override via CLI/env.
|
||||
*/
|
||||
function isGameModeEnvironment() {
|
||||
const env = process.env;
|
||||
|
||||
// Common Steam tenfoot / gamepad UI markers
|
||||
if (envTruthy(env.STEAM_GAMEPADUI)) return true;
|
||||
if (envTruthy(env.SteamTenfoot)) return true;
|
||||
if (envTruthy(env.STEAM_TENFOOT)) return true;
|
||||
|
||||
// SteamOS / gamescope compositor markers
|
||||
const currentDesktop = String(env.XDG_CURRENT_DESKTOP || '').toLowerCase();
|
||||
const sessionDesktop = String(env.XDG_SESSION_DESKTOP || '').toLowerCase();
|
||||
if (currentDesktop.includes('gamescope') || sessionDesktop.includes('gamescope')) return true;
|
||||
|
||||
if (env.GAMESCOPE_WSI || env.GAMESCOPE_SESSION || env.GAMESCOPE_FOCUSED_APP) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function shouldStartInBigPictureMode() {
|
||||
// Explicit CLI overrides first
|
||||
if (argvHasFlag('--no-big-picture') || argvHasFlag('--no-bigpicture')) return false;
|
||||
if (argvHasFlag('--big-picture') || argvHasFlag('--bigpicture') || argvHasFlag('--tenfoot') || argvHasFlag('--game-mode')) return true;
|
||||
|
||||
// Explicit env overrides
|
||||
if (envTruthy(process.env.NEBULA_NO_BIG_PICTURE) || envTruthy(process.env.NEBULA_NO_BIGPICTURE)) return false;
|
||||
if (envTruthy(process.env.NEBULA_BIG_PICTURE) || envTruthy(process.env.NEBULA_BIGPICTURE) || envTruthy(process.env.NEBULA_GAME_MODE)) return true;
|
||||
|
||||
// Auto-detect SteamOS Gaming Mode
|
||||
return isGameModeEnvironment();
|
||||
}
|
||||
|
||||
// Steam Deck screen dimensions: 1280x800
|
||||
const STEAM_DECK_WIDTH = 1280;
|
||||
const STEAM_DECK_HEIGHT = 800;
|
||||
@@ -503,7 +550,17 @@ function configureSessionsAsync() {
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const t0 = performance.now();
|
||||
|
||||
// If launched via SteamOS Gaming Mode / gamepad UI, default to Big Picture Mode.
|
||||
// Desktop launches remain unchanged.
|
||||
const startInBigPicture = shouldStartInBigPictureMode();
|
||||
if (startInBigPicture) {
|
||||
console.log('[Startup] Detected game mode launch; starting in Big Picture Mode');
|
||||
createBigPictureWindow();
|
||||
} else {
|
||||
createWindow();
|
||||
}
|
||||
|
||||
// Initialize user plugins after app ready
|
||||
try {
|
||||
pluginManager.ensureUserPluginsDir();
|
||||
@@ -512,7 +569,7 @@ app.whenReady().then(() => {
|
||||
} catch (e) {
|
||||
console.error('[Plugins] initialization error:', e);
|
||||
}
|
||||
console.log('[Startup] createWindow invoked in', (performance.now() - t0).toFixed(1), 'ms after app.whenReady');
|
||||
console.log('[Startup] initial window created (', startInBigPicture ? 'bigpicture' : 'desktop', ') in', (performance.now() - t0).toFixed(1), 'ms after app.whenReady');
|
||||
|
||||
// Handle GPU process crashes (still register early)
|
||||
app.on('gpu-process-crashed', (event, killed) => {
|
||||
|
||||
Reference in New Issue
Block a user