Skip to content

Mac toolbar: display title, kernel button, toolbar groups, page eyebrow - #870

Merged
tlockney merged 34 commits into
mainfrom
claude/project-thread-lsz12d
Nov 26, 2026
Merged

tlockney merged 34 commits into
mainfrom
claude/project-thread-lsz12d

Conversation

@tlockney

Copy link
Copy Markdown
Owner

Closes #867
Closes #865

Step 3 of #844.

What changes

  • A notebook window's toolbar draws its own title: the notebook's display title (metadata.title, else the file name without its YYYY-MM-DD- prefix), with "Edited" or "Locked: changed on disk" under it only when that applies. The system title and subtitle are removed for notebook windows (.toolbar(removing:)), and the title block sits outside the toolbar's glass capsule.
  • The kernel is its own toolbar button beside the title: mark, "TypeScript · This Mac · Idle", chevron. The mark is a blue dot when idle, a small spinner while busy, grey when stopped, a warning triangle when the kernel isn't installed. The state word's width is held, so idle/busy changes don't move the toolbar. VoiceOver reads it as one control.
  • The notebook is named by its language (kernelLanguage from the page), not the kernel's display name.
  • Toolbar groups: Run Cell and Interrupt together; New Notebook leaves the toolbar (File > New Notebook, ⌘N).
  • Show the journal eyebrow in the apps' Notebook view #865: the page eyebrow ("TYPESCRIPT · 9 NOV 2026") shows above the first cell in the apps' Notebook view (Mac and iPad; hidden on phones).
  • Folded strips and window tabs use the display title.

Thomas asked for the kernel picker to be a separate button after trying it as caption text under the title.

Screenshots (Mac, Fremont Bridge, Notebook view)

Before (v0.17.1) After
Dark
Light

The after shots are of d875167. The later review fixes in bb47545 don't change how it looks.

Verification

  • Tests: HeaderStatusTests (chip text, lead, state, kind, dot label per state incl. "Kernel stopping", saveNote, languageName), PageStateTests (title, kernelLanguage decoding), WindowTarget.displayName tests; vitest journal.test.ts, native.test.ts, App.test.tsx, NotebookPane.test.tsx (title in postState, kernelspec-first language, file-language fallback, live title, native and journal gates); e2e journal spec for the eyebrow's header fit and the phone width/height bands. A pre-push review removed each new behaviour in turn and saw a test fail.
  • By hand: Debug build of bb47545 on m4mini (macOS 26): build succeeds, full macOS Swift suite 716/716 pass; Thomas checked the Notebook view in dark and light (shots above). vitest 331 pass and npm run check pass on the touched files.
  • Docs updated: README, docs/apps.md (with Unreleased notes).
  • New dependencies, advisory ignores, or license exceptions: none.
  • Dev-log note: docs/notes/2026-11-26-mac-toolbar.md, docs/notes/2026-11-26-window-titles.md.
  • Kind: production.

Follow-ups: #866 (sheets 4px over the taller header), #869 (a failed kernel start shows two errors, one cut off).


Generated by Claude Code

