Summary
The Electron app icon handling is inconsistent across runtime and packaged builds. On macOS specifically, the Dock app icon does not reflect the intended application icon during development and at runtime.
Problem Description
Current Behavior
In frontend/src/main.ts, the icon is only passed through:
BrowserWindow({ icon: windowIconPath() })
Root Causes
BrowserWindow({ icon }) does not control the macOS Dock icon
- The
BrowserWindow.icon option is only for the window itself, not the app in the Dock
- Missing macOS-specific runtime handler
- macOS requires
app.dock.setIcon(...) at runtime to display the correct Dock icon during development
- Without this, the dev/runtime Dock icon cannot use the intended asset
Proposed Solution
Implementation Steps
- Import
nativeImage in frontend/src/main.ts
import { nativeImage } from 'electron';
- Create a runtime helper function to load the icon
- Load
frontend/assets/icon.png in dev mode
- Load
process.resourcesPath/icon.png in packaged builds
- Example:
function getIconPath(): string {
if (isDev) {
return path.join(__dirname, '../assets/icon.png');
} else {
return path.join(process.resourcesPath, 'icon.png');
}
}
- Set the macOS Dock icon at runtime
- Call
app.dock.setIcon(nativeImage.createFromPath(iconPath)) after app.whenReady()
- Execute this before creating the first window
- Example:
app.whenReady().then(() => {
if (process.platform === 'darwin') {
const iconPath = getIconPath();
app.dock.setIcon(nativeImage.createFromPath(iconPath));
}
createWindow();
});
- Update icon asset
- Ensure
frontend/assets/icon.png has proper transparent rounded corners
- Verify the asset follows macOS app icon design guidelines
Expected Outcomes
- ✅ Consistent icon display across Windows, Linux, and macOS
- ✅ Correct Dock icon on macOS during development and at runtime
- ✅ Proper icon appearance in packaged builds
- ✅ Professional appearance with rounded corners on all platforms
Summary
The Electron app icon handling is inconsistent across runtime and packaged builds. On macOS specifically, the Dock app icon does not reflect the intended application icon during development and at runtime.
Problem Description
Current Behavior
In
frontend/src/main.ts, the icon is only passed through:Root Causes
BrowserWindow({ icon })does not control the macOS Dock iconBrowserWindow.iconoption is only for the window itself, not the app in the Dockapp.dock.setIcon(...)at runtime to display the correct Dock icon during developmentProposed Solution
Implementation Steps
nativeImageinfrontend/src/main.tsfrontend/assets/icon.pngin dev modeprocess.resourcesPath/icon.pngin packaged buildsapp.dock.setIcon(nativeImage.createFromPath(iconPath))afterapp.whenReady()frontend/assets/icon.pnghas proper transparent rounded cornersExpected Outcomes