Skip to content

The agent that grows with you

fix(desktop): keep the bundle Dock icon in packaged macOS builds

brooklyn!d5c446e18c99
diff --git a/apps/desktop/electron/app-icon.test.ts b/apps/desktop/electron/app-icon.test.ts
index 3dde0499492..580d569254e 100644
--- a/apps/desktop/electron/app-icon.test.ts
+++ b/apps/desktop/electron/app-icon.test.ts
@@ -5,7 +5,7 @@ import path from 'node:path'
import { test } from 'vitest'
-import { appIconCandidates, decodingFileProbe, resolveAppIcon } from './app-icon'
+import { appIconCandidates, decodingFileProbe, resolveAppIcon, shouldOverrideDockIcon } from './app-icon'
// Regression: a packaged app.asar can contain a TRUNCATED apple-touch-icon.png
// (interrupted electron-builder run, partial copy). Electron's
@@ -124,3 +124,22 @@ test('appIconCandidates keeps the documented precedence ladder', () => {
'resources/ icon.ico is the highest-precedence Windows rung'
)
})
+
+// #73195: a runtime app.dock.setIcon(png) replaces the bundle's icon for the
+// life of the process, so macOS 26 cannot apply the Clear/Tinted Liquid Glass
+// styles to it. A packaged .app already carries the Hermes icon; only dev runs
+// (the stock Electron bundle) need the runtime override.
+test('shouldOverrideDockIcon leaves a packaged macOS app on its bundle icon', () => {
+ assert.equal(shouldOverrideDockIcon({ platform: 'darwin', isPackaged: true }), false)
+})
+
+test('shouldOverrideDockIcon still brands the dock in a macOS dev run', () => {
+ assert.equal(shouldOverrideDockIcon({ platform: 'darwin', isPackaged: false }), true)
+})
+
+test('shouldOverrideDockIcon never applies off macOS (there is no dock)', () => {
+ for (const platform of ['win32', 'linux'] as const) {
+ assert.equal(shouldOverrideDockIcon({ platform, isPackaged: false }), false)
+ assert.equal(shouldOverrideDockIcon({ platform, isPackaged: true }), false)
+ }
+})
diff --git a/apps/desktop/electron/app-icon.ts b/apps/desktop/electron/app-icon.ts
index 52ad24f197b..a7e763414f8 100644
--- a/apps/desktop/electron/app-icon.ts
+++ b/apps/desktop/electron/app-icon.ts
@@ -86,3 +86,17 @@ export function appIconCandidates(opts: {
path.join(appRoot, 'dist', 'apple-touch-icon.png')
]
}
+
+/**
+ * Whether to replace the macOS Dock icon at runtime with `app.dock.setIcon()`.
+ *
+ * A packaged `.app` already carries the Hermes icon in its bundle
+ * (electron-builder `build.icon`). Overriding it with a flat PNG at runtime
+ * hides that bundle icon for the life of the process, so macOS 26 can't apply
+ * the Clear/Tinted Liquid Glass styles to it (#73195). Only a dev run needs the
+ * override: there the bundle is the stock Electron.app and the Dock would show
+ * the Electron logo.
+ */
+export function shouldOverrideDockIcon(opts: { platform: NodeJS.Platform; isPackaged: boolean }): boolean {
+ return opts.platform === 'darwin' && !opts.isPackaged
+}
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index bae82cc4c87..815971187e3 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -42,7 +42,7 @@ import {
readStatusCode,
withRetry
} from './api-transport'
-import { appIconCandidates, resolveAppIcon } from './app-icon'
+import { appIconCandidates, resolveAppIcon, shouldOverrideDockIcon } from './app-icon'
import { installApplicationMenuAfterFirstWindow } from './application-menu-startup'
import {
stopBackendChild as stopBackendChildImpl,
@@ -15266,7 +15266,8 @@ function createWindow() {
if (IS_MAC) {
mainWindow.setWindowButtonPosition?.(WINDOW_BUTTON_POSITION)
- if (icon) {
+ // Packaged builds keep the bundle icon so macOS can style it (#73195).
+ if (icon && shouldOverrideDockIcon({ platform: process.platform, isPackaged: app.isPackaged })) {
app.dock?.setIcon(icon)
}
}