Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(linux): ship a hicolor icon set and the real StartupWMClass

review0082d9dc8f8e
diff --git a/.gitignore b/.gitignore
index 59ba43b74..f8eceda67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ dist/
*.tsbuildinfo
build/icon.png
+build/icons/
build/icon.ico
build/icon.icns
diff --git a/CLAUDE.md b/CLAUDE.md
index 85b3aafad..8cea3dfcf 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -10801,7 +10801,7 @@ Voice-to-text input captured via microphone, turned into terminal text via on-de
Built with **electron-builder** (config in the `package.json` `build` block: appId
`com.nodeterm.app`, productName `nodeterm`, mac dmg+zip for arm64 **and** x64, `asarUnpack`
node-pty, output `dist/`). The app icon is generated from the nodeterm mark by
-`scripts/make-icon.mjs` (sharp → `build/icon.png` 1024² + multi-resolution `build/icon.ico`
+`scripts/make-icon.mjs` (sharp → `build/icon.png` 1024² + the Linux set `build/icons/<N>x<N>.png`, which is what `linux.icon` points at — a lone 1024px PNG lands under a size the hicolor theme does not declare, issue #1421 — + multi-resolution `build/icon.ico`
for Windows, both gitignored — regenerated by `make-icon`, which every dist script runs first);
the same script hand-packs `build/icon.icns` (size-checked frames — issue #369) and `build/icon.ico`, which electron-builder embeds as-is. Scripts: `npm run make-icon`, `npm run dist`
(local **unsigned** arm64 `.dmg` smoke test), `npm run dist:win` (unsigned x64 NSIS installer +
diff --git a/package.json b/package.json
index 0682ffb2b..054cb21e7 100644
--- a/package.json
+++ b/package.json
@@ -89,7 +89,12 @@
}
],
"category": "Development",
- "icon": "build/icon.png",
+ "icon": "build/icons",
+ "desktop": {
+ "entry": {
+ "StartupWMClass": "node-terminal"
+ }
+ },
"maintainer": "enes <[email protected]>"
},
"mac": {
diff --git a/scripts/icon-pack.d.mts b/scripts/icon-pack.d.mts
index c6d207ef4..50203b900 100644
--- a/scripts/icon-pack.d.mts
+++ b/scripts/icon-pack.d.mts
@@ -1,4 +1,5 @@
// Type surface of icon-pack.mjs for the vitest suite (src/main/icon-pack.test.ts); the script
// itself stays plain .mjs so `npm run make-icon` needs no build step.
+export declare const LINUX_ICON_SIZES: number[]
export declare const ICNS_FRAMES: Array<{ type: string; px: number }>
export declare function packIcns(frames: Map<string, Buffer>): Buffer
diff --git a/scripts/icon-pack.mjs b/scripts/icon-pack.mjs
index 684506952..ef5ca5773 100644
--- a/scripts/icon-pack.mjs
+++ b/scripts/icon-pack.mjs
@@ -9,6 +9,16 @@
// launcher. Packing our own container with a size check makes that class of skew
// unshippable.
+/** Sizes of the Linux icon set (`build/icons/<N>x<N>.png`, package.json `linux.icon`).
+ *
+ * Every entry must be a directory the freedesktop `hicolor` theme DECLARES in its index.theme
+ * (16/22/24/32/36/48/64/72/96/128/192/256/512 as of hicolor-icon-theme 0.18). An icon installed
+ * under an undeclared size is never found by a theme lookup: issue #1421 — the deb/rpm shipped
+ * one PNG under `hicolor/1024x1024/apps/`, which the index does not list, so `Icon=node-terminal`
+ * resolved to nothing and the taskbar showed a generic icon. electron-builder installs one file
+ * per PNG it finds in the directory and does not check the size against the theme. */
+export const LINUX_ICON_SIZES = [16, 24, 32, 48, 64, 128, 256, 512]
+
/** Apple's iconutil frame table: icns OSType → the pixel size that type MUST carry.
* icp4/icp5 are the 1x small sizes; ic11–ic14 are the @2x (retina) variants; PNG payloads
* are legal for all of them. */
diff --git a/scripts/make-icon.mjs b/scripts/make-icon.mjs
index ac0fe9a2e..20ed9214c 100644
--- a/scripts/make-icon.mjs
+++ b/scripts/make-icon.mjs
@@ -1,4 +1,5 @@
-// Renders the nodeterm app icon into build/icon.png (1024x1024, the Linux icon), the
+// Renders the nodeterm app icon into build/icon.png (1024x1024, loaded at runtime), the Linux
+// icon set build/icons/<N>x<N>.png, the
// multi-resolution build/icon.ico used by Windows packaging, and the multi-resolution
// build/icon.icns used by macOS packaging (all gitignored — regenerated by `npm run
// make-icon`, which every dist script runs first). electron-builder embeds the ICNS and
@@ -8,7 +9,7 @@
// with the nodeterm node-graph mark in our purple inside it.
import { mkdirSync, writeFileSync } from 'fs'
import sharp from 'sharp'
-import { ICNS_FRAMES, packIcns } from './icon-pack.mjs'
+import { ICNS_FRAMES, LINUX_ICON_SIZES, packIcns } from './icon-pack.mjs'
// macOS app icons leave a transparent margin around a rounded-square tile so they
// sit at the same visual size as system icons in the Dock. Apple's grid puts the
@@ -53,6 +54,21 @@ const png = await sharp(Buffer.from(svg)).png().toBuffer()
writeFileSync('build/icon.png', png)
console.log('wrote build/icon.png (1024x1024)')
+// --- Linux icon set (one PNG per hicolor size) ---
+//
+// package.json's linux.icon points at this DIRECTORY, not at build/icon.png: given a single PNG
+// electron-builder installs it as-is under hicolor/<its size>/apps/, and 1024x1024 is not a size
+// the hicolor theme declares, so no desktop could find the icon (issue #1421). build/icon.png
+// itself stays — the tray and the window icon load it at runtime (extraResources).
+mkdirSync('build/icons', { recursive: true })
+for (const size of LINUX_ICON_SIZES) {
+ writeFileSync(
+ `build/icons/${size}x${size}.png`,
+ await sharp(Buffer.from(svg)).resize(size, size).png().toBuffer()
+ )
+}
+console.log(`wrote build/icons/ (${LINUX_ICON_SIZES.join('/')}px)`)
+
// --- Windows .ico (multi-resolution) ---
//
// electron-builder's `win.icon` expects a real ICO container, not a PNG wearing a `.ico`
diff --git a/src/main/icon-pack.test.ts b/src/main/icon-pack.test.ts
index 715d8f341..228f175a8 100644
--- a/src/main/icon-pack.test.ts
+++ b/src/main/icon-pack.test.ts
@@ -1,6 +1,8 @@
import { describe, expect, it } from 'vitest'
import sharp from 'sharp'
-import { ICNS_FRAMES, packIcns } from '../../scripts/icon-pack.mjs'
+import { readFileSync } from 'fs'
+import { join } from 'path'
+import { ICNS_FRAMES, LINUX_ICON_SIZES, packIcns } from '../../scripts/icon-pack.mjs'
// Issue #369: the shipped icon.icns (derived by electron-builder from build/icon.png) carried
// WRONG-SIZED payloads — ic13 (nominally 128pt@2x = 256px) held the 512px PNG and ic14 (256pt@2x
@@ -85,3 +87,37 @@ describe('packIcns', () => {
expect(() => packIcns(frames)).toThrow(/icp5/)
})
})
+
+// Issue #1421: the Linux deb/rpm showed a generic taskbar icon and did not associate its window
+// with its launcher. Two independent causes, both in package.json's `build.linux`, both invisible
+// until someone installs the package on a real desktop.
+describe('Linux packaging (issue #1421)', () => {
+ const pkg = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf8'))
+ const linux = pkg.build.linux
+
+ // The `apps` sizes hicolor-icon-theme 0.18 declares in index.theme. A PNG installed under any
+ // other size directory is not found by a GTK/KDE theme lookup.
+ const HICOLOR_APP_SIZES = [16, 22, 24, 32, 36, 48, 64, 72, 96, 128, 192, 256, 512]
+
+ it('ships only icon sizes the hicolor theme declares', () => {
+ expect(LINUX_ICON_SIZES.length).toBeGreaterThan(0)
+ for (const size of LINUX_ICON_SIZES) expect(HICOLOR_APP_SIZES).toContain(size)
+ // Small enough for a taskbar, large enough for a launcher grid / AppImage thumbnail.
+ expect(LINUX_ICON_SIZES).toContain(48)
+ expect(Math.max(...LINUX_ICON_SIZES)).toBeGreaterThanOrEqual(256)
+ })
+
+ it('points linux.icon at the generated SET, not at the single 1024px PNG', () => {
+ // A lone PNG is installed as-is under hicolor/<its size>/apps/ — 1024x1024 for build/icon.png.
+ expect(linux.icon).toBe('build/icons')
+ const script = readFileSync(join(__dirname, '../../scripts/make-icon.mjs'), 'utf8')
+ expect(script).toContain('`build/icons/${size}x${size}.png`')
+ })
+
+ it("pins StartupWMClass to the window's real class (the package name, not productName)", () => {
+ // Electron sets WM_CLASS from package.json `name`; electron-builder defaults StartupWMClass
+ // to productName. They differ here (`node-terminal` vs `nodeterm`), so it is stated.
+ expect(pkg.name).not.toBe(pkg.build.productName)
+ expect(linux.desktop.entry.StartupWMClass).toBe(pkg.name)
+ })
+})