asticode / go-astilectron-bundler

Bundle your Astilectron app with ease

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bundle tray icon image into application

nikhilsaraf opened this issue · comments

I'm trying to bundle the image for the tray icon with my deployment, but it fails to copy the tray icon image into the bundled file (MacOS).

This gives an error when trying to start the app because the tray icon is missing in the packaged binary.

I'm certain this should be possible but just couldn't get it to work. I even see the byte-version of the image in the bind_*.go files.

are you using the bootstrap ?

at least the auto generated plst file is ignoring icon paths

<key>CFBundleIconFile</key>
		<string>`+b.appName+filepath.Ext(b.pathIconDarwin)+`</string>

To get around this issue I'm writing out the icon file (png) to disk from the bind file that is generated by the bundler (link to source code). Then I pass the path of that generated icon file to the TrayOptions (link to source code).

If there's a better way to do this such as specifying which files in the resources directory we also want included in the final package that would be very helpful

@khuderm This section of the plst file is for the App icon, not the Tray icon. And no need to take the path into account since the icon has been moved by the bundler.

@nikhilsaraf The path you provide for the Tray is relative to the app directory. As your tray icon must be in the resources folder, the path you set in the bootstrap Options should be resources/path/to/icon.png so in your case resources/kelp-icon@1-8x.png. Does that work better ?

@asticode that didn't work for me and I got the same error because it never copied resources/kelp-icon@1-8x.png into the final resources folder.

Does the app icon gets copied ? resources/kelp-icon@2x.png in your case ?

@asticode yes that gets copied, probably because it’s specified in the bundled.json file (source code)

1 ) Can you run ls -l on your resources folder in your source project and paste results here ?
2) Can you run ls -l on your resources folder in your app located in /path/to/name.app/Contents/MacOS/resources and paste results here as well ?
3) Can you enable astilog at the top of your main function:

flag.Parse()
astilog.FlagInit()

run /path/to/name.app/Contents/MacOS/name -v and paste logs here?
4) Run the bundler with the -v flag and paste logs here?