Repository navigation
Mac sidebar: navy glass, app mark, tab capsule, project foot #876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "colors": [ | ||
| { | ||
| "color": { | ||
| "color-space": "srgb", | ||
| "components": { | ||
| "alpha": "0.140", | ||
| "blue": "0.403922", | ||
| "green": "0.227451", | ||
| "red": "0.168627" | ||
| } | ||
| }, | ||
| "idiom": "universal" | ||
| }, | ||
| { | ||
| "appearances": [ | ||
| { | ||
| "appearance": "luminosity", | ||
| "value": "dark" | ||
| } | ||
| ], | ||
| "color": { | ||
| "color-space": "srgb", | ||
| "components": { | ||
| "alpha": "0.550", | ||
| "blue": "0.403922", | ||
| "green": "0.227451", | ||
| "red": "0.168627" | ||
| } | ||
| }, | ||
| "idiom": "universal" | ||
| } | ||
| ], | ||
| "info": { | ||
| "author": "xcode", | ||
| "version": 1 | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ struct FolderSidebar: View { | |
| } | ||
| } | ||
| .listStyle(.sidebar) | ||
| .scrollContentBackground(.hidden) | ||
| .modifier(SidebarKeys( | ||
| selection: selection, | ||
| isExpanded: { actions.isExpanded($0.url).wrappedValue }, | ||
|
|
@@ -348,9 +349,13 @@ private struct FolderContents: View { | |
| .accessibilityHint(canOpen ? "" : "Can't open here") | ||
| .accessibilityAction { if canOpen { actions.open(entry) } } | ||
| .padding(.vertical, 1) | ||
| // The open notebook's row, in a quiet grey (#873), so it | ||
| // doesn't read as a second selection beside the | ||
| // system's own, which keeps the accent while the list | ||
| // has focus. | ||
| .listRowBackground( | ||
| entry.serverPath == actions.openPath | ||
| ? Color.accentColor.opacity(0.18) : Color.clear | ||
| ? Color.primary.opacity(0.08) : Color.clear | ||
| ) | ||
| .contextMenu { menu(for: entry) } | ||
| .tag(entry) | ||
|
|
@@ -458,6 +463,7 @@ struct RunningList: View { | |
| } | ||
| } | ||
| .listStyle(.sidebar) | ||
| .scrollContentBackground(.hidden) | ||
| // The page asks the server for each kernel's memory only while | ||
| // the list shows (#241). | ||
| .onAppear { page.watchMemory(true) } | ||
|
|
@@ -507,24 +513,34 @@ private struct KernelRow: View { | |
| } | ||
| } | ||
|
|
||
| /// The foot of the navigator sidebar (#246): where kernels run, and how | ||
| /// many kernels and terminals there are. A menu: open a terminal on a | ||
| /// remote, manage remotes. Where kernels run (#473) is an advanced choice | ||
| /// in the kernel menu now (#701); connected machines are places instead. | ||
| struct ServerLine: View { | ||
| var page: PageModel | ||
| /// The foot of the navigator sidebar (#873): the window's folder, named, and | ||
| /// where it is, over a menu: show it in the Finder, open a terminal on a | ||
| /// remote, manage remotes. Where kernels run (#473) is an advanced choice in | ||
| /// the kernel menu and the kernel button's popover now (#701, #867), and how | ||
| /// many run is in the Running tab and that popover: the foot is the project. | ||
| struct ProjectLine: View { | ||
| /// The window's folder: this Mac's own, or a machine's as its server | ||
| /// reports it (#740). | ||
| let folder: URL | ||
| /// This Mac's home folder, for the "~" in the line under the name; nil | ||
| /// for a machine's window, whose home this isn't. | ||
| var home: URL? | ||
| /// "This Mac", or the machine's name (#740). | ||
| let placeName: String | ||
| /// Whether the folder is on this Mac: only then can the menu show it in | ||
| /// the Finder, which lists this Mac's disk. | ||
| var showsInFinder = true | ||
| /// The window's bottom panel, for terminals on remotes. | ||
| var panel: PanelController? | ||
| /// A connected machine's name, for its window (#740): the kernels run | ||
| /// there, not where this device's setting says. | ||
| var machineName: String? | ||
| var model = AppModel.shared | ||
| var terminals = OpenTerminals.shared | ||
|
|
||
| var body: some View { | ||
| let locations = model.kernelLocations | ||
| let location = machineName ?? locations.title | ||
| let lines = ProjectLineText.lines(folder: folder, home: home, placeName: placeName) | ||
| Menu { | ||
| if showsInFinder { | ||
| Button("Show in Finder") { NSWorkspace.shared.activateFileViewerSelecting([folder]) } | ||
| Divider() | ||
| } | ||
| let remotes = model.remotes.filter { $0.hasServer || $0.ssh != nil } | ||
| if let panel, !remotes.isEmpty { | ||
| Section("New Terminal On") { | ||
|
|
@@ -537,47 +553,45 @@ struct ServerLine: View { | |
| } | ||
| } | ||
| } | ||
| Divider() | ||
| } | ||
| Divider() | ||
| Button(locations.hasRemotes ? "Manage Remotes…" : "Add a Remote…") { | ||
| Button(model.kernelLocations.hasRemotes ? "Manage Remotes…" : "Add a Remote…") { | ||
| SettingsOpener.show(.remotes) | ||
| } | ||
| } label: { | ||
| HStack(spacing: 6) { | ||
| Circle() | ||
| .fill(page.state.backend == nil ? Color.secondary : Color("Ready")) | ||
| .frame(width: 7, height: 7) | ||
| .accessibilityHidden(true) | ||
| Image(systemName: machineName == nil && locations.selected == nil ? "laptopcomputer" : "server.rack") | ||
| Image(systemName: "folder") | ||
| .foregroundStyle(.secondary) | ||
| .accessibilityHidden(true) | ||
| Text(location) | ||
| .lineLimit(1) | ||
| VStack(alignment: .leading, spacing: 1) { | ||
| Text(lines.title) | ||
| .font(.callout) | ||
| .lineLimit(1) | ||
| Text(lines.detail) | ||
| .font(.caption) | ||
| // Not `.secondary`, which measured 3.6:1 on the | ||
| // light tint (#873): this keeps it past 4.5:1. | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Medium (with the colorset comment). "keeps it past 4.5:1" isn't measured: the dev log gives "about 4.7:1 by the same arithmetic", worked from screenshots at the 8% light tint, and the head's tint is 14%. 4.7 leaves little margin, so it needs a measurement from a build of this commit. Separately, #873 item 1 says "Text keeps 4.5:1 (secondary labels included)", and the dev log says the lists' Generated by Claude Code |
||
| .foregroundStyle(Color.primary.opacity(0.72)) | ||
| .lineLimit(1) | ||
| .truncationMode(.middle) | ||
| } | ||
| Spacer(minLength: 4) | ||
| Image(systemName: "chevron.up.chevron.down") | ||
| .font(.system(size: 8, weight: .semibold)) | ||
| .foregroundStyle(.secondary) | ||
| .accessibilityHidden(true) | ||
| Spacer(minLength: 4) | ||
| Text(OpenTerminals.summary(kernels: page.state.sessions.count, terminals: terminals.entries.count)) | ||
| .foregroundStyle(.secondary) | ||
| .lineLimit(1) | ||
| } | ||
| .font(.caption) | ||
| .padding(.horizontal, 10) | ||
| .padding(.vertical, 6) | ||
| .contentShape(Rectangle()) | ||
| } | ||
| .menuStyle(.button) | ||
| .buttonStyle(.plain) | ||
| .menuIndicator(.hidden) | ||
| .help(helpText(locations)) | ||
| .accessibilityLabel("Kernels run on \(location)") | ||
| } | ||
|
|
||
| private func helpText(_ locations: KernelLocations) -> String { | ||
| var text = "Kernels run on \(machineName ?? locations.title)." | ||
| if page.state.backend == nil { text += " Not connected." } | ||
| return text + (machineName == nil ? " Click to open a terminal on a remote." : "") | ||
| // The whole path, for the line under the name, which is cut short. | ||
| .help(folder.path) | ||
| .accessibilityLabel(lines.title) | ||
| .accessibilityValue(lines.detail) | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Medium. This alpha went from 0.080 to 0.140 in 95b0bfd, after the screenshots (213ae5e, whose colorset is still 0.080) and after the contrast numbers were measured from them. The PR says 95b0bfd wasn't rebuilt on the Mac. So the "after" shots don't show the light tint this PR ships, and the 11.0:1 / 3.6:1 / "about 4.7:1" figures were taken against a lighter background than the head draws. Fix: rebuild the head, retake dark and light shots (this Mac's window and a machine's, per #873), and re-measure the foot's second line and the lists' secondary captions on them.
Generated by Claude Code