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.

feat(project-icons): ProjectGlyph + wired at every project surface

enesb0589ca39bfd
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 5ae6aede8..43e30c505 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -10259,7 +10259,13 @@ export function Canvas() {
}}
onCloneRepo={cloneRepo}
onConnectSsh={() => setSshDialogOpen(true)}
- closedProjects={closedProjects.map((p) => ({ id: p.id, name: p.name, cwd: p.cwd }))}
+ closedProjects={closedProjects.map((p) => ({
+ id: p.id,
+ name: p.name,
+ cwd: p.cwd,
+ color: p.color,
+ icon: p.icon
+ }))}
onReopen={reopenProject}
onDeleteClosed={deleteProject}
onClose={hasProjects ? () => setWelcomeOpen(false) : undefined}
diff --git a/src/renderer/components/ProjectGlyph.test.tsx b/src/renderer/components/ProjectGlyph.test.tsx
new file mode 100644
index 000000000..0a7cec9b8
--- /dev/null
+++ b/src/renderer/components/ProjectGlyph.test.tsx
@@ -0,0 +1,97 @@
+// @vitest-environment jsdom
+import { act } from 'react'
+import { createRoot, type Root } from 'react-dom/client'
+import { afterEach, beforeEach, describe, expect, it } from 'vitest'
+import { ProjectGlyph } from './ProjectGlyph'
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+describe('ProjectGlyph', () => {
+ let root: Root
+ let host: HTMLElement
+
+ beforeEach(() => {
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+ })
+
+ afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ })
+
+ const render = async (el: React.ReactElement): Promise<void> => {
+ await act(async () => root.render(el))
+ }
+
+ it('renders an emoji icon as its literal character', async () => {
+ await render(
+ <ProjectGlyph icon={{ type: 'emoji', emoji: '🚀' }} color="#f00" name="Rocket" />
+ )
+ expect(host.textContent).toBe('🚀')
+ })
+
+ it('renders a lucide icon as the Task-4 placeholder, tinted with color', async () => {
+ await render(
+ <ProjectGlyph icon={{ type: 'lucide', name: 'folder' }} color="#3355ff" name="Folder Project" />
+ )
+ const svg = host.querySelector('[data-testid="lucide-placeholder"]')
+ expect(svg).not.toBeNull()
+ const rect = svg!.querySelector('rect')
+ expect(rect?.getAttribute('stroke')).toBe('#3355ff')
+ })
+
+ it('falls back to currentColor for the lucide placeholder when no color is given', async () => {
+ await render(<ProjectGlyph icon={{ type: 'lucide', name: 'folder' }} name="No Color" />)
+ const rect = host.querySelector('[data-testid="lucide-placeholder"] rect')
+ expect(rect?.getAttribute('stroke')).toBe('currentColor')
+ })
+
+ it('renders an image icon as an <img> with the given src', async () => {
+ await render(
+ <ProjectGlyph
+ icon={{ type: 'image', src: 'data:image/png;base64,AA==', source: 'upload' }}
+ color="#000"
+ name="Img Project"
+ />
+ )
+ const img = host.querySelector('img')
+ expect(img?.getAttribute('src')).toBe('data:image/png;base64,AA==')
+ expect(img?.getAttribute('alt')).toBe('')
+ })
+
+ it('falls back to a colored dot when icon is absent and variant is "dot"', async () => {
+ await render(<ProjectGlyph color="#abc123" name="Dotty" variant="dot" className="tab__dot" />)
+ const span = host.querySelector('span.tab__dot')
+ expect(span).not.toBeNull()
+ expect(span?.textContent).toBe('')
+ expect((span as HTMLElement).style.background).toBe('rgb(171, 193, 35)')
+ })
+
+ it('dot fallback has no inline style at all when color is undefined (matches an inactive tab)', async () => {
+ await render(<ProjectGlyph name="Dotty" variant="dot" className="tab__dot" />)
+ const span = host.querySelector('span.tab__dot')
+ expect(span?.getAttribute('style')).toBeNull()
+ })
+
+ it('falls back to a colored monogram (first initial) by default when icon is absent', async () => {
+ await render(<ProjectGlyph color="#112233" name="Alpha Project" className="ss-mark--project" />)
+ const span = host.querySelector('span.ss-mark--project')
+ expect(span?.textContent).toBe('A')
+ expect((span as HTMLElement).style.background).toBe('rgb(17, 34, 51)')
+ })
+
+ it('monogram fallback uses "?" for an empty/whitespace name', async () => {
+ await render(<ProjectGlyph color="#112233" name=" " variant="monogram" />)
+ expect(host.textContent).toBe('?')
+ })
+
+ it('passes className and title through on every fallback branch', async () => {
+ await render(
+ <ProjectGlyph color="#fff" name="Titled" variant="monogram" className="my-class" title="Titled" />
+ )
+ const span = host.querySelector('span.my-class')
+ expect(span?.getAttribute('title')).toBe('Titled')
+ })
+})
diff --git a/src/renderer/components/ProjectGlyph.tsx b/src/renderer/components/ProjectGlyph.tsx
new file mode 100644
index 000000000..8dc63c174
--- /dev/null
+++ b/src/renderer/components/ProjectGlyph.tsx
@@ -0,0 +1,117 @@
+import type { ProjectIcon } from '@shared/project-icon'
+
+export interface ProjectGlyphProps {
+ /** The project's icon, when it has one. Absent → render the site's pre-icon fallback. */
+ icon?: ProjectIcon
+ /** The project's own color — tints the lucide placeholder and drives both fallbacks. Optional
+ * so a caller can suppress the fallback tint entirely (TabBar's inactive-tab dot only colors
+ * the active tab; passing `undefined` there reproduces that exactly). */
+ color?: string
+ /** Project display name — the monogram fallback's first initial, and the image's empty alt. */
+ name: string
+ /** Content sizing (emoji font-size). Fallback/icon box size comes from `className`'s own CSS,
+ * same as every render site did before this component existed — this only sizes the glyph
+ * drawn inside that box. */
+ size?: number
+ /** Fallback shape when `icon` is absent: a plain colored dot, or a colored circle with the
+ * name's first initial. Default 'monogram' — the more common site. */
+ variant?: 'dot' | 'monogram'
+ /** The render site's own class — keeps that site's existing box size/position CSS in charge, so
+ * swapping in `ProjectGlyph` doesn't move or resize anything when `icon` is absent. */
+ className?: string
+ title?: string
+}
+
+const DEFAULT_SIZE = 16
+
+/**
+ * TODO(Task 4): lucide-react is not yet a dependency of this package — Task 4 adds it, plus the
+ * real curated map (`Record<string, LucideIcon>` built from `LUCIDE_ICON_IDS`, one import per
+ * icon so unused ones tree-shake out). Until then a lucide icon renders as this tinted, bordered
+ * placeholder so the branch is exercised (by tests and by real data) without blocking Task 2 on
+ * the new dependency. Task 4's swap-in point is exactly here: replace `LucidePlaceholder`'s body
+ * (or the call site below) with `const Icon = LUCIDE_ICONS[icon.name]; <Icon color={color} .../>`
+ * and delete this function — no other call site in this file needs to change.
+ */
+function LucidePlaceholder({ color }: { color?: string }): JSX.Element {
+ return (
+ <svg viewBox="0 0 16 16" width="100%" height="100%" aria-hidden="true" data-testid="lucide-placeholder">
+ <rect
+ x="2.5"
+ y="2.5"
+ width="11"
+ height="11"
+ rx="3"
+ fill="none"
+ stroke={color || 'currentColor'}
+ strokeWidth="1.5"
+ />
+ </svg>
+ )
+}
+
+/**
+ * A project's small badge, used wherever the UI shows one beside a project's name: its custom
+ * icon when it has one (emoji, a curated lucide glyph, or an image — GitHub avatar/upload/
+ * favicon), else the fallback that render site already showed before project icons existed — a
+ * plain colored dot or a colored-circle monogram of the name's first letter. Every wired call
+ * site passes its own `className`, so an absent `icon` reproduces that site's pre-icon markup
+ * exactly: same element, same class, same conditional style.
+ */
+export function ProjectGlyph({
+ icon,
+ color,
+ name,
+ size = DEFAULT_SIZE,
+ variant = 'monogram',
+ className,
+ title
+}: ProjectGlyphProps): JSX.Element {
+ if (icon?.type === 'emoji') {
+ return (
+ <span
+ className={className}
+ title={title}
+ style={{
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ fontSize: Math.round(size * 0.8),
+ lineHeight: 1
+ }}
+ >
+ {icon.emoji}
+ </span>
+ )
+ }
+
+ if (icon?.type === 'lucide') {
+ return (
+ <span
+ className={className}
+ title={title}
+ style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}
+ >
+ <LucidePlaceholder color={color} />
+ </span>
+ )
+ }
+
+ if (icon?.type === 'image') {
+ return (
+ <span className={className} title={title} style={{ display: 'inline-flex', overflow: 'hidden' }}>
+ <img src={icon.src} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />
+ </span>
+ )
+ }
+
+ if (variant === 'dot') {
+ return <span className={className} style={color ? { background: color } : undefined} title={title} />
+ }
+
+ return (
+ <span className={className} style={{ background: color }} title={title}>
+ {(name.trim() || '?').charAt(0).toUpperCase()}
+ </span>
+ )
+}
diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsx
index 5a48e6b62..e90b3e1a1 100644
--- a/src/renderer/components/SessionRow.tsx
+++ b/src/renderer/components/SessionRow.tsx
@@ -1,5 +1,6 @@
import { useState } from 'react'
import { IconBellFilled, IconCircleCheck } from './icons'
+import { ProjectGlyph } from './ProjectGlyph'
import type { SessionRowVM } from '../lib/sessionList'
import { useContextWindow } from '../state/contextWindow'
import { useSessionNaming } from '../state/sessionNaming'
@@ -89,16 +90,18 @@ export function SessionRow({
<div className="ss-row__titleline">
{row.projectColor ? (
// Status mode: rows are flattened across projects, so each row shows its project's
- // monogram (colored circle with the project initial) instead of the plain color mark.
- <span
+ // icon (or, absent one, the monogram — colored circle with the project initial)
+ // instead of the plain color mark.
+ <ProjectGlyph
+ icon={row.projectIcon}
+ color={row.projectColor}
+ name={row.projectName ?? ''}
+ variant="monogram"
className="ss-mark ss-mark--project"
- style={{ background: row.projectColor }}
title={row.projectName}
- >
- {(row.projectName?.trim() || '?').charAt(0).toUpperCase()}
- </span>
+ />
) : (
- <span className="ss-mark" style={{ background: row.color }} />
+ <ProjectGlyph color={row.color} name="" variant="dot" className="ss-mark" />
)}
{editing ? (
<input
diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsx
index 956a92373..1082a41ca 100644
--- a/src/renderer/components/SessionsSidebar.tsx
+++ b/src/renderer/components/SessionsSidebar.tsx
@@ -18,6 +18,7 @@ import {
type StatusSection
} from '../lib/sessionList'
import { SessionRow } from './SessionRow'
+import { ProjectGlyph } from './ProjectGlyph'
import { IconBellFilled, IconCircleCheck, IconPin } from './icons'
import { useProjects } from '../state/projects'
import { useSettings } from '../state/settings'
@@ -598,9 +599,13 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
>
{isCollapsed ? '▶' : '▼'}
</button>
- <span className="ss-group__monogram" style={{ background: g.projectColor }}>
- {(g.projectName.trim() || '?').charAt(0).toUpperCase()}
- </span>
+ <ProjectGlyph
+ icon={g.projectIcon}
+ color={g.projectColor}
+ name={g.projectName}
+ variant="monogram"
+ className="ss-group__monogram"
+ />
<span className="ss-group__name">{g.projectName}</span>
{branches[g.projectId] && (
<span className="ss-group__branch">⎇ {branches[g.projectId]}</span>
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx
index a2650f91a..40c1453e2 100644
--- a/src/renderer/components/TabBar.tsx
+++ b/src/renderer/components/TabBar.tsx
@@ -13,6 +13,7 @@ import { tabClickAction } from '../session/relay-tab'
import { useMenuFlip } from '../ui/useMenuFlip'
import { commandTooltip } from '../lib/keybindingOverrides'
import { IconCanvasView, IconKanban } from './icons'
+import { ProjectGlyph } from './ProjectGlyph'
import {
ALL_PERMISSION_MODES,
PERMISSION_MODE_LABELS,
@@ -301,9 +302,12 @@ export function TabBar({
: p.cwd || undefined
}
>
- <span
+ <ProjectGlyph
+ icon={p.icon}
+ color={active ? p.color : undefined}
+ name={p.name}
+ variant="dot"
className="tab__dot"
- style={active ? { background: p.color } : undefined}
/>
{/* An SSH project looks identical to a local one once it is named, and the
difference matters: its terminals, git and file ops all run on another
diff --git a/src/renderer/components/WelcomeScreen.tsx b/src/renderer/components/WelcomeScreen.tsx
index fb64bf810..e9f162b1e 100644
--- a/src/renderer/components/WelcomeScreen.tsx
+++ b/src/renderer/components/WelcomeScreen.tsx
@@ -1,4 +1,6 @@
import { useEffect } from 'react'
+import type { ProjectIcon } from '@shared/project-icon'
+import { ProjectGlyph } from './ProjectGlyph'
interface WelcomeScreenProps {
onNewProject: () => void
@@ -6,8 +8,8 @@ interface WelcomeScreenProps {
onCloneRepo: () => void
/** Open the "Connect over SSH…" flow to create a project hosted on a remote server. */
onConnectSsh: () => void
- /** Closed projects that can be reopened (id + display name + folder). */
- closedProjects?: { id: string; name: string; cwd?: string }[]
+ /** Closed projects that can be reopened (id + display name + folder + icon/color). */
+ closedProjects?: { id: string; name: string; cwd?: string; color?: string; icon?: ProjectIcon }[]
/** Reopen a closed project (restores its nodes + sessions). */
onReopen?: (id: string) => void
/** Permanently delete a closed project (ends its tmux sessions). */
@@ -145,9 +147,14 @@ export function WelcomeScreen({
if (e.key === 'Enter' || e.key === ' ') onReopen?.(p.id)
}}
>
- <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">
- <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
- </svg>
+ <ProjectGlyph
+ icon={p.icon}
+ color={p.color}
+ name={p.name}
+ variant="monogram"
+ size={15}
+ className="welcome__recent-mark"
+ />
<span className="welcome__recent-name">{p.name}</span>
{p.cwd && <span className="welcome__recent-path">{p.cwd}</span>}
{onDeleteClosed && (
diff --git a/src/renderer/components/settings/SettingsPage.tsx b/src/renderer/components/settings/SettingsPage.tsx
index e356e2c69..26c6ce9a9 100644
--- a/src/renderer/components/settings/SettingsPage.tsx
+++ b/src/renderer/components/settings/SettingsPage.tsx
@@ -69,7 +69,7 @@ export function SettingsPage({
const extraGroups = useMemo(() => {
const group = projectsSettingsGroup(
- openProjects.map((p) => ({ id: p.id, name: p.name, color: p.color }))
+ openProjects.map((p) => ({ id: p.id, name: p.name, color: p.color, icon: p.icon }))
)
return group ? [group] : []
}, [openProjects])
diff --git a/src/renderer/components/settings/SettingsSidebar.tsx b/src/renderer/components/settings/SettingsSidebar.tsx
index 8411dcb10..be6c82701 100644
--- a/src/renderer/components/settings/SettingsSidebar.tsx
+++ b/src/renderer/components/settings/SettingsSidebar.tsx
@@ -4,6 +4,7 @@ import { Input } from '@renderer/ui/Input'
import { visibleSettingsGroups, type SettingsGroup, type SettingsSectionId } from './nav'
import { matchesQuery } from './search'
import { SectionIcon } from './SettingsIcons'
+import { ProjectGlyph } from '../ProjectGlyph'
const isMac = /Mac/i.test(navigator.platform || navigator.userAgent)
@@ -105,7 +106,21 @@ export function SettingsSidebar({
isActive ? 'text-text' : 'text-muted-2 group-hover:text-muted'
)}
>
- <SectionIcon id={s.id} />
+ {s.color ? (
+ // A project section — the row's own color/icon (see nav.ts'
+ // `projectsSettingsGroup`), instead of the generic folder glyph every
+ // project section used to share.
+ <ProjectGlyph
+ icon={s.icon}
+ color={s.color}
+ name={s.title}
+ variant="monogram"
+ size={16}
+ className="flex size-4 items-center justify-center rounded-[3px] text-[9px] font-semibold uppercase text-white"
+ />
+ ) : (
+ <SectionIcon id={s.id} />
+ )}
</span>
<span className="truncate">{s.title}</span>
</button>
diff --git a/src/renderer/components/settings/nav.test.ts b/src/renderer/components/settings/nav.test.ts
index b9c4fb7e0..a3edd98ae 100644
--- a/src/renderer/components/settings/nav.test.ts
+++ b/src/renderer/components/settings/nav.test.ts
@@ -21,9 +21,26 @@ describe('SETTINGS_GROUPS', () => {
})
describe('projectsSettingsGroup', () => {
+ // NOTE (project-icons Task 2): this assertion used to read
+ // `expect(g?.sections).toEqual([{ id: 'project-p1', title: 'Alpha' }])` — the exact bug this
+ // task fixes (`color` was accepted on `ProjectNavItem` but silently dropped by `.map`). Updated
+ // in place rather than left to rot, since a passing test that pins the dropped-color bug would
+ // block the fix it's meant to catch.
it('derives one row per project and returns null when empty', () => {
const g = projectsSettingsGroup([{ id: 'p1', name: 'Alpha', color: '#fff' }])
- expect(g?.sections).toEqual([{ id: 'project-p1', title: 'Alpha' }])
+ expect(g?.sections).toEqual([{ id: 'project-p1', title: 'Alpha', color: '#fff', icon: undefined }])
expect(projectsSettingsGroup([])).toBeNull()
})
+
+ it('threads a project icon through onto its section row, alongside color', () => {
+ const icon = { type: 'emoji', emoji: '🚀' } as const
+ const g = projectsSettingsGroup([{ id: 'p1', name: 'Alpha', color: '#fff', icon }])
+ expect(g?.sections).toEqual([{ id: 'project-p1', title: 'Alpha', color: '#fff', icon }])
+ })
+
+ it('leaves icon undefined for a project that has none', () => {
+ const g = projectsSettingsGroup([{ id: 'p2', name: 'Beta', color: '#000' }])
+ expect(g?.sections[0]?.icon).toBeUndefined()
+ expect(g?.sections[0]?.color).toBe('#000')
+ })
})
diff --git a/src/renderer/components/settings/nav.ts b/src/renderer/components/settings/nav.ts
index 94058db8e..b9d6633a4 100644
--- a/src/renderer/components/settings/nav.ts
+++ b/src/renderer/components/settings/nav.ts
@@ -1,4 +1,5 @@
import { projectSectionId } from './project-settings-targets'
+import type { ProjectIcon } from '@shared/project-icon'
export type SettingsSectionId =
| 'terminal'
@@ -32,6 +33,7 @@ export interface ProjectNavItem {
id: string
name: string
color: string
+ icon?: ProjectIcon
}
export interface SettingsSectionRef {
@@ -39,6 +41,11 @@ export interface SettingsSectionRef {
title: string
/** Only meaningful on macOS (the notch capsule) — hidden elsewhere by `visibleSettingsGroups`. */
macOnly?: boolean
+ /** Project-section rows only (`project-${string}` ids): the project's own color/icon, so the
+ * sidebar can render its `ProjectGlyph` beside the title instead of the generic folder glyph
+ * every project section used to share. Absent on every static section. */
+ color?: string
+ icon?: ProjectIcon
}
export interface SettingsGroup {
@@ -136,6 +143,11 @@ export function projectsSettingsGroup(projects: ProjectNavItem[]): SettingsGroup
return {
id: 'projects',
title: 'Projects',
- sections: projects.map((p) => ({ id: projectSectionId(p.id), title: p.name }))
+ sections: projects.map((p) => ({
+ id: projectSectionId(p.id),
+ title: p.name,
+ color: p.color,
+ icon: p.icon
+ }))
}
}
diff --git a/src/renderer/lib/sessionList.ts b/src/renderer/lib/sessionList.ts
index 9cda23990..853f177cd 100644
--- a/src/renderer/lib/sessionList.ts
+++ b/src/renderer/lib/sessionList.ts
@@ -3,6 +3,7 @@ import type { AgentId } from '@shared/agents/config'
import type { NodeKind } from '@shared/types'
import { hasUsage } from '@shared/agents/config'
import type { SshConnection } from '@shared/ssh'
+import type { ProjectIcon } from '@shared/project-icon'
import { relativeTime } from './relativeTime'
export interface SessionNodeInput {
@@ -21,6 +22,9 @@ export interface ProjectInput {
id: string
name: string
color: string
+ /** Optional custom project icon — carried onto flattened/grouped rows (see `SessionRowVM` and
+ * `SessionGroup`) so the sidebar can show it instead of the plain color monogram. */
+ icon?: ProjectIcon
cwd?: string
nodes: SessionNodeInput[]
}
@@ -237,6 +241,7 @@ export interface SessionRowVM {
projectId?: string
projectName?: string
projectColor?: string
+ projectIcon?: ProjectIcon
}
/** A canvas group frame, the sessions directly inside it, and the frames nested inside it. */
@@ -265,6 +270,7 @@ export interface SessionGroup {
projectId: string
projectName: string
projectColor: string
+ projectIcon?: ProjectIcon
cwd?: string
isActive: boolean
/** Canvas group frames in this project, each with its member sessions. */
@@ -276,7 +282,7 @@ export interface SessionGroup {
function toRow(
n: SessionNodeInput,
status: AgentNodeStatus | undefined,
- project?: Pick<ProjectInput, 'id' | 'name' | 'color'>
+ project?: Pick<ProjectInput, 'id' | 'name' | 'color' | 'icon'>
): SessionRowVM {
// Workflow state and read state are deliberately independent. `done` means the agent finished a
// turn and is waiting for a new user prompt; `unread` only controls notification/read affordances.
@@ -305,7 +311,8 @@ function toRow(
// Only populated in status mode (flattened across projects); absent in project mode.
projectId: project?.id,
projectName: project?.name,
- projectColor: project?.color
+ projectColor: project?.color,
+ projectIcon: project?.icon
}
}
@@ -383,6 +390,7 @@ export function buildSessionList(
projectId: p.id,
projectName: p.name,
projectColor: p.color,
+ projectIcon: p.icon,
cwd: p.cwd,
isActive,
groups: buckets,
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 651bf532e..e83a5fa30 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -2773,6 +2773,20 @@ body,
flex: none;
}
+.welcome__recent-mark {
+ width: 15px;
+ height: 15px;
+ border-radius: 4px;
+ flex: none;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 9px;
+ font-weight: 600;
+ color: #fff;
+ overflow: hidden;
+}
+
.welcome__recent-name {
font-size: 13px;
flex: none;