diff --git a/build/logo-dev.png b/build/logo-dev.png new file mode 100644 index 00000000000..0369e2b8027 Binary files /dev/null and b/build/logo-dev.png differ diff --git a/src/main/services/WindowService.ts b/src/main/services/WindowService.ts index 2ec8de6a3e2..89eee6381c6 100644 --- a/src/main/services/WindowService.ts +++ b/src/main/services/WindowService.ts @@ -12,6 +12,7 @@ import windowStateKeeper from 'electron-window-state' import { join } from 'path' import iconPath from '../../../build/icon.png?asset' +import logoDevPath from '../../../build/logo-dev.png?asset' import { titleBarOverlayDark, titleBarOverlayLight } from '../config' import { configManager } from './ConfigManager' import { contextMenu } from './ContextMenu' @@ -23,8 +24,16 @@ const DEFAULT_MINIWINDOW_HEIGHT = 400 // const logger = loggerService.withContext('WindowService') const logger = loggerService.withContext('WindowService') -// Create nativeImage for Linux window icon (required for Wayland) -const linuxIcon = isLinux ? nativeImage.createFromPath(iconPath) : undefined +// Window icon for taskbar/title bar — only meaningful on Windows and Linux. +// macOS ignores the BrowserWindow `icon` option; dock icon is managed separately via app.dock.setIcon(). +// Windows production: icon is embedded in the .exe by electron-builder, no override needed. +function createAppIcon() { + if (isMac) return undefined + if (isDev) return nativeImage.createFromPath(logoDevPath) + if (isLinux) return nativeImage.createFromPath(iconPath) + return undefined +} +const appIcon = createAppIcon() export class WindowService { private static instance: WindowService | null = null @@ -83,7 +92,7 @@ export class WindowService { }), backgroundColor: isMac ? undefined : nativeTheme.shouldUseDarkColors ? '#181818' : '#FFFFFF', darkTheme: nativeTheme.shouldUseDarkColors, - ...(isLinux ? { icon: linuxIcon } : {}), + ...(appIcon ? { icon: appIcon } : {}), webPreferences: { preload: join(__dirname, '../preload/index.js'), sandbox: false, @@ -97,6 +106,11 @@ export class WindowService { this.setupMainWindow(this.mainWindow, mainWindowState) + // Set macOS dock icon in dev mode (production uses the .icns from the app bundle). + if (isDev && isMac) { + app.dock?.setIcon(logoDevPath) + } + //preload miniWindow to resolve series of issues about miniWindow in Mac const enableQuickAssistant = configManager.getEnableQuickAssistant() if (enableQuickAssistant && !this.miniWindow) {