From cd9a442fe1c069c9053c563bd9baa53cdd24ea37 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Fri, 23 Oct 2020 15:42:49 +0300 Subject: [PATCH] Allowing to disable hardware acceleration Signed-off-by: Alex Andreev --- src/common/user-store.ts | 1 + src/main/index.ts | 7 ++++++- .../components/+preferences/preferences.tsx | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/common/user-store.ts b/src/common/user-store.ts index f7d3ade005..f2adeac3b6 100644 --- a/src/common/user-store.ts +++ b/src/common/user-store.ts @@ -27,6 +27,7 @@ export interface UserPreferences { downloadKubectlBinaries?: boolean; downloadBinariesPath?: string; kubectlBinariesPath?: string; + disableHardwareAcceleration?: boolean; } export class UserStore extends BaseStore { diff --git a/src/main/index.ts b/src/main/index.ts index e4fd246467..adc9be2d10 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -56,7 +56,6 @@ async function main() { // preload configuration from stores await Promise.all([ - userStore.load(), clusterStore.load(), workspaceStore.load(), ]); @@ -77,6 +76,12 @@ async function main() { windowManager = new WindowManager(proxyPort); } +// Disable hardware acceleration if flag is checked in Preferences +userStore.load(); +if (userStore.preferences.disableHardwareAcceleration) { + app.disableHardwareAcceleration(); +} + app.on("ready", main); app.on("will-quit", async (event) => { diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index a1b86c19cd..1292c69dca 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -17,6 +17,7 @@ import { themeStore } from "../../theme.store"; import { history } from "../../navigation"; import { Tooltip } from "../tooltip"; import { KubectlBinaries } from "./kubectl-binaries"; +import { isMac } from "../../../common/vars"; @observer export class Preferences extends React.Component { @@ -194,6 +195,21 @@ export class Preferences extends React.Component { Telemetry & usage data is collected to continuously improve the Lens experience. + + {isMac && ( + <> +

Hardware Acceleration

+ Disable hardware acceleration} + value={preferences.disableHardwareAcceleration} + onChange={v => preferences.disableHardwareAcceleration = v} + /> + + Enabled hardware acceleration can cause rendering issues on some devices with the MacOS.
+ You need to restart the app to activate the changes. +
+ + )} );