Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Use consistent tab widths and add toolbar padding (#580)

Deeaaba72952ca7
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.md
index 38f569a5d..d82059655 100644
--- a/desktop/design/desktop-design-system.md
+++ b/desktop/design/desktop-design-system.md
@@ -314,8 +314,12 @@ The GitHub entry starts with only “Enter GitHub URL”; a valid address reveal
its clone action and an invalid submission reveals inline validation. Do not
add a duplicate example line or an empty results area beneath an empty field.
-**Workspace tabs and pane frames** — tabs use the 13-point system control face,
-independent of the status bar and terminal font. Center the name and its adjacent
+**Workspace tabs and pane frames** — tabs share one width, independent of label
+length, selection, activity and shortcut hints. Divide the available tab area
+equally, capped at 256 points; shrink together down to 128 points, then scroll.
+A tab area narrower than 128 points can show one clipped tab. Mirror these limits
+in Flutter and AppKit. Tabs use the 13-point system control face, independent of
+the status bar and terminal font. Center the name and its adjacent
status as one compact group, without permanent number prefixes. Navigation ink
follows the tab-bar surface, including beside light app content. The default label
is New Tab. A small right-hand close icon appears on hover, with its 32-point
@@ -328,6 +332,12 @@ never moves the name, and Command never changes tab width. Long names truncate
and retain a full-name tooltip. Selection, dragging, middle-click close and the
existing keyboard commands keep their meaning.
+Devices and Harness Store use compact 28-point capsules, centered in the
+40-point row with 6-point vertical gutters and a 12-point trailing inset.
+Keep 12-point internal horizontal padding and an 8-point icon-to-label gap.
+Flutter capsules grow with platform text scaling and retain at least 6 points
+above and below the label; search and New Tab keep their 32-point icon targets.
+
The selected tab has 10-point upper corners and 8-point outward lower shoulders,
joining the workspace along its bottom edge. It starts 6 points below the top
of the strip. Pane frames use the related 10-point radius, with a 9-point clipped
diff --git a/desktop/design/desktop-ui-migration.md b/desktop/design/desktop-ui-migration.md
index d8052fc43..10d7951f9 100644
--- a/desktop/design/desktop-ui-migration.md
+++ b/desktop/design/desktop-ui-migration.md
@@ -64,6 +64,28 @@ The standalone MachinesManager, old machine-link dialog, and generic
team-creation presenter have no production caller in this tree. They are not
counted as completed user journeys. Shared controls still serve their tests.
+## Consistent tab widths and compact toolbar — 2026-10-02
+
+Flutter and AppKit tabs now share the available row width, capped at 256 points.
+They shrink together to 128 points, then scroll. Names, selection, activity and
+Command hints do not change a tab's width; clipped names retain their full-name
+tooltip. This uses the shared-width approach in
+[Chromium's tab layout](https://raw.githubusercontent.com/chromium/chromium/main/chrome/browser/ui/views/tabs/tab_strip_layout.cc)
+with limits chosen for this app's centered labels and hover close targets.
+
+Native Devices and Harness Store capsules are 28 points tall, with 6-point
+vertical gutters in the 40-point row. Their right inset is 12 points. Flutter
+keeps the same compact minimum and grows for platform text scaling, preserving
+the label's internal padding. Native search and New Tab retain 32-point targets.
+
+Inspected production AppKit renders show [equal-width dark tabs](images/workspace-tabs-equal-dark.png),
+[light tabs](images/workspace-tabs-equal-light.png), and the
+[compact toolbar controls](images/workspace-tab-tools-compact.png).
+Coverage includes hover/Command states, narrow toolbars at 360 and 640 points,
+and Flutter at normal and doubled text size. All 56 targeted Flutter tests and
+4,352 AppKit checks pass; changed-file static analysis is clean. Captures use
+synthetic data and real fonts. The installed app was not exercised.
+
## Pane header spacing and long names — 2026-10-02
The refinement builds on main's shared plain-text agent and model controls.
diff --git a/desktop/design/images/workspace-tab-tools-compact.png b/desktop/design/images/workspace-tab-tools-compact.png
new file mode 100644
index 000000000..43df6cabb
Binary files /dev/null and b/desktop/design/images/workspace-tab-tools-compact.png differ
diff --git a/desktop/design/images/workspace-tabs-equal-dark.png b/desktop/design/images/workspace-tabs-equal-dark.png
new file mode 100644
index 000000000..3ad439a3e
Binary files /dev/null and b/desktop/design/images/workspace-tabs-equal-dark.png differ
diff --git a/desktop/design/images/workspace-tabs-equal-light.png b/desktop/design/images/workspace-tabs-equal-light.png
new file mode 100644
index 000000000..e873aca1b
Binary files /dev/null and b/desktop/design/images/workspace-tabs-equal-light.png differ
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 3a56c4c72..5a1cf9b20 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -7484,23 +7484,16 @@ class _SwarmScreenState extends State<SwarmScreen> {
final tabBudget = math.max(
0.0,
constraints.maxWidth -
- cell.width * 6 -
+ cell.width * 5 -
+ grid.AppDesktop.tabBarTrailingInset -
actionsWidth -
(_slotShown ? 44 : 0) -
leadingWidth,
);
- _tabWidths = [
- for (var i = 0; i < labels.length; i++)
- math.min(
- DesktopWorkspaceTab.widthOf(
- context,
- labels[i],
- shortcutHint: _keymap.hint('swarm.select_${i + 1}'),
- hasActivity: activities[i] != null,
- ),
- tabBudget,
- ),
- ];
+ _tabWidths = List.filled(
+ labels.length,
+ DesktopWorkspaceTab.widthForStrip(tabBudget, labels.length),
+ );
final total = _tabWidths.fold(0.0, (sum, width) => sum + width);
// Arrows come out of the tabs' own budget, so the bar never reflows.
final arrows = chrome?.scrollsTabsByArrows == true && total > tabBudget;
@@ -7665,7 +7658,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
],
if (kIsWeb && _slotShown) _daemonTabButton(),
- SizedBox(width: cell.width),
+ const SizedBox(width: grid.AppDesktop.tabBarTrailingInset),
],
),
),
diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dart
index 0d9179137..f7e1f8234 100644
--- a/desktop/lib/shared/theme/app_theme.dart
+++ b/desktop/lib/shared/theme/app_theme.dart
@@ -1425,6 +1425,9 @@ abstract final class AppDesktop {
static const double tabShoulder = 8;
static const double tabTopInset = 6;
static const double tabCloseInset = 8;
+ static const double tabMinWidth = 128;
+ static const double tabMaxWidth = 256;
+ static const double tabBarTrailingInset = 12;
static const double paneCloseInset = 4;
static const double panelPadding = 24;
static const double groupGap = 16;
diff --git a/desktop/lib/widgets/desktop_workspace_tab.dart b/desktop/lib/widgets/desktop_workspace_tab.dart
index 0bcf9908a..3b4435dcc 100644
--- a/desktop/lib/widgets/desktop_workspace_tab.dart
+++ b/desktop/lib/widgets/desktop_workspace_tab.dart
@@ -90,17 +90,16 @@ class DesktopWorkspaceTab extends StatefulWidget {
(indicator == 0 ? 0 : indicator + _indicatorGap);
}
- static double widthOf(
- BuildContext context,
- String label, {
- String? shortcutHint,
- bool hasActivity = false,
- }) => naturalWidth(
- context,
- label,
- shortcutHint: shortcutHint,
- hasActivity: hasActivity,
- ).clamp(112, 256);
+ /// Tabs share the available width, then scroll at their readable minimum.
+ static double widthForStrip(double availableWidth, int tabCount) {
+ if (tabCount == 0) return 0;
+ return math.min(
+ availableWidth,
+ (availableWidth / tabCount)
+ .clamp(grid.AppDesktop.tabMinWidth, grid.AppDesktop.tabMaxWidth)
+ .floorToDouble(),
+ );
+ }
@override
State<DesktopWorkspaceTab> createState() => _DesktopWorkspaceTabState();
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 264679a09..73437cb1a 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -1012,7 +1012,7 @@ private final class SwarmStoreButton: SwarmIconButton {
var palette = SwarmNativePalette() { didSet { needsDisplay = true } }
var preferredWidth: CGFloat {
ceil(workspaceBarTextWidth(title,
- font: font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular))) + 52
+ font: font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular))) + 48
}
override func draw(_ dirtyRect: NSRect) {
@@ -2316,22 +2316,25 @@ private final class SwarmTabStrip: NSView {
let previousScrollSize = scroll.frame.size
let previousDocumentSize = document.frame.size
let cell: CGFloat = 8
- let trailing = cell
+ let trailing: CGFloat = 12 // AppDesktop.tabBarTrailingInset.
let toolHeight: CGFloat = 32
+ let capsuleHeight: CGFloat = 28 // AppControl.heightSmall.
let storeWidth = min(storeButton.preferredWidth,
max(0, bounds.width - cell * 14))
storeButton.frame = NSRect(x: bounds.width - trailing - storeWidth,
- y: (bounds.height - toolHeight) / 2, width: storeWidth, height: toolHeight)
+ y: (bounds.height - capsuleHeight) / 2, width: storeWidth, height: capsuleHeight)
let iconWidth = cell * 4
let devicesWidth = devicesButton.isHidden ? 0 : devicesButton.preferredWidth
devicesButton.frame = NSRect(x: storeButton.frame.minX - devicesWidth - 8,
- y: (bounds.height - toolHeight) / 2, width: devicesWidth, height: toolHeight)
+ y: (bounds.height - capsuleHeight) / 2, width: devicesWidth, height: capsuleHeight)
let searchEdge = devicesButton.isHidden ? storeButton.frame.minX : devicesButton.frame.minX
searchButton.frame = NSRect(x: searchEdge - iconWidth - 8,
y: (bounds.height - toolHeight) / 2, width: iconWidth, height: toolHeight)
// Only navigation actions share the tab row. Context has the full footer.
let tabBudget = max(0, searchButton.frame.minX - cell * 6)
- let widths = tabs.map { min($0.preferredWidth, tabBudget) }
+ let tabWidth = min(tabBudget, max(SwarmTabButton.minimumLayoutWidth,
+ min(SwarmTabButton.maximumLayoutWidth, floor(tabBudget / CGFloat(max(1, tabs.count))))))
+ let widths = Array(repeating: tabWidth, count: tabs.count)
let total = widths.reduce(0, +)
let occupied = min(total, tabBudget)
let scrollX = cell
@@ -2499,6 +2502,9 @@ private final class SwarmTabStrip: NSView {
}
private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidation {
+ // Mirrors AppDesktop.tabMinWidth/tabMaxWidth. Labels never size the tabs.
+ static let minimumLayoutWidth: CGFloat = 128
+ static let maximumLayoutWidth: CGFloat = 256
// Mirrors AppDesktop.tabRadius/tabShoulder in desktop-design-system.md.
private static let upperRadius: CGFloat = 10
private static let shoulder: CGFloat = 8
@@ -2536,9 +2542,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
}
private var naturalTitleWidth: CGFloat { max(labelLayout.size.width, emphasizedLabelLayout.size.width) }
var minimumWidth: CGFloat { Self.contentInset * 2 + reservedIndicatorSpace + 16 }
- var preferredWidth: CGFloat {
- min(260, max(112, ceil(naturalTitleWidth + reservedIndicatorSpace + Self.contentInset * 2)))
- }
+ var preferredWidth: CGFloat { Self.maximumLayoutWidth }
var selected = false { didSet { if selected != oldValue { invalidateLabel(); updateAccessibility() } } }
var attention = false { didSet { if attention != oldValue { invalidateLabel(); updateAccessibility() } } }
var activity: HarnessNativeActivity? {
diff --git a/desktop/test/desktop_workspace_tab_test.dart b/desktop/test/desktop_workspace_tab_test.dart
index da157f3ac..bfe9584cd 100644
--- a/desktop/test/desktop_workspace_tab_test.dart
+++ b/desktop/test/desktop_workspace_tab_test.dart
@@ -58,52 +58,56 @@ Widget _host(
children: [
const SizedBox(width: 8),
Expanded(
- child: SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: [
- for (final tab in tabs)
- Builder(
- builder: (context) => SizedBox(
- width: DesktopWorkspaceTab.widthOf(
- context,
- tab.name,
- shortcutHint: tab.hint,
- hasActivity: tab.working,
- ),
- child: DesktopWorkspaceTab(
- id: tab.name,
- label: tab.name,
- selected: tab.name == 'Desktop',
- shortcutHint: tab.hint,
- showShortcuts: hints,
- onSelect: enabled ? (onSelect ?? () {}) : null,
- onClose: enabled ? (onClose ?? () {}) : null,
- onRename: onRename,
- activityLabel: tab.working ? 'Working' : null,
- activity: tab.working
- ? SizedBox(
- key: ValueKey('status:${tab.name}'),
- width: 16,
- child: Text(
- '⠋',
- textAlign: TextAlign.center,
- textScaler: TextScaler.noScaling,
- style:
- grid.AppType.mono(
- color: const Color(0xff64d2ff),
- ).copyWith(
- fontFamilyFallback: const [
- 'Apple Symbols',
- ],
- ),
- ),
- )
- : null,
+ child: LayoutBuilder(
+ builder: (context, constraints) => SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ child: Row(
+ children: [
+ for (final tab in tabs)
+ Builder(
+ builder: (context) => SizedBox(
+ width: DesktopWorkspaceTab.widthForStrip(
+ constraints.maxWidth,
+ tabs.length,
+ ),
+ child: DesktopWorkspaceTab(
+ id: tab.name,
+ label: tab.name,
+ selected: tab.name == 'Desktop',
+ shortcutHint: tab.hint,
+ showShortcuts: hints,
+ onSelect: enabled
+ ? (onSelect ?? () {})
+ : null,
+ onClose: enabled ? (onClose ?? () {}) : null,
+ onRename: onRename,
+ activityLabel: tab.working ? 'Working' : null,
+ activity: tab.working
+ ? SizedBox(
+ key: ValueKey('status:${tab.name}'),
+ width: 16,
+ child: Text(
+ '⠋',
+ textAlign: TextAlign.center,
+ textScaler: TextScaler.noScaling,
+ style:
+ grid.AppType.mono(
+ color: const Color(
+ 0xff64d2ff,
+ ),
+ ).copyWith(
+ fontFamilyFallback: const [
+ 'Apple Symbols',
+ ],
+ ),
+ ),
+ )
+ : null,
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
),
),
diff --git a/desktop/test/workspace_status_test.dart b/desktop/test/workspace_status_test.dart
index 48f905b9e..4c9b20353 100644
--- a/desktop/test/workspace_status_test.dart
+++ b/desktop/test/workspace_status_test.dart
@@ -567,7 +567,7 @@ void main() {
);
expect(
updates.last['machineResources']['detail'],
- contains('running harnesses across connected machines'),
+ contains('open harnesses across connected machines'),
);
expect(updates.last['machineResources']['interactive'], isTrue);
} else {
@@ -1345,8 +1345,13 @@ void main() {
}
expect(
tester.getSize(secondTab).width,
- lessThanOrEqualTo(160 + grid.AppDesktop.tabCloseInset * 2),
- reason: 'short tab labels keep their compact width in a roomy window',
+ tester.getSize(find.byKey(ValueKey(first.id))).width,
+ reason: 'workspace tabs share one width',
+ );
+ expect(
+ tester.getSize(secondTab).width,
+ lessThanOrEqualTo(grid.AppDesktop.tabMaxWidth),
+ reason: 'tabs stop growing at the shared maximum in a roomy window',
);
expect(find.byKey(const ValueKey('swarm-search-button')), findsOneWidget);
expect(find.byKey(const ValueKey('swarm-store-button')), findsOneWidget);
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 0fd1b6305..53069f00f 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -611,9 +611,10 @@ private extension SwarmTabButton {
"The close action stays inset inside the tab's curved body")
}
- func checkCompleteNameFits() throws {
- try checkTitlebar(titleRect.width >= naturalTitleWidth,
- "The eight-tab fixture keeps each ordinary name readable")
+ func checkNameFitsOrHasTooltip() throws {
+ try checkTitlebar(titleRect.width >= naturalTitleWidth ||
+ toolTip?.components(separatedBy: "\n").contains(displayLabel) == true,
+ "Equal-width tabs retain the full name in a tooltip when the title truncates")
}
func clickBothActions() {
@@ -1197,6 +1198,7 @@ private extension SwarmTabStrip {
devicesButton.font == storeButton.font &&
accessibilityChildren()?.contains(where: { $0 as? NSView === devicesButton }) == true,
"Opted-in navigation reads Search, Devices, Store at width \(width)")
+ try captureTabPresentation("native-tabs-tools-\(Int(width))")
}
devicesButton.performClick(nil)
try checkTitlebar(calls == ["sessions", "store", "devices"],
@@ -1313,20 +1315,14 @@ private extension SwarmTabStrip {
}
try checkTitlebar(tabs[0].frame.width == tabs[0].preferredWidth &&
tabs[1].frame.width == tabs[1].preferredWidth &&
- tabs[0].frame.width < tabs[1].frame.width,
- "Tabs keep their label widths instead of expanding to fill the row")
+ tabs[0].frame.width == tabs[1].frame.width,
+ "Tabs share a capped width independent of their labels")
try checkTitlebar(tabs[0].menu?.font == menuFont, "Native context menus retain the system menu font")
}
func checkTabPresentationAndCapture() throws {
setFrameSize(NSSize(width: 900, height: 40))
- if let root = ProcessInfo.processInfo.environment["HARNESS_TITLEBAR_ASSETS"] {
- let assets = URL(fileURLWithPath: root)
- storeButton.image = SwarmHistoryIcons(assetURL: { asset in
- assets.appendingPathComponent(String(asset.dropFirst("assets/".count)))
- }).image(engine: "store", asset: "assets/store/polymath.png")
- }
let rows: [[String: Any]] = [
["id": "new", "name": "New Tab", "label": "New Tab", "shortcutHint": "⌘1"],
["id": "work", "name": "Desktop", "label": "Desktop", "shortcutHint": "⌘2",
@@ -1389,7 +1385,7 @@ private extension SwarmTabStrip {
"Eight ordinary tab names with inset close targets fit a 1440pt strip: \(tabs.last!.frame.maxX) in \(scroll.bounds.width)")
for tab in tabs {
try tab.checkCenteredLabel()
- try tab.checkCompleteNameFits()
+ try tab.checkNameFitsOrHasTooltip()
}
setShortcutHintsVisible(true)
try captureTabPresentation("native-tabs-eight-\(name)-command")
@@ -1402,6 +1398,12 @@ private extension SwarmTabStrip {
func captureTabPresentation(_ name: String) throws {
guard let directory = ProcessInfo.processInfo.environment["HARNESS_TAB_CAPTURE_DIR"] else { return }
+ if let root = ProcessInfo.processInfo.environment["HARNESS_TITLEBAR_ASSETS"] {
+ let assets = URL(fileURLWithPath: root)
+ storeButton.image = SwarmHistoryIcons(assetURL: { asset in
+ assets.appendingPathComponent(String(asset.dropFirst("assets/".count)))
+ }).image(engine: "store", asset: "assets/store/polymath.png")
+ }
let height = Int(bounds.height) + 40
let bitmap = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: Int(bounds.width), pixelsHigh: height,
bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false,
@@ -1420,7 +1422,7 @@ private extension SwarmTabStrip {
tab.drawWithHoverControl()
NSGraphicsContext.restoreGraphicsState()
}
- for control in [newButton, searchButton, storeButton] {
+ for control in [newButton, searchButton, devicesButton, storeButton] where !control.isHidden {
NSGraphicsContext.saveGraphicsState()
let transform = NSAffineTransform()
transform.translateX(by: control.frame.minX, yBy: control.frame.minY + 40)