Files
Toju/electron/app/flags.ts
T
myxelium 718f4a99f0
Queue Release Build / prepare (push) Successful in 28s
Deploy Web Apps / deploy (push) Failing after 10m14s
Queue Release Build / build-windows (push) Failing after 15m12s
Queue Release Build / build-linux (push) Successful in 43m41s
Queue Release Build / finalize (push) Skipped
Queue Release Build / build-android (push) Successful in 17m25s
fix: AppImage required --no-sandbox
Not tested enough but works on my machine
2026-08-14 03:51:23 +02:00

62 lines
2.1 KiB
TypeScript

import { app } from 'electron';
import { configureDesktopBranding } from './desktop-branding-migration';
import { readDesktopSettings } from '../desktop-settings';
export function configureAppFlags(): void {
configureDesktopBranding();
networkFlags();
setupGpuEncodingFlags();
chromiumFlags();
}
function chromiumFlags(): void {
// Allow media autoplay without user gesture
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');
// Suppress Autofill devtools errors
app.commandLine.appendSwitch('disable-features', 'Autofill,AutofillAssistant,AutofillServerCommunication');
// Collect all enabled features into a single switch to avoid later calls overwriting earlier ones
const enabledFeatures: string[] = [];
if (process.platform === 'linux') {
// Sandbox and Ozone platform selection happen before this file runs. The
// packaged launcher script and the dev launch scripts pass those switches
// on the real command line instead.
// PipeWire-based audio pipeline for screen share audio capture
enabledFeatures.push('AudioServiceOutOfProcess');
// PipeWire-based screen capture so the xdg-desktop-portal system picker works
enabledFeatures.push('WebRTCPipeWireCapturer');
}
const desktopSettings = readDesktopSettings();
if (process.platform === 'linux' && desktopSettings.vaapiVideoEncode) {
enabledFeatures.push('VaapiVideoEncode');
}
if (enabledFeatures.length > 0) {
app.commandLine.appendSwitch('enable-features', enabledFeatures.join(','));
}
}
function networkFlags(): void {
// Accept self-signed certificates in development (for --ssl dev server)
if (process.env['SSL'] === 'true') {
app.commandLine.appendSwitch('ignore-certificate-errors');
}
}
function setupGpuEncodingFlags(): void {
const desktopSettings = readDesktopSettings();
if (!desktopSettings.hardwareAcceleration) {
app.disableHardwareAcceleration();
}
app.commandLine.appendSwitch('enable-gpu-rasterization');
app.commandLine.appendSwitch('enable-zero-copy');
app.commandLine.appendSwitch('enable-native-gpu-memory-buffers');
}