Open Covkie opened 2 months ago
I took a quick look at the code and it looks like the linux packages execute https://github.com/develar/app-builder with a path to the icon-set. The icon-set itself is also generated by app-builder.
Out of curiosity, where would the icon-set go in the unpacked step? I'm not familiar with vesktop/-git
or AUR.
Ideally the icon-set would just be in the unpacked folder and packagers can deal with it from there.
If I'm understanding correctly, I think the afterPack
could work nicely for you in this case. That or another one of the available hooks. This copies what the linux target is doing under-the-hood when calculating the desktop entries.
async afterPack(context: AfterPackContext) {
const packager = context.packager
const { platformSpecificBuildOptions, config } = packager
const sources = [platformSpecificBuildOptions.icon, config.mac?.icon ?? config.icon].filter(str => !!str) as string[]
// If no explicit sources are defined, fallback to buildResources directory, then default framework icon
let fallbackSources = [packager.getDefaultFrameworkIcon()!]
const buildResources = config.directories?.buildResources
if (buildResources && existsSync(join(buildResources, "icons"))) {
fallbackSources = [buildResources, ...fallbackSources]
}
const result = await packager.resolveIcon(sources, fallbackSources, "set")
// do something with result. output is in config.directories.output dir
},
Let me know if the above ☝️ works for you and I can pull out a common helper function for fetching icons from the packager for all platforms
I've finally gotten around to attempting your suggestion but I do not know what you want me to do with the provided snippet
It's an afterPack
hook. You can either add it to an electron-builder js config file directly, or save it to a js script that you then set the path to from project root.
https://www.electron.build/configuration/configuration#afterpack
alr its working and generating the .icon-set
When building to unpacked no icons are generated from the specified
icon.icns
in the package.json resulting in missing or wrong icons used when building locally seevesktop
/-git
on the AUR. (unpacked is used in the -git package as it is much faster than compressing & installing) This also causes distributed tars of the application by the developer to be missing icons in the tar as instead they are generated to.icon-set
externally which defeats the point of the tar.Solution: move the generation of the
.icon-set
stage to the unpacked generation behind an argument for cases like thevesktop-git
package and enable it by default for tar generation. See vencord/vesktop#691 for why generating the icons from the .icns file locally withicns2png
isn't an adequate solution.