Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
491bfc1
Say the eyebrow on the page under the apps' chrome (#867)
tlockney Nov 26, 2026
fbe5971
Post the notebook's title to the apps (#867)
tlockney Nov 26, 2026
fda57ce
Title a window with the notebook's title, else its name without the d…
tlockney Nov 26, 2026
53f7e94
Notes: #867's eyebrow, title and window names
tlockney Nov 26, 2026
42acc93
Put the kernel's name, place and state in a chip beside the title (#867)
tlockney Nov 26, 2026
ab7bd4a
Say only where a notebook is saved under its title (#867)
tlockney Nov 26, 2026
b29f8e5
Group Run Cell with Interrupt, and drop New Notebook from the toolbar…
tlockney Nov 26, 2026
2dc109b
Say the Mac's toolbar in the docs, with a dev log (#867)
tlockney Nov 26, 2026
0b4703f
Show a busy kernel as a spinner, not a second dot colour
tlockney Nov 26, 2026
bf8d13b
Say the kernel's mark is a dot and a spinner in the docs
tlockney Nov 26, 2026
1b81d95
Hide the page eyebrow on a phone, not an iPad
tlockney Nov 26, 2026
8767e81
Label a folded window with the notebook's title
tlockney Nov 26, 2026
e286e26
Read the chip's mark as the button's value, not its own label
tlockney Nov 26, 2026
43f424f
Say a missing kernel is not installed, not stopped
tlockney Nov 26, 2026
ec37145
Give a window with no status line its neutral kernel symbol again
tlockney Nov 26, 2026
9b96f2c
Report the notebook's title from state, so a live room's change shows
tlockney Nov 26, 2026
e27bf87
Describe the iPad's own status line, and call the Mac's mark a chip
tlockney Nov 26, 2026
b9d39c2
Test the phone's page top, where the line is hidden
tlockney Nov 26, 2026
d537237
Hide the page's eyebrow on a phone on its side
tlockney Nov 26, 2026
6722e13
Say a spinner, not a glow, and hold only the width in the notes
tlockney Nov 26, 2026
295c7ba
Add Mac PR screenshots (#867)
tlockney Nov 26, 2026
0839437
Put the notebook's title over the chip, not under the system's
tlockney Nov 26, 2026
982f71d
Make the kernel chip words, not a capsule
tlockney Nov 26, 2026
20b4820
Call the notebook by its language, not the kernel's display name
tlockney Nov 26, 2026
7ef39c6
Say in the docs what the notebook window now says
tlockney Nov 26, 2026
c2e2026
Take the PR's screenshots again, with the toolbar as it now is
tlockney Nov 26, 2026
ebd07e9
Revert "Take the PR's screenshots again, with the toolbar as it now is"
tlockney Nov 26, 2026
f405148
Keep the title's first letter clear of the toolbar's edge (#867)
claude Nov 26, 2026
5c34c13
Draw the notebook title outside the toolbar's glass capsule (#867)
claude Nov 26, 2026
d875167
Give the kernel its own toolbar button beside the title (#867)
claude Nov 26, 2026
bb47545
Keep the window's views when a notebook opens in place; review fixes …
claude Nov 26, 2026
fbe43e6
Replace the PR screenshots with the final Notebook view (#867)
claude Nov 26, 2026
115e2c2
Remove the PR screenshots (#867)
claude Nov 26, 2026
e4a9119
Hold the toolbar title's width, and take the title only for the shown…
claude Nov 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ The iPad and iPhone app is on TestFlight for internal testers.
[docs/apps.md](docs/apps.md) is the apps' user guide;
[apple/README.md](apple/README.md) has how to build them.

A notebook's window shows its title in the toolbar, with the kernel's
button beside it: "Python · This Mac · Idle" — the notebook's language,
where its kernel runs and what it is doing, behind a solid blue dot while
the kernel waits and a small spinner while it works. Click it to change
or restart the kernel. Under the title it says "Edited" with
unsaved changes, or "Locked: changed on disk" while the file changed under
you; a saved file adds nothing there.

> [!NOTE]
> **Unreleased.** Available only from a build of `main` (HEAD), not in
> the latest release, where the system's title has a status line under it
> with all of it ("Saved on This Mac · Runs on This Mac · TypeScript"),
> and the toolbar's kernel button beside it reads only the kernel's name.

## Run

You need Node.js 22.12 or later (CI uses 24). The server modes need
Expand Down
69 changes: 58 additions & 11 deletions apple/Sources/Ganymede/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,14 @@ struct ContentView: View {
workspace
}
.toolbar {
// New Notebook takes `sidebarRoot` by its server path, a
// machine's too (#740).
NotebookToolbar(
page: pageModel, document: document, folder: sidebarRoot,
page: pageModel, document: document,
// The kernel popover's Kernel Log is this device's window's
// alone (#858), so a machine's window passes no panel to it.
panel: place.isThisDevice ? panel : nil, place: place, header: headerStatus)
panel: place.isThisDevice ? panel : nil, place: place, header: headerStatus,
// A notebook's title, drawn with the kernel's button beside
// it (#867); a console or a folder keeps the system's.
title: showsNotebook ? windowTitle : nil)
// The panel is every window's: a machine's terminals run on the
// machine (#858), and a machine whose remote is gone keeps its
// panel too, empty, for the remotes' terminals there.
Expand Down Expand Up @@ -182,13 +183,25 @@ struct ContentView: View {
}
}
// The status line (#812). The system draws it and it isn't
// clickable: the kernel button's popover opens the details.
.navigationSubtitle(WindowTarget.subtitle(header: headerStatus, machineName: machineName))
// clickable: the kernel button's popover opens the details. A
// notebook's window has none: its save part is beside the chip
// (#867), and `.toolbar(removing: .title)` takes the system title
// and subtitle away. A machine's window with no notebook keeps
// "on <machine>".
.navigationSubtitle(
showsNotebook ? "" : WindowTarget.subtitle(header: headerStatus, machineName: machineName))
.frame(minWidth: 720, minHeight: 480)
// A console's tab is titled with its name (#735).
.navigationTitle((target ?? loaded).tabTitle(
consoleName: pageModel.state.console?.name, machineName: machineName))
// A console's tab is titled with its name (#735), a notebook with
// its title, or its file's (#867).
.navigationTitle(windowTitle)
.modifier(WindowSceneValues(place: place, folder: sidebarRoot, panel: panel))
// A notebook's toolbar item draws the title (#867), so the system's
// title and subtitle go; its tab keeps the display title, from
// `.navigationTitle` above. One modifier with an optional kind, not
// an `if`: two branches would be two views, and switching between
// them would rebuild the window's web view when a notebook opens or
// closes in place.
.toolbar(removing: showsNotebook ? .title : nil)
// Notebooks opened from the Finder (#228): the first window to see
// them takes them. Each opens in a new tab (or brings forward
// the one showing it), except that the window the app opened on
Expand Down Expand Up @@ -663,6 +676,33 @@ struct ContentView: View {
)
}

/// What the window and its tab are called: a console by its name
/// (#735), a notebook by its `metadata.title` or its file's, the rest
/// by their folder's (#867).
private var windowTitle: String {
(target ?? loaded).tabTitle(
consoleName: pageModel.state.console?.name, machineName: machineName,
metadataTitle: shownTitle)
}

/// The page's `metadata.title`, once the page reports the file this
/// window is for: until then it is the previous notebook's, and a file
/// window that just changed target would take its title for a moment.
/// The file's name is enough to tell, and doesn't depend on how the
/// server spells the folder. A folder's window shows whichever
/// notebook its page has open.
private var shownTitle: String? {
let expected: String? = switch target ?? loaded {
case .file(let url): url.lastPathComponent
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

return nil
}
return pageModel.state.title
}

/// The page asks for a tab (`openTab`): a notebook or data file, or a
/// new DuckDB console. The server is rooted at `/` on the Mac.
private func openTab(_ request: TabRequest) {
Expand Down Expand Up @@ -713,6 +753,13 @@ struct ContentView: View {
}
}

/// The notebook's title for its strip while another area fills the
/// window (#250, #867): the window's own, so a notebook the page
/// titled says that, not its file's name.
private var notebookTitle: String {
(target ?? loaded).displayTitle(machineName: machineName, metadataTitle: pageModel.state.title)
}

/// The leading strip while an area fills the window: the sidebar, and
/// the notebook when it is folded.
private var leadingStrip: [FoldedStrip.Item] {
Expand All @@ -722,7 +769,7 @@ struct ContentView: View {
}
// A filled panel has the notebook's row over it instead.
if layout.filled == .inspector {
items.append(.init(title: (target ?? loaded).title, systemImage: "doc.text") { layout.restore() })
items.append(.init(title: notebookTitle, systemImage: "doc.text") { layout.restore() })
if panel.isShown {
items.append(.init(title: "Terminal Panel", systemImage: "rectangle.bottomthird.inset.filled") {
layout.restore()
Expand All @@ -743,7 +790,7 @@ struct ContentView: View {
.overlay {
if panelFills {
FoldedStrip(
items: [.init(title: (target ?? loaded).title, systemImage: "doc.text") { layout.restore() }],
items: [.init(title: notebookTitle, systemImage: "doc.text") { layout.restore() }],
axis: .horizontal
)
.background(.bar)
Expand Down
88 changes: 86 additions & 2 deletions apple/Sources/Ganymede/HeaderStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,24 @@ struct HeaderStatus: Equatable {
var locked: Bool
/// The kernel's display name; nil with none.
var kernel: String?
/// The notebook's language (#867), as its kernel's kernelspec or the
/// file's metadata names it ("python", "typescript"); nil when neither
/// does, and the chip says the kernel's display name instead.
var language: String?
var kernelMissing: Bool
/// The kernel's state (`idle`, `busy`, `none`, …).
var status: String?

/// The save part: Saved on <place>, Edited, or Locked.
var save: String {
var save: String { saveNote ?? "Saved on \(savedOn)" }

/// The save part beside the Mac toolbar's chip (#867): only what
/// "Saved on …" doesn't say, as "Edited" or "Locked: changed on disk",
/// and nothing while the file is saved. The popover's first line
/// (`full`) still has the whole of it.
var saveNote: String? {
if locked { return dirty ? "Edited · Locked: changed on disk" : "Locked: changed on disk" }
return dirty ? "Edited" : "Saved on \(savedOn)"
return dirty ? "Edited" : nil
}

/// The runs part; nil when the kernel is missing or the place unknown.
Expand Down Expand Up @@ -59,6 +69,79 @@ struct HeaderStatus: Equatable {
return parts.compactMap { $0 }.joined(separator: " · ")
}

/// The Mac toolbar chip's first words (#867): the notebook's language
/// and where it runs — "TypeScript · This Mac" — or, for a kernel that
/// isn't installed, "julia not installed · Choose Kernel". The language
/// gives way to the kernel's display name when the page names no
/// language. The state is a part of its own (`chipState`), so the view
/// can hold its width.
var chipLead: String {
if kernelMissing { return "\(kernel ?? "Kernel") not installed · Choose Kernel" }
return [HeaderStatus.languageName(language) ?? kernel ?? "No kernel", runsOn]
.compactMap { $0 }.joined(separator: " · ")
}

/// Languages the chip writes as they are written (#867): "typescript"
/// reads "TypeScript" where capitalizing its first letter would not.
private static let languageNames = [
"typescript": "TypeScript", "javascript": "JavaScript", "python": "Python",
"sql": "SQL", "r": "R", "julia": "Julia", "rust": "Rust", "go": "Go", "bash": "Bash",
]

/// The chip's name for a notebook's language (#867): a known language's
/// spelling, else the language with its first letter capitalized. Nil
/// for no language, so the chip falls back to the kernel's name.
static func languageName(_ language: String?) -> String? {
guard let language = language?.trimmingCharacters(in: .whitespacesAndNewlines),
!language.isEmpty else { return nil }
if let known = languageNames[language.lowercased()] { return known }
return language.prefix(1).uppercased() + language.dropFirst()
}

/// The chip's state: "Idle" while the kernel waits or there is none;
/// nil when it is missing, where the chip asks for one instead.
var chipState: String? {
if kernelMissing { return nil }
return stateText ?? "Idle"
}

/// The whole chip: `<kernel> · <runs on> · <state>`, as
/// "TypeScript · This Mac · Idle", or the missing kernel's words.
var chipText: String {
[chipLead, chipState].compactMap { $0 }.joined(separator: " · ")
}

/// How the chip's mark is drawn (#867): a solid dot while the kernel
/// waits, a spinner while it works, a grey dot once it has stopped, and
/// the warning triangle while the kernel isn't installed. The shape
/// says which, so nothing moves and nothing needs a colour of its own.
enum ChipKind: Equatable {
case idle, working, stopped, missing
}

var chipKind: ChipKind {
if kernelMissing { return .missing }
switch status {
case "busy"?, "starting"?, "restarting"?, "autorestarting"?, "connecting"?,
"terminating"?: return .working
case nil, "idle"?, "none"?: return .idle
default: return .stopped
}
}

/// What VoiceOver says of the chip's dot.
var dotLabel: String {
if kernelMissing { return "Kernel not installed" }
switch status {
case "starting"?: return "Kernel starting"
case "busy"?, "restarting"?, "autorestarting"?, "connecting"?:
return "Kernel busy"
case "terminating"?: return "Kernel stopping"
case nil, "idle"?, "none"?: return "Kernel idle"
default: return "Kernel stopped"
}
}

/// The iPhone's form: the save state as one word, then where it runs,
/// with no kernel, so a long name doesn't push the runs part out.
var short: String {
Expand Down Expand Up @@ -86,6 +169,7 @@ struct HeaderStatus: Equatable {
dirty: state.dirty,
locked: state.locked ?? false,
kernel: state.kernelDisplayName,
language: state.kernelLanguage,
kernelMissing: state.kernelMissing,
status: state.status
)
Expand Down
Loading
Loading