Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #134612: Added electron flags for wayland #135191

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main.js
Expand Up @@ -167,6 +167,9 @@ function configureCommandlineSwitchesSync(cliArgs) {

// Force enable screen readers on Linux via this flag
SUPPORTED_ELECTRON_SWITCHES.push('force-renderer-accessibility');

// Specify ozone platform implementation to use.
SUPPORTED_ELECTRON_SWITCHES.push('ozone-platform');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #154092, Visual Studio Code is using an Electron version that supports the --ozone-platform-hint flag. So it may be worth enabling this flag too (ozone-platform-hint) as part of this pull-request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vially unfortunately we cannot support ozone-platform-hint from application code since the flag detection happens before application code starts its execution which would be in ElectronBrowserMainParts::PreMainMessageLoopRun

}

const SUPPORTED_MAIN_PROCESS_SWITCHES = [
Expand Down Expand Up @@ -194,14 +197,22 @@ function configureCommandlineSwitchesSync(cliArgs) {
}
}

// Others
// Other 'enabled' flags
else if (argvValue === true || argvValue === 'true') {
if (argvKey === 'disable-hardware-acceleration') {
app.disableHardwareAcceleration(); // needs to be called explicitly
} else {
app.commandLine.appendSwitch(argvKey);
}
}

// ozone platform
else if (argvKey === 'ozone-platform') {
if (argvValue) {
app.commandLine.appendSwitch(argvKey, argvValue);
app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform');
Copy link
Contributor

@vially vially Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UseOzonePlatform feature no longer needs to be explicitly enabled since a couple of Electron releases ago, so this can be safely removed.

Suggested change
app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform');

}
}
}

// Append main process flags to process.argv
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/electron-sandbox/desktop.contribution.ts
Expand Up @@ -317,6 +317,10 @@ import { TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry';
type: 'boolean',
description: localize('argv.force-renderer-accessibility', 'Forces the renderer to be accessible. ONLY change this if you are using a screen reader on Linux. On other platforms the renderer will automatically be accessible. This flag is automatically set if you have editor.accessibilitySupport: on.'),
};
schema.properties!['ozone-platform'] = {
type: 'string',
description: localize('argv.ozone-platform', "Configures the ozone platform implementation to be used by the runtime. Allowed values are 'wayland', 'x11'."),
};
}

jsonRegistry.registerSchema(argvDefinitionFileSchemaId, schema);
Expand Down