merge both enable-features and disable-features flags

This commit is contained in:
takase1121 2024-04-21 07:40:33 +08:00
parent 9d376832d1
commit 48fbca26a8
No known key found for this signature in database
GPG key ID: 60EEFFC68EB3031B

View file

@ -27,12 +27,13 @@ process.env.VENCORD_USER_DATA_DIR = DATA_DIR;
function init() { function init() {
const { disableSmoothScroll, hardwareAcceleration } = Settings.store; const { disableSmoothScroll, hardwareAcceleration } = Settings.store;
const enableFeatures: string[] = []; const enabledFeatures = app.commandLine.getSwitchValue("enable-features").split(",");
const disabledFeatures = app.commandLine.getSwitchValue("disable-features").split(",");
if (hardwareAcceleration === false) { if (hardwareAcceleration === false) {
app.disableHardwareAcceleration(); app.disableHardwareAcceleration();
} else { } else {
enableFeatures.push("VaapiVideoDecodeLinuxGL", "VaapiVideoEncoder", "VaapiVideoDecoder"); enabledFeatures.push("VaapiVideoDecodeLinuxGL", "VaapiVideoEncoder", "VaapiVideoDecoder");
} }
if (disableSmoothScroll) { if (disableSmoothScroll) {
@ -45,15 +46,15 @@ function init() {
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service. // HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
// //
// WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790 // WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790
app.commandLine.appendSwitch( disabledFeatures.push(
"disable-features", "WinRetrieveSuggestionsOnlyOnDemand",
"WinRetrieveSuggestionsOnlyOnDemand,HardwareMediaKeyHandling,MediaSessionService,WidgetLayering" "HardwareMediaKeyHandling",
"MediaSessionService",
"WidgetLayering"
); );
// don't overwrite command-line supplied switches app.commandLine.appendSwitch("enable-features", [...new Set(enabledFeatures)].filter(Boolean).join(","));
if (!app.commandLine.hasSwitch("enable-features")) { app.commandLine.appendSwitch("disable-features", [...new Set(disabledFeatures)].filter(Boolean).join(","));
app.commandLine.appendSwitch("enable-features", enableFeatures.join(","));
}
// In the Flatpak on SteamOS the theme is detected as light, but SteamOS only has a dark mode, so we just override it // In the Flatpak on SteamOS the theme is detected as light, but SteamOS only has a dark mode, so we just override it
if (isDeckGameMode) nativeTheme.themeSource = "dark"; if (isDeckGameMode) nativeTheme.themeSource = "dark";