mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Reimplement setup for main window visibility using runnables instead of non-OCP in index.ts
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
0bbc97e166
commit
9b5bbb99f9
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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 loggerInjectable from "../../../../common/logger.injectable";
|
||||
import windowManagerInjectable from "../../../window-manager.injectable";
|
||||
import { onApplicationActivationInjectionToken } from "../on-application-activation-injection-token";
|
||||
|
||||
const ensureVisibleMainWindowInjectable = getInjectable({
|
||||
id: "ensure-visible-main-window",
|
||||
|
||||
instantiate: (di) => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const windowManager = di.inject(windowManagerInjectable);
|
||||
|
||||
return {
|
||||
run: ({ hasVisibleWindows }) => {
|
||||
logger.info("APP:ACTIVATE", { hasVisibleWindows });
|
||||
|
||||
if (!hasVisibleWindows) {
|
||||
windowManager.ensureMainWindow(false);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: onApplicationActivationInjectionToken,
|
||||
});
|
||||
|
||||
export default ensureVisibleMainWindowInjectable;
|
||||
Loading…
Reference in New Issue
Block a user