On MacOS the icon entry in packagerConfig is ignored
hsk81 opened this issue · comments
I've the following configuration in my package.json
:
"config": {
"forge": {
"makers": [
{
"name": "@electron-forge/maker-dmg"
},
{
"name": "@electron-forge/maker-squirrel"
},
{
"name": "@electron-forge/maker-zip"
}
],
"packagerConfig": {
"icon": "./assets/icons/api-2#016ed84e/img/128x128"
}
}
},
where the assets
folder looks like below:
% ls -lh assets/icons/api-2\#016ed84e/img/128x128.*
-rw-r--r-- 1 7.3K assets/icons/api-2#016ed84e/img/128x128.icns
-rw-r--r-- 1 66K assets/icons/api-2#016ed84e/img/128x128.ico
-rw-r--r-- 1 6.2K assets/icons/api-2#016ed84e/img/128x128.png
I'm somehow under the impression, than when I run now npm run make
under MacOS, then the .icns
file suffix gets auto-magically appended to the value of icon
, which is then used by the @electron-forge/maker-dmg
maker.
However, I'm simply unable to have the default value of electron.icns
for CFBundleIconFile
changed to my assets/.../128x128.icns
in the resulting Info.plist
, which is listed below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18E226</string>
<key>CFBundleDisplayName</key>
<string>API Explorer</string>
<key>CFBundleExecutable</key>
<string>API Explorer</string>
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleIdentifier</key>
<string>com.electron.api-explorer</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>API Explorer</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<key>CFBundleVersion</key>
<string>1.0.1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTSDKBuild</key>
<string>10.15</string>
<key>DTSDKName</key>
<string>macosx10.15</string>
<key>DTXcode</key>
<string>1110</string>
<key>DTXcodeBuild</key>
<string>11A1027</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>10.10.0</string>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to the microphone</string>
<key>NSPrincipalClass</key>
<string>AtomApplication</string>
<key>NSQuitAlwaysKeepsWindows</key>
<false/>
<key>NSRequiresAquaSystemAppearance</key>
<false/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>
Even, when I provide the full icon name like below it does not work:
"packagerConfig": {
"icon": "./assets/icons/api-2#016ed84e/img/128x128.icns"
}
Is this is bug, or am I operating under wrong assumptions? I also tried the following approach without any success:
"config": {
"forge": {
"makers": [
{
"config": {
"icon": "./assets/icons/api-2#016eaa4f7069c01b91bd21b68170d84e/img/128x128.icns"
},
"name": "@electron-forge/maker-dmg"
},
{
"name": "@electron-forge/maker-squirrel"
},
{
"name": "@electron-forge/maker-zip"
}
],
"packagerConfig": {
"icon": "./assets/icons/api-2#016eaa4f7069c01b91bd21b68170d84e/img/128x128"
}
}
},
electron-installer-dmg
does not read from forge.config.packagerConfig
. That's an Electron Forge specific configuration option. That being said, I don't know why it wouldn't be picking up the icon configuration in the maker-dmg config, but I can't really look into this issue as I don't currently own a Mac.
Nothing would work, I even went under node_modules
in the electron-installer-dmg
and hardcoded the icon
value, which failed to produced the desired result. As far as I can judge, there seem to be two issues here:
- the dependency
electron-installer-dmg
is using to generate the DMG is simply ignoring theicon
; and - the
electron-installer-dmg
is ignoring itself theicon
entry and not forwarding it to its dependency.
I borrowed a Mac and I can't reproduce this. Steps to reproduce:
npx --no-install --ignore-existing create-electron-app testdmg
cd testdmg
yarn add --dev @electron-forge/maker-dmg
mkdir assets
# download some square icon png to assets/icon.png
makeicns -in assets/icon.png -out assets/icon.icns
# Optional: add to config.forge.packagerConfig: "icon": "./assets.icon.icns"
# Add to config.forge.makers: { "name": "@electron-forge/maker-dmg", "config": { "icon": "./assets/icon.icns" }
yarn make
# Double click on out/make/testdmg-1.0.0.dmg
Results: The custom icon shows up on the desktop as the disk image, the disk image window icon, and as the app icon on the left hand side to drag to the Applications folder.
Since I can't reproduce this behavior, I'm closing the issue. If you can provide exact, minimal repro steps and someone else is able to verify the same behavior you're seeing, we can discuss reopening this issue.