mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Extract tray icon path as injectable
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
76e6718874
commit
0d41eabb64
26
src/main/tray/tray-icon-path.injectable.ts
Normal file
26
src/main/tray/tray-icon-path.injectable.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 getAbsolutePathInjectable from "../../common/path/get-absolute-path.injectable";
|
||||
import isDevelopmentInjectable from "../../common/vars/is-development.injectable";
|
||||
import staticFilesDirectoryInjectable from "../../common/vars/static-files-directory.injectable";
|
||||
|
||||
const trayIconPathInjectable = getInjectable({
|
||||
id: "tray-icon-path",
|
||||
|
||||
instantiate: (di) => {
|
||||
const getAbsolutePath = di.inject(getAbsolutePathInjectable);
|
||||
const isDevelopment = di.inject(isDevelopmentInjectable);
|
||||
const staticDir = di.inject(staticFilesDirectoryInjectable);
|
||||
|
||||
return getAbsolutePath(
|
||||
staticDir,
|
||||
isDevelopment ? "../build/tray" : "icons", // copied within electron-builder extras
|
||||
"trayIconTemplate.png",
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
export default trayIconPathInjectable;
|
||||
@ -10,6 +10,7 @@ import navigateToPreferencesInjectable from "../../common/front-end-routing/rout
|
||||
import stopServicesAndExitAppInjectable from "../stop-services-and-exit-app.injectable";
|
||||
import { getStartableStoppable } from "../../common/utils/get-startable-stoppable";
|
||||
import isAutoUpdateEnabledInjectable from "../is-auto-update-enabled.injectable";
|
||||
import trayIconPathInjectable from "./tray-icon-path.injectable";
|
||||
|
||||
const trayInjectable = getInjectable({
|
||||
id: "tray",
|
||||
@ -20,6 +21,7 @@ const trayInjectable = getInjectable({
|
||||
const navigateToPreferences = di.inject(navigateToPreferencesInjectable);
|
||||
const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable);
|
||||
const isAutoUpdateEnabled = di.inject(isAutoUpdateEnabledInjectable);
|
||||
const trayIconPath = di.inject(trayIconPathInjectable);
|
||||
|
||||
return getStartableStoppable("build-of-tray", () =>
|
||||
initTray(
|
||||
@ -28,6 +30,7 @@ const trayInjectable = getInjectable({
|
||||
navigateToPreferences,
|
||||
stopServicesAndExitApp,
|
||||
isAutoUpdateEnabled,
|
||||
trayIconPath,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user