Skip to content

fix: Set (blink) feature flags one time #884

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

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

lbrooney
Copy link
Contributor

@lbrooney lbrooney commented Apr 4, 2025

In Chrome feature flags are meant to be set a single time with each desired flag seperated by commas. In the case where there are multiple enable-feature switches only the last one is used. At least I'm pretty sure based on what I read online and looking at the Chromium source code, I believe each time an enable-feature switch is seen it just overwrites the previously set value.

Ex:

# WRONG, WebRTCPipeWireCapturer is the only used value.
electron --enable-features=PulseaudioLoopbackForScreenShare --enable-features=WebRTCPipeWireCapturer ...
# RIGHT
electron --enable-features=PulseaudioLoopbackForScreenShare,WebRTCPipeWireCapturer ...

This PR essentially just stores the different the enable-feature switch values in a set instead of appending them immediately and at the end joins them together with commas and appends them. I extended this as well to disable-features, enable-blink-features, and disable-blink-features. I'm thinking of removing the disable-blink-features part, as Legcord doesn't set any flags on it. I was almost tempted to also add something for enable-hardware-overlays as it's used in the performance preset, but I restrained as I felt there's not much usecase and I didn't want to add another thing to the Preset type.

Unfortunately I had to stray into flags.ts to modify how the presets are applied to work with this, but I don't see how else I could have worked with it.

I have only tested this locally on my Arch install and I've noticed no issues based off of VERY brief testing. It works with the legcord-flags.conf pattern Arch does.

My workflow was mostly launching Legcord with --inspect and then using Chrome remote dev tools to run:

const { BrowserWindow } = require('electron');const win = new BrowserWindow();win.loadURL('chrome://gpu');

To see what the command line args were.

PS: I got hardware decoding working by following the same instructions for Chrome by doing --ozone-platform-hint=auto --enable-features=AcceleratedVideoDecodeLinuxGL

@smartfrigde smartfrigde merged commit f1ae18c into Legcord:dev Apr 4, 2025
@smartfrigde
Copy link
Member

Thank you!

@lbrooney lbrooney deleted the flag-parsing branch May 1, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants