mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token";
|
|
import environmentVariablesInjectable from "../../../../common/utils/environment-variables.injectable";
|
|
import disableHardwareAccelerationInjectable from "../../../electron-app/features/disable-hardware-acceleration.injectable";
|
|
|
|
const setupHardwareAccelerationInjectable = getInjectable({
|
|
id: "setup-hardware-acceleration",
|
|
|
|
instantiate: (di) => {
|
|
const { LENS_DISABLE_GPU: hardwareAccelerationShouldBeDisabled } = di.inject(environmentVariablesInjectable);
|
|
const disableHardwareAcceleration = di.inject(disableHardwareAccelerationInjectable);
|
|
|
|
return {
|
|
run: () => {
|
|
if (hardwareAccelerationShouldBeDisabled) {
|
|
disableHardwareAcceleration();
|
|
}
|
|
},
|
|
};
|
|
},
|
|
|
|
injectionToken: afterApplicationIsReadyInjectionToken,
|
|
});
|
|
|
|
export default setupHardwareAccelerationInjectable;
|