Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,15 @@ are no component-level AGENTS.md files.
(`toolbar(removing: .title)`, gated: the `.title` kind is macOS 15, so 14 gets
an empty `navigationTitle`) so the name is not drawn twice. The `Window` scene
keeps its real name for the Window menu and the Dock, and that name lives
beside the version in `MonitorVersion`. **The trailing controls need
`.primaryAction`, not `.automatic`** — they used to be pushed right by the
beside the version in `MonitorVersion`. **The trailing controls need a
`ToolbarSpacer`, not just a placement** — they used to be pushed right by the
title taking the slack in the middle, and removing it packed them up against
the stamp. The styling is deliberately not the panel's palette or the cards' monospaced face.
the stamp. A macOS toolbar packs its items left to right after the navigation
slot, so `.primaryAction` names where an item belongs without reserving any
room to push it there; naming the placement and calling it fixed was the first
attempt and it changed nothing on screen. `ToolbarSpacer` is macOS 26, so
below that a Spacer in the `.principal` slot stands in — untested, since the
machine this is developed on runs 26. The styling is deliberately not the panel's palette or the cards' monospaced face.
It is the one thing in the window that is not a reading: everything else is a
measurement styled to be scanned, and this is a label on the photograph, there
to survive being screenshotted and read back later. macOS 26 wraps toolbar
Expand Down
22 changes: 16 additions & 6 deletions Sources/MonitorUI/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,22 @@ public struct DashboardView: View {
} else {
ToolbarItem(placement: .navigation) { buildStamp }
}
// `.primaryAction` rather than the default `.automatic`. The controls
// used to be pushed to the trailing edge by the window's title taking
// the slack in the middle; with the title removed, `.automatic` packed
// them up against the stamp on the left. Anchoring them explicitly says
// what the layout actually depends on, instead of leaning on something
// that is no longer there.
// The controls used to be pushed to the trailing edge by the window's
// title taking the slack in the middle. Removing the title took that
// with it, and **placement alone does not bring it back**: a macOS
// toolbar packs its items left to right after the navigation slot, so
// `.primaryAction` names where an item belongs without reserving any
// room to push it there. It needs an actual space.
//
// `ToolbarSpacer` is that space and it is macOS 26. Below 26 a Spacer
// in the centre slot is the nearest equivalent — untested, since the
// only machine this is developed on runs 26, so it is deliberately the
// fallback rather than the path everything takes.
if #available(macOS 26.0, *) {
ToolbarSpacer(.flexible)
} else {
ToolbarItem(placement: .principal) { Spacer() }
}
ToolbarItem(placement: .primaryAction) {
Picker("History", selection: $window) {
Text("1 min").tag(TimeInterval(60))
Expand Down
15 changes: 12 additions & 3 deletions docs/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -967,9 +967,18 @@ notices until a screenshot.
Removing the title cost the toolbar something that was not obvious until it was
gone: the title was taking the slack in the middle, and it was that, not the
items' own placement, pushing the History picker and the size and rate controls
to the trailing edge. Without it `.automatic` packed them up against the stamp.
They are `.primaryAction` now, which says what the layout actually depends on
rather than leaning on something that is no longer there.
to the trailing edge. Without it they packed up against the stamp.

**Placement alone does not bring it back.** Moving them to `.primaryAction` was
the first attempt and it changed nothing on screen: a macOS toolbar packs its
items left to right after the navigation slot, so a placement names where an
item belongs without reserving any room to push it there. What was removed was
a *space*, and only a space replaces it — `ToolbarSpacer(.flexible)` between the
stamp and the controls.

That is macOS 26, so below it a `Spacer` in the `.principal` slot stands in.
Untested: the only machine this is developed on runs 26, which is why it is the
fallback and not the path everything takes.

It is in the title bar rather than in the About panel because of how the app gets
used — a monitor is left running for days, and the
Expand Down
Loading