tlockney and others added 30 commits November 26, 2026 06:59
The eyebrow ("TYPESCRIPT · 9 NOV 2026") was the toolbar's, and the Apple
apps draw no toolbar (`chrome=native`, #205): a window had nothing above
its cells saying what the notebook is.

The notebook page now shows it itself: a `<p class="page-eyebrow">` above
the first cell, in the cells' column, on the notebook view only. It is
the journal header's eyebrow (`journalHeader`), the same text the
toolbar has, and `.touch-ui` hides it as it hides the toolbar's: a
phone's page has no room for it.

The notebook's scroll area fills the page, so it starts below the line
(`top: 30px`: the line's 6px + 16px and its 8px margin); otherwise the
cells would cover it.

`notebookTitle` joins `journalHeader` in journal.ts: a notebook's
`metadata.title` when it is a non-empty string, which #867's window
titles need too.
`PageState` gains `title`: the open notebook's `metadata.title` when it is
a non-empty string, else null. The page reports it with the rest of the
state, from the controller's `title` (`notebookTitle`, journal.ts), so a
window can call the notebook what it calls itself instead of what its
file is called.

The Swift `PageState.title` is optional: a page from an older build
sends no key, and decodes to nil as before.
…ay (#867)

A journal's file is named for the day it starts: "2026-11-09-fremont-bridge"
made a window called "2026-11-09-fremont-bridge". `WindowTarget.displayName`
now picks the window's name: the notebook's `metadata.title` when the page
reports one, else the file's name with a leading `YYYY-MM-DD-` removed
(a name that is only a date keeps it). `displayTitle` and `tabTitle` use it
for `.file` and `.machineFile`, and the machine suffix is unchanged;
`ContentView` passes `pageModel.state.title`.

The sidebar keeps the file's full name: this is the window's title only.
The toolbar's status button read just the kernel's name ("TypeScript"), so
where it runs and what it is doing were only in the status line under the
title, and only as words. `KernelPicker`'s label is now a chip: a 7pt dot,
then "<kernel> · <runs on> · <state>" — "TypeScript · This Mac · Idle" —
with a warning triangle and "<name> not installed · Choose Kernel" for a
kernel that isn't installed. The dot is green ("Ready") while the kernel
waits, blue (a new `KernelBusy` asset, #8fb3ff in both appearances) while
it starts, runs or restarts, and grey once it has stopped; VoiceOver says
"Kernel idle", "Kernel busy", "Kernel starting" or "Kernel stopped" for it,
and the chip's own label is its text. The popover is as it was, and the
hover help is the whole status line (`HeaderStatus.full`).

The words are `HeaderStatus.chipText`, with `chipLead` and `chipState` as
its parts, and `chipDot` and `dotLabel` for the dot, so the tests cover
them without a view.

The state part holds the width of the widest state word: idle → busy →
idle then leaves every item after the chip where it was (the rest of the
chip is steady while the kernel and its place are). The widest is
"Connecting", not "Restarting" as the issue guessed: 69.7pt against 62.1pt
in the system font at 13pt, measured with AppKit. It is reserved by
layout — a hidden `Text` in a `ZStack` — so it needs no font size of its
own and follows the toolbar's.

The chip is the toolbar's leading (`.navigation`) item, beside the title.
The subtitle under the window's title repeated the whole status line
("Saved on This Mac · Runs on This Mac · TypeScript · Running"), which the
kernel's chip now says beside it. `WindowTarget.subtitle` returns
`header.save` — "Saved on <machine>", "Edited" or "Locked: changed on
disk" — and a machine's window with no notebook open still says "on
<machine>". `PlaceTests` covers the save states and the nil header.
…#867)

The notebook's toolbar now reads: the kernel's chip, beside the title;
Trust and Notebook Access, while they apply; Notebook | Journal; Run Cell
with its run menu and Interrupt; Share; More. Run and Interrupt are one
`ToolbarItemGroup`, so the pair sits together instead of Interrupt being a
control apart, and their labels give way together in a narrow window.

New Notebook leaves the toolbar: File > New Notebook (⌘N) makes one in the
window's folder, and the sidebar's New Notebook and the empty window's
button stay. `NotebookToolbar` takes no `folder` for it any more; the
doc comment names the new order and the seven items it takes.
`docs/apps.md` described the status line as the whole line ("Saved on This
Mac · Runs on This Mac · TypeScript") and the toolbar as starting with New
Notebook, with Run Cell and Interrupt apart. It now has the subtitle's save
state, the kernel chip (its dot, its states, the missing kernel's words,
its popover and hover help) and the order the toolbar has, with New
Notebook in the File menu. A machine's window's subtitle and that
section's note follow. Each section gets the standard Unreleased note.

`README.md` gets a sentence in "Download the Mac app" for what a
notebook's window now says under its title and beside it, with its note.

`docs/notes/2026-11-26-mac-toolbar.md` has the dev log: the chip's words on
`HeaderStatus`, the new `KernelBusy` colorset and why, the width held for
the state word ("Connecting", measured, not "Restarting"), the group, and
what was checked.
The chip's mark was a green dot while the kernel waited and a blue one
while it worked, which needed a KernelBusy colorset of its own. The
shape says it now: a solid dot while it waits, a small spinner in the
same 10pt frame while it works, a grey dot once it is stopped and the
warning triangle while the kernel is missing. HeaderStatus returns a
kind (.idle, .working, .stopped, .missing) in place of ChipDot.
The README, the apps' guide and the toolbar's dev log said the chip's
dot was green while the kernel waited and blue while it worked. It is a
solid blue dot while it waits and a small spinner while it works, and
there is no KernelBusy colorset to name.
.touch-ui is on both, so the rule that hid the line and moved the page up
took it off the iPad too. The phone's width (719.98px, as the rest of the
CSS reads it) says which: a phone hides the line and starts the page at
the top, an iPad keeps it. The note says so, and an e2e opens a native
notebook at both widths.
The strips a filled window folds the notebook into used the target's
title, the file's name, while the window itself says the notebook's.
They take the same displayTitle the window does, page title and machine
name included.
VoiceOver got the Button's accessibilityLabel and never the mark's, so
"Kernel idle" was never read. The button's label stays the chip's whole
text and the mark's words become its value; the mark is hidden.
Its mark is the warning triangle, and "stopped" names a different
state the chip also shows with a grey dot.
A console or a folder has no HeaderStatus, so the chip drew a grey
"stopped" dot for a state it did not have, and read it out. It shows
the cpu symbol v0.17.1 used, with no accessibility value.
The controller effect read metadata.title when it ran, and a change in
a live room didn't re-run it, so the window kept the old title. The
title now comes from the state the outline effect's update() sets, as
the eyebrow does, and the effect depends on it.
The iPad's line says where it is saved, where it runs, the kernel and
its state; it is no longer the Mac's line under the title. The Mac's
kernel button is the kernel chip now.
The rule that drops `.notebook-page` to the content's top on a phone
had no test. The phone case in the page-eyebrow loop now checks the
notebook's page and the content share a top, where an iPad's page
starts 30px down under the line (#867).
An iPhone in landscape is 852 to 932px wide, so the width rule kept the
line on a screen with no room for it. The phone's height says it: the
520px the start screen already calls a short window hides the line and
drops the notebook's page to the content's top, and the e2e loop tries
852x393 as well as the upright phone and the iPad (#867).
The Mac toolbar's log claimed a `KernelBusy` colorset that never reached
main, and a spinner tinted `Ready` that a macOS `ProgressView` ignores,
and it guessed at the issue's longest word. It says the busy mark is a
small system spinner, which says what a second blue would not since
`Ready` is `#8fb3ff` in dark, and that "Connecting" is the widest state
word. The window's log says two dated files sharing a stem share a tab
title, which the tooltip and the sidebar don't (#867).
The toolbar's first item now draws the notebook's display title with the
kernel chip under it, where the system's title and subtitle were: a
notebook window removes them (.toolbar(removing: .title)) and keeps
.navigationTitle so its tab still gets the display title. Beside the chip
the save part shows only when there is something to say — Edited or
Locked: changed on disk, from HeaderStatus.saveNote — and the whole
status line stays in the chip's help and popover. A console's or a
folder's window keeps the system title and its chip as before (#867).
The chip was a bordered toolbar button on a capsule. It is a plain button
now: the dot and the caption words in .secondary, with a quiet fill under
the pointer and a stronger one while pressed, no background or border of
its own. The width reserved for the state word stays, as invisible
whitespace, and the popover, help and accessibility label and value are
unchanged (#867).
The Mac toolbar's chip read the kernel's display name, so a Python
notebook said "Python 3" and the in-app kernel "TypeScript (in app)".
The page now reports kernelLanguage: the running kernel's kernelspec's
language, else the file's metadata.kernelspec.language, else its
metadata.language_info.name (notebookLanguage in journal.ts, from the
pane's controller). HeaderStatus.languageName writes the known names as
each language does ("TypeScript", "SQL", "R", ...) and capitalizes
any other; the chip leads with it and falls back to the kernel's display
name when the page names none (#867).
docs/apps.md's Mac section, README's paragraph on the app, and the day's
design note describe the title with the chip under it, the save part
beside the chip that says something only when there is something to say,
the borderless chip, and the language the chip calls the notebook by
(#867).
The two after-journal shots still showed the system's title with a status
line under it and a capsule chip beside it. They now show a notebook
window's title in the toolbar with the borderless chip under it, reading
"TypeScript · This Mac · Idle" — the notebook's language, not the
kernel's display name — and no subtitle, since the file is saved
(#867).
@tlockney tlockney self-assigned this Nov 26, 2026

@tlockney tlockney left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 review of #867 (Mac toolbar) and #865 (page eyebrow).

What I checked

  • Issue criteria for #867 and #865, item by item.
  • The diff (23 files): the Swift toolbar, HeaderStatus chip logic, WindowTarget display names, the page's title/kernelLanguage in postState, the NotebookPane eyebrow and its CSS.
  • Tests: HeaderStatusTests, PageStateTests, WindowTargetTests, the vitest additions, and the e2e eyebrow position and phone/iPad bands.
  • Docs and dev log, and CI (green).

Lenses applied

  • Concurrency/lifecycle: NotebookPane is keyed by path, and shown is gated on controller.path, so the page side can't post a stale title. The Swift side can for a moment (Low below).
  • Entry points: window title, tab title, folded strips, and the console/folder windows, which keep the system title.
  • Platform: the toolbar has at most 8 direct items, under the builder's limit of 10. macOS 26 APIs fit the platform floor.
  • Input edges: date-prefix strip, empty or whitespace title, unknown language capitalization.
  • CSS: each rule has a test. The top offset is checked against the eyebrow's bounding box. The phone and landscape top: 0 rule is checked by notebook.y == content.y. The band widths sit inside each media query.
  • Docs claims against code.
  • Duplicates: journalHeader now reuses notebookTitle and notebookLanguage.

Tests prove the change.

  • Every Swift helper and the page's two new state fields have tests that fail without the change.
  • The App → NotebookPane native hop is covered by the chrome=native e2e.
  • The SwiftUI wiring (title item, .toolbar(removing:), metadataTitle into windowTitle) can only be checked in the app. The Mac screenshots cover it.

Design deviations from #867, documented in the dev log and PR body

  • Busy shows as a spinner, not a glow-blue dot.
  • The kernel chip is a separate button.
  • The "Saved on …" subtitle is dropped. Only "Edited" or "Locked" shows under the title. The full status line is in the chip's help text and popover.

I take these as the author's calls, made with Thomas.

Findings

Medium

  • #865's acceptance item "iPad: same, in regular width" is unmet. The eyebrow and its .touch-ui bands only ran in jsdom and Chromium. Nothing shows the eyebrow in the iPad app, and no by-hand issue lists the check (Gap 80/92). Inline on NotebookPane.tsx.

Low

  • (plausible) The title has no max width. A long metadata.title could push the kernel button into the toolbar's overflow menu instead of truncating. Inline on NativeChrome.swift.
  • (plausible) The Swift window title pairs the new target with the previous page's state.title until the page posts. Inline on ContentView.swift.

Acceptance (#867)

  • Fremont title, chip text and eyebrow on the Mac, dark and light, before/after from the Mac app: met (screenshots).
  • No control moves on idle → busy → idle: met by construction. The state word is held to "Connecting"'s width, the widest stateText, and the mark has a fixed 10pt frame. Not shown by hand.
  • Accessible description of the dot: met (accessibilityValue, with tests on dotLabel).
  • Swift tests for display title, chip text and dot label: met. Page tests for title and the native eyebrow: met.
  • Docs with Unreleased notes: met (README, docs/apps.md).
  • iPad and iPhone unchanged apart from #865's eyebrow: met in code.

Acceptance (#865)

  • Mac Notebook view eyebrow, dark and light: met.
  • iPad in regular width: missing (see Medium).
  • Mac app screenshots: met.

Reviewed commit 115e2c2
Review: changes needed


Generated by Claude Code

)}
{/* The Apple apps draw no toolbar, so the page says what the notebook
* is above its first cell, as the toolbar's eyebrow does (#867). */}
{native && !journal && eyebrow && <p className="page-eyebrow">{eyebrow}</p>}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (acceptance, #865 "iPad: same, in regular width"). This line and its CSS (:has(), the .touch-ui width/height bands) are for the apps' WebKit page, but the only checks are jsdom and Chromium e2e at 820×1180; the by-hand check and screenshots cover the Mac only. No by-hand issue (ui#399, ui#273) lists the iPad check either. Show it from the iPad app (simulator is fine) in regular width, and that it is hidden on an iPhone, in portrait and landscape; or add the check to the by-hand issue and link it here.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the by-hand issue for iPad/iPhone: #273 (comment) (iPad regular width and Split View, dark and light; iPhone portrait and landscape hidden with the notebook at the top).


Generated by Claude Code

if let title {
ToolbarItem(placement: .navigation) {
VStack(alignment: .leading, spacing: 1) {
Text(title)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (plausible). The title takes its ideal width: .truncationMode(.middle) only applies once something limits the width, and nothing here does. metadata.title comes from agents and can be a full sentence. In a narrow window, a long title could push the kernel button and the groups after it into the toolbar's overflow menu, not truncate. To confirm, open a notebook whose metadata.title is ~100 characters in a 720pt-wide window. Suggested fix: .frame(maxWidth: 320, alignment: .leading) (or a fraction of the window) on the VStack.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e4a9119: the title block is held to maxWidth: 320, so a long title truncates in the middle.


Generated by Claude Code

private var windowTitle: String {
(target ?? loaded).tabTitle(
consoleName: pageModel.state.console?.name, machineName: machineName,
metadataTitle: pageModel.state.title)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (plausible). pageModel.state.title is from the last state the page posted, and target ?? loaded can change before the page posts the new notebook's state. Opening another notebook in place could then title the new file with the old notebook's metadata.title for a moment (window, tab, and the folded strip at line 742). To confirm, open a titled notebook, then open an untitled one in the same window and watch the title. Suggested fix: use metadataTitle only when pageModel.state.path is the target's path.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e4a9119: shownTitle uses metadata.title only when the page's open path names the window's file (by file name, so it doesn't depend on how the server spells the folder). A folder window still shows whatever notebook its page has open.


Generated by Claude Code

@tlockney tlockney left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 2 (fix round) review of #870: the diff 115e2c2..e4a9119 (ContentView.swift, NativeChrome.swift) and each round-1 finding.

What I checked

  • Round-1 Medium (#865 "iPad: same, in regular width"): answered by deferral. ui#273 is open and its comment #273 (comment) lists the iPad regular-width/Split View check (dark and light) and the iPhone portrait/landscape hidden check, and says CI covers them only in Chromium. That meets the by-hand deferral rule (Gaps 29, 80, 101). Resolved.
  • Round-1 Low (title width): fixed. .frame(maxWidth: 320, alignment: .leading) on the title block gives .truncationMode(.middle) a limit to truncate against.
  • Round-1 Low (stale title on target change): fixed. shownTitle returns nil until the page's state.path names the window's file; a nil state.path while loading also returns nil, so the window falls back to the file name. Folder and console windows are unchanged.
  • Lenses: concurrency/lifecycle (target change before the page posts), entry points (window title, tab title, folded strip all read windowTitle), platform (toolbar item count unchanged). CI green.

Findings

Low

  • shownTitle has no test (Gap 26). It is plain logic on target/loaded and state.path, but it lives as a private property on the View, so nothing fails if the guard is removed. Inline.

Nit

  • The guard compares file names only, so opening /a/x.ipynb then /b/x.ipynb in the same window can still show the first one's title until the page posts. Rare and brief; fine as a known limit, which the comment could say.

Neither blocks. Both are for the author to fix in this PR if cheap, per the Low rule.

Acceptance (#867, #865): as in round 1, with #865's iPad item now deferred to ui#273 (listed there).

Reviewed commit e4a9119
Review: pass


Generated by Claude Code

case .machineFile(_, let path): (path as NSString).lastPathComponent
default: nil
}
if let expected, expected != pageModel.state.path.map({ ($0 as NSString).lastPathComponent }) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (Gap 26). This guard is the whole fix, and no test fails if it is removed: it is plain logic, but private on the View. Suggested: move it to a helper (for example on WindowTarget, beside tabTitle) taking the target, state.path and state.title, and test: matching file returns the title; different file name returns nil; nil path returns nil; .machineFile path; folder target returns the title.

Nit. Matching by file name only: /a/x.ipynb then /b/x.ipynb in the same window can still show the old title until the page posts. Worth a word in the comment as a known limit.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed as #871 (helper beside tabTitle, the five tests, and the same-name limit in the comment), to avoid another macOS CI round on this PR.


Generated by Claude Code

@tlockney
tlockney merged commit 9caa8cb into main Nov 26, 2026
8 checks passed
@tlockney
tlockney deleted the claude/project-thread-lsz12d branch November 26, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac toolbar: four groups, kernel chip, display title Show the journal eyebrow in the apps' Notebook view

2 participants