mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
33 lines
1.2 KiB
TypeScript
33 lines
1.2 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 disableHardwareAccelerationInjectable from "../../electron-app/features/disable-hardware-acceleration.injectable";
|
|
import hardwareAccelerationShouldBeDisabledInjectable from "../../vars/hardware-acceleration-should-be-disabled.injectable";
|
|
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
|
|
|
const setupHardwareAccelerationInjectable = getInjectable({
|
|
id: "setup-hardware-acceleration",
|
|
|
|
instantiate: (di) => {
|
|
const hardwareAccelerationShouldBeDisabled = di.inject(hardwareAccelerationShouldBeDisabledInjectable);
|
|
const disableHardwareAcceleration = di.inject(disableHardwareAccelerationInjectable);
|
|
|
|
return {
|
|
id: "setup-hardware-acceleration",
|
|
run: () => {
|
|
if (hardwareAccelerationShouldBeDisabled) {
|
|
disableHardwareAcceleration();
|
|
}
|
|
|
|
return undefined;
|
|
},
|
|
};
|
|
},
|
|
|
|
injectionToken: beforeElectronIsReadyInjectionToken,
|
|
});
|
|
|
|
export default setupHardwareAccelerationInjectable;
|