From 4b665dec902c5deb13a9d3cd8950e0795683c0bb Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 25 Sep 2024 10:08:15 -0700 Subject: [PATCH] Add setting to disable Chromium hardware acceleration (#847) --- emain/emain.ts | 5 +++++ frontend/types/gotypes.d.ts | 1 + pkg/wconfig/metaconsts.go | 1 + pkg/wconfig/settingsconfig.go | 17 +++++++++-------- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/emain/emain.ts b/emain/emain.ts index 1505d6547..1e0327579 100644 --- a/emain/emain.ts +++ b/emain/emain.ts @@ -852,6 +852,11 @@ async function appMain() { fs.mkdirSync(waveHomeDir); } makeAppMenu(); + const fullConfig = await services.FileService.GetFullConfig(); + const settings = fullConfig.settings; + if (settings?.["window:disablehardwareacceleration"]) { + electronApp.disableHardwareAcceleration(); + } try { await runWaveSrv(); } catch (e) { diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index deb0c3acc..3f29a3e04 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -440,6 +440,7 @@ declare global { "window:reducedmotion"?: boolean; "window:tilegapsize"?: number; "window:nativetitlebar"?: boolean; + "window:disablehardwareacceleration"?: boolean; "telemetry:*"?: boolean; "telemetry:enabled"?: boolean; }; diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index dc856f70b..a9669a419 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -47,6 +47,7 @@ const ( ConfigKey_WindowReducedMotion = "window:reducedmotion" ConfigKey_WindowTileGapSize = "window:tilegapsize" ConfigKey_WindowNativeTitleBar = "window:nativetitlebar" + ConfigKey_WindowDisableHardwareAcceleration = "window:disablehardwareacceleration" ConfigKey_TelemetryClear = "telemetry:*" ConfigKey_TelemetryEnabled = "telemetry:enabled" diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 2196fe364..6be7ee044 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -73,14 +73,15 @@ type SettingsType struct { WidgetClear bool `json:"widget:*,omitempty"` WidgetShowHelp bool `json:"widget:showhelp,omitempty"` - WindowClear bool `json:"window:*,omitempty"` - WindowTransparent bool `json:"window:transparent,omitempty"` - WindowBlur bool `json:"window:blur,omitempty"` - WindowOpacity *float64 `json:"window:opacity,omitempty"` - WindowBgColor string `json:"window:bgcolor,omitempty"` - WindowReducedMotion bool `json:"window:reducedmotion,omitempty"` - WindowTileGapSize *int64 `json:"window:tilegapsize,omitempty"` - WindowNativeTitleBar bool `json:"window:nativetitlebar,omitempty"` + WindowClear bool `json:"window:*,omitempty"` + WindowTransparent bool `json:"window:transparent,omitempty"` + WindowBlur bool `json:"window:blur,omitempty"` + WindowOpacity *float64 `json:"window:opacity,omitempty"` + WindowBgColor string `json:"window:bgcolor,omitempty"` + WindowReducedMotion bool `json:"window:reducedmotion,omitempty"` + WindowTileGapSize *int64 `json:"window:tilegapsize,omitempty"` + WindowNativeTitleBar bool `json:"window:nativetitlebar,omitempty"` + WindowDisableHardwareAcceleration bool `json:"window:disablehardwareacceleration,omitempty"` TelemetryClear bool `json:"telemetry:*,omitempty"` TelemetryEnabled bool `json:"telemetry:enabled,omitempty"`