diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7121eac..271965ca 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ All notable changes to DreamCoder will be documented in this file.
### Changed
+- **New app icon.** The app, Dock, taskbar and tray icons and the logo inside the app are redrawn: a warm-white crescent prompt and an amber star on an ink-blue tile. On macOS the menu bar icon is now a template image, so it follows the light or dark menu bar. The interface colors are unchanged. (#292)
- Thinking text in a streaming reply is batched like the reply text, so a long thinking block updates the conversation once per 50 ms instead of on every chunk (#258). Thanks @iruzen-dono.
- **Providers in OpenAI format reuse their prompt cache.** Later turns of a session now hit the cache for about 99% of the input (measured on OpenRouter with GPT-4.1 mini and GLM-4.6), and cache hits that DeepSeek and Moonshot report are counted as cache reads (#262).
- Providers in OpenAI format can run several tool calls in one step and get tool definitions without schema fields they do not use, and replies show the model you chose instead of the dated version the provider reports (#262).
diff --git a/desktop/electron-builder.json b/desktop/electron-builder.json
index 4884361e..476c8e1c 100644
--- a/desktop/electron-builder.json
+++ b/desktop/electron-builder.json
@@ -30,8 +30,11 @@
"to": "web-clone"
},
{
- "from": "electron/build/icons/tray.png",
- "to": "icons/tray.png"
+ "from": "electron/build/icons",
+ "to": "icons",
+ "filter": [
+ "tray*.png"
+ ]
},
{
"from": "../THIRD_PARTY_NOTICES.md",
diff --git a/desktop/electron/build/app-icon-macos.svg b/desktop/electron/build/app-icon-macos.svg
deleted file mode 100644
index 05a6e427..00000000
--- a/desktop/electron/build/app-icon-macos.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/desktop/electron/build/app-icon-small.svg b/desktop/electron/build/app-icon-small.svg
new file mode 100644
index 00000000..9e3896e5
--- /dev/null
+++ b/desktop/electron/build/app-icon-small.svg
@@ -0,0 +1,43 @@
+
diff --git a/desktop/electron/build/app-icon-tile.svg b/desktop/electron/build/app-icon-tile.svg
new file mode 100644
index 00000000..b4c087cf
--- /dev/null
+++ b/desktop/electron/build/app-icon-tile.svg
@@ -0,0 +1,51 @@
+
diff --git a/desktop/electron/build/app-icon.png b/desktop/electron/build/app-icon.png
index 6a6440a3..eb257fad 100644
Binary files a/desktop/electron/build/app-icon.png and b/desktop/electron/build/app-icon.png differ
diff --git a/desktop/electron/build/app-icon.svg b/desktop/electron/build/app-icon.svg
index ceb86acf..0e891b34 100644
--- a/desktop/electron/build/app-icon.svg
+++ b/desktop/electron/build/app-icon.svg
@@ -1,10 +1,51 @@
diff --git a/desktop/electron/build/icons/icon.icns b/desktop/electron/build/icons/icon.icns
index 77138af6..db1f6603 100644
Binary files a/desktop/electron/build/icons/icon.icns and b/desktop/electron/build/icons/icon.icns differ
diff --git a/desktop/electron/build/icons/icon.ico b/desktop/electron/build/icons/icon.ico
index 2bef74bf..326d4012 100644
Binary files a/desktop/electron/build/icons/icon.ico and b/desktop/electron/build/icons/icon.ico differ
diff --git a/desktop/electron/build/icons/tray.png b/desktop/electron/build/icons/tray.png
index 0ec85ba8..6757c5c7 100644
Binary files a/desktop/electron/build/icons/tray.png and b/desktop/electron/build/icons/tray.png differ
diff --git a/desktop/electron/build/icons/tray@2x.png b/desktop/electron/build/icons/tray@2x.png
new file mode 100644
index 00000000..5baecc34
Binary files /dev/null and b/desktop/electron/build/icons/tray@2x.png differ
diff --git a/desktop/electron/build/icons/trayTemplate.png b/desktop/electron/build/icons/trayTemplate.png
new file mode 100644
index 00000000..ea9d9c43
Binary files /dev/null and b/desktop/electron/build/icons/trayTemplate.png differ
diff --git a/desktop/electron/build/icons/trayTemplate@2x.png b/desktop/electron/build/icons/trayTemplate@2x.png
new file mode 100644
index 00000000..4ddcb068
Binary files /dev/null and b/desktop/electron/build/icons/trayTemplate@2x.png differ
diff --git a/desktop/electron/build/tray-icon.svg b/desktop/electron/build/tray-icon.svg
new file mode 100644
index 00000000..9a0a4622
--- /dev/null
+++ b/desktop/electron/build/tray-icon.svg
@@ -0,0 +1,6 @@
+
diff --git a/desktop/electron/main.ts b/desktop/electron/main.ts
index 30dea8b0..1e306c7e 100644
--- a/desktop/electron/main.ts
+++ b/desktop/electron/main.ts
@@ -86,6 +86,7 @@ const CONTENT_SECURITY_POLICY = [
const WINDOW_STATE_SAVE_DELAY_MS = 300
const IS_MAC = process.platform === 'darwin'
const IS_WINDOWS = process.platform === 'win32'
+const TRAY_ICON = IS_MAC ? 'trayTemplate.png' : 'tray.png'
protocol.registerSchemesAsPrivileged([
{ scheme: APP_SCHEME, privileges: { standard: true, secure: true, supportFetchAPI: true, corsEnabled: true } },
@@ -136,7 +137,7 @@ function resolvePaths(): AppPaths {
h5DistDir: dist,
webDist: dist,
artifactShellDir: path.join(dist, ARTIFACT_SHELL_DIRNAME),
- trayIcon: path.join(process.resourcesPath, 'icons', 'tray.png'),
+ trayIcon: path.join(process.resourcesPath, 'icons', TRAY_ICON),
}
}
const desktopRoot = path.resolve(app.getAppPath(), '..')
@@ -146,7 +147,7 @@ function resolvePaths(): AppPaths {
h5DistDir: dist,
webDist: dist,
artifactShellDir: path.join(desktopRoot, 'public', ARTIFACT_SHELL_DIRNAME),
- trayIcon: path.join(desktopRoot, 'electron', 'build', 'icons', 'tray.png'),
+ trayIcon: path.join(desktopRoot, 'electron', 'build', 'icons', TRAY_ICON),
}
}
@@ -574,7 +575,7 @@ function installTray(iconPath: string) {
console.error(`[electron] tray icon not found at ${iconPath}`)
return
}
- tray = new Tray(image.resize({ width: IS_MAC ? 18 : 16, height: IS_MAC ? 18 : 16 }))
+ tray = new Tray(image)
tray.setToolTip('DreamCoder')
const menu = Menu.buildFromTemplate([
{ label: 'Show DreamCoder', click: showMainWindow },
diff --git a/desktop/package.json b/desktop/package.json
index 87447891..586377a4 100644
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -22,6 +22,7 @@
"build:showai-reader": "bun ../vendor/showai/build-reader.ts dist/showai-reader",
"build:sidecars": "bun run ./scripts/build-sidecars.ts",
"build:electron": "bun run ./scripts/build-electron.ts",
+ "build:icons": "bun run ./scripts/generate-icons.ts",
"electron:install": "node node_modules/electron/install.js",
"electron:dev": "bun run ./scripts/electron-dev.ts",
"electron:start": "bun run build:electron && electron electron-dist",
diff --git a/desktop/public/app-icon.png b/desktop/public/app-icon.png
index 6a6440a3..eb257fad 100644
Binary files a/desktop/public/app-icon.png and b/desktop/public/app-icon.png differ
diff --git a/desktop/public/app-icon.svg b/desktop/public/app-icon.svg
deleted file mode 100644
index ceb86acf..00000000
--- a/desktop/public/app-icon.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
diff --git a/desktop/scripts/generate-icons.test.ts b/desktop/scripts/generate-icons.test.ts
new file mode 100644
index 00000000..f30cae56
--- /dev/null
+++ b/desktop/scripts/generate-icons.test.ts
@@ -0,0 +1,76 @@
+import { existsSync, readFileSync } from 'node:fs'
+import path from 'node:path'
+
+import { Resvg } from '@resvg/resvg-js'
+import { describe, expect, it } from 'vitest'
+
+import { onMacGrid, packIco, pixelTile, render, tileOnly } from './generate-icons'
+
+const buildDir = path.resolve(import.meta.dirname, '..', 'electron', 'build')
+const master = (name: string) => readFileSync(path.join(buildDir, name), 'utf8')
+
+function pngSize(png: Uint8Array) {
+ const view = new DataView(png.buffer, png.byteOffset, png.byteLength)
+ return [view.getUint32(16), view.getUint32(20)]
+}
+
+function alphaAt(svg: string, size: number, x: number, y: number) {
+ const pixels = new Uint8Array(new Resvg(svg, { fitTo: { mode: 'width', value: size }, font: { loadSystemFonts: false } }).render().pixels)
+ return pixels[(y * size + x) * 4 + 3]
+}
+
+describe('generate-icons', () => {
+ it('packs PNG images into an ICO directory with 256 stored as 0', () => {
+ const images = [16, 256].map((size) => ({ size, png: render(master('app-icon-small.svg'), size) }))
+ const ico = packIco(images)
+ const view = new DataView(ico.buffer)
+ expect(view.getUint16(2, true)).toBe(1)
+ expect(view.getUint16(4, true)).toBe(2)
+ expect(view.getUint8(6)).toBe(16)
+ expect(view.getUint8(22)).toBe(0)
+ images.forEach((image, index) => {
+ const entry = 6 + index * 16
+ const length = view.getUint32(entry + 8, true)
+ const offset = view.getUint32(entry + 12, true)
+ expect(length).toBe(image.png.length)
+ expect(ico.slice(offset, offset + length)).toEqual(new Uint8Array(image.png))
+ })
+ })
+
+ it('sizes the macOS grid tile to the nearest whole pixels that keep it centred', () => {
+ expect(pixelTile(16)).toEqual({ tile: 12, offset: 2 })
+ expect(pixelTile(32)).toEqual({ tile: 26, offset: 3 })
+ expect(pixelTile(64)).toEqual({ tile: 52, offset: 6 })
+ })
+
+ it('places the simplified master inside the macOS icon grid with sharp tile edges', () => {
+ for (const pixels of [16, 32, 64]) {
+ const grid = onMacGrid(master('app-icon-small.svg'), pixels)
+ const { tile, offset } = pixelTile(pixels)
+ const middle = Math.floor(pixels / 2)
+ expect(pngSize(render(grid, pixels))).toEqual([pixels, pixels])
+ expect(alphaAt(grid, pixels, offset - 1, middle)).toBe(0)
+ expect(alphaAt(grid, pixels, offset, middle)).toBe(255)
+ expect(alphaAt(grid, pixels, offset + tile - 1, middle)).toBe(255)
+ expect(alphaAt(grid, pixels, offset + tile, middle)).toBe(0)
+ expect(alphaAt(grid, pixels, middle, offset - 1)).toBe(0)
+ expect(alphaAt(grid, pixels, middle, offset)).toBe(255)
+ }
+ })
+
+ it('crops the finished master to its tile without the drop shadow', () => {
+ const tile = tileOnly(master('app-icon.svg'))
+ expect(alphaAt(tile, 103, 51, 51)).toBe(255)
+ expect(alphaAt(tile, 103, 0, 102)).toBe(0)
+ })
+
+ it('keeps the in-app tile in step with the finished master', () => {
+ expect(master('app-icon-tile.svg')).toBe(`${tileOnly(master('app-icon.svg'))}\n`)
+ })
+
+ it('ships every tray image the app loads', () => {
+ for (const name of ['tray.png', 'tray@2x.png', 'trayTemplate.png', 'trayTemplate@2x.png']) {
+ expect(existsSync(path.join(buildDir, 'icons', name))).toBe(true)
+ }
+ })
+})
diff --git a/desktop/scripts/generate-icons.ts b/desktop/scripts/generate-icons.ts
new file mode 100644
index 00000000..02d94bdc
--- /dev/null
+++ b/desktop/scripts/generate-icons.ts
@@ -0,0 +1,134 @@
+import { spawnSync } from 'node:child_process'
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+
+import { Resvg } from '@resvg/resvg-js'
+
+export type IconImage = { size: number; png: Uint8Array }
+
+const desktopRoot = path.resolve(import.meta.dirname, '..')
+const buildDir = path.join(desktopRoot, 'electron', 'build')
+const iconsDir = path.join(buildDir, 'icons')
+
+const MAC_TILE = { offset: 100, size: 824, canvas: 1024, radius: 185 }
+const ICO_SIZES = [16, 24, 32, 48, 64, 128, 256]
+const ICO_SMALL_MAX = 32
+const ICONSET: Array<{ name: string; size: number; small: boolean }> = [
+ { name: 'icon_16x16', size: 16, small: true },
+ { name: 'icon_16x16@2x', size: 32, small: true },
+ { name: 'icon_32x32', size: 32, small: true },
+ { name: 'icon_32x32@2x', size: 64, small: true },
+ { name: 'icon_128x128', size: 128, small: false },
+ { name: 'icon_128x128@2x', size: 256, small: false },
+ { name: 'icon_256x256', size: 256, small: false },
+ { name: 'icon_256x256@2x', size: 512, small: false },
+ { name: 'icon_512x512', size: 512, small: false },
+ { name: 'icon_512x512@2x', size: 1024, small: false },
+]
+
+function svgParts(svg: string) {
+ const match = svg.match(/