File tree 2 files changed +15
-13
lines changed
plugins/plugin-codeflare/src/tray
2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,17 @@ import gettingStarted from "@kui-shell/client/icons/png/gettingStartedTemplate.p
26
26
27
27
import { join } from "path"
28
28
29
- const iconHome = process . env . CODEFLARE_HEADLESS || join ( process . argv0 , "../../Resources/app/dist/headless" )
29
+ function resources ( ) {
30
+ return process . platform === "darwin" ? join ( process . argv0 , "../../Resources" ) : join ( process . argv0 , "../resources" )
31
+ }
32
+
33
+ export function iconHome ( ) {
34
+ return process . env . CODEFLARE_HEADLESS || join ( resources ( ) , "app/dist/headless" )
35
+ }
30
36
31
37
/** Resize and templatize, so that the icon morphs with platform color themes */
32
38
function iconFor ( filepath : string ) {
33
- return join ( iconHome , filepath )
39
+ return join ( iconHome ( ) , filepath )
34
40
}
35
41
36
42
export const rayIcon = iconFor ( ray )
Original file line number Diff line number Diff line change 17
17
import { join } from "path"
18
18
import { CreateWindowFunction } from "@kui-shell/core"
19
19
20
+ import { iconHome } from "./icons"
20
21
import buildContextMenu from "./menus"
21
22
import { productName } from "@kui-shell/client/config.d/name.json"
22
23
@@ -87,18 +88,13 @@ export default async function main(createWindow: CreateWindowFunction) {
87
88
try {
88
89
const { Tray } = await import ( "electron" )
89
90
90
- const iconHome = process . env . CODEFLARE_HEADLESS || join ( process . argv0 , "../../Resources/app/dist/headless" )
91
- if ( iconHome ) {
92
- // this forces webpack to include the @2x template images in
93
- // the build
94
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
95
- const fake = "dist/headless/" + icon2x
91
+ // this forces webpack to include the @2x template images in
92
+ // the build
93
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
+ const fake = "dist/headless/" + icon2x
96
95
97
- tray = new Tray ( join ( iconHome , icon ) )
98
- new LiveMenu ( tray , createWindow )
99
- } else {
100
- console . error ( "Cannot register electron tray menu, because CODEFLARE_HEADLESS environment variable is absent" )
101
- }
96
+ tray = new Tray ( join ( iconHome ( ) , icon ) )
97
+ new LiveMenu ( tray , createWindow )
102
98
} catch ( err ) {
103
99
console . error ( "Error registering electron tray menu" , err )
104
100
}
You can’t perform that action at this time.
0 commit comments