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 bold workspace hover and join selected tabs to the workspace (#340)

Dee4ba7156eae66
diff --git a/desktop/design/images/workspace-bar-hover.png b/desktop/design/images/workspace-bar-hover.png
new file mode 100644
index 000000000..0eba5bbef
Binary files /dev/null and b/desktop/design/images/workspace-bar-hover.png differ
diff --git a/desktop/design/terminal-workspace.md b/desktop/design/terminal-workspace.md
index 528c04ccb..6335556b4 100644
--- a/desktop/design/terminal-workspace.md
+++ b/desktop/design/terminal-workspace.md
@@ -34,8 +34,10 @@ Cmd-Shift-W closes the focused pane view. Cmd-Q quits the app. Enter activates,
Closing a pane removes its view immediately, without a minimize animation.
Keep mouse access useful without adding duplicate floating controls. Clickable
-text shows a hand cursor and a flat rectangular terminal-selection tint on hover,
-press, and keyboard focus. Resting controls stay unboxed. Tooltips describe the
+text shows a hand cursor and bold text on hover, press, and keyboard focus.
+Preserve the underlying colors, including filled status segments. Reserve both
+text weights during layout so emphasis never shifts neighboring controls.
+Resting controls stay unboxed. Tooltips describe the
action, not merely the text. Omit a tooltip that repeats the visible name;
show the full name when truncated, or a different underlying name. A model
selector says `Switch model · Subscription or local models`; include its full
@@ -54,9 +56,11 @@ gets tight; truncate long values or reduce the number of visible columns.
Persistent tab, status, and pane bars use `workspaceBarTextStyle()` and
`workspaceBarCellSizeOf(context)`: 13 pt SF Mono regular on macOS and the platform
monospace stack on Linux, independent of terminal zoom. Every bar control uses
-the same flat rectangle: `workspaceBarControlHeight()` (28 pt minimum), terminal
-selection at 50% opacity on hover/press/focus, and full selection color for the
-active tab. No rounded corners, ripple, or separate model-label well. Dialogs and welcome
+same minimum click height: `workspaceBarControlHeight()` (28 pt). The active tab
+fills the entire bar height with the workspace background color, joining the
+content below; selection keeps regular text and adds no `*` marker. Hovering a
+tab uses bold text like other bar controls. No rounded corners, ripple, or
+separate model-label well. Dialogs and welcome
actions use `terminalContentStyle()` and follow the terminal font preference.
## Keep surfaces quiet
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index ca131a150..c101fd7ea 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -36,21 +36,26 @@ each group is alphabetical. Pane focus and navigation history do not change that
order. Cmd-Q retains its native Quit action.
Tabs, status fields/symbols, PRs, and model labels and pane close actions share `WorkspaceBarControl`
-in Flutter and the same native draw metrics: 28 pt minimum highlight height,
-flat corners, and the terminal selection color at 50% opacity for hover, press,
-and keyboard focus. The active tab uses that same rectangle with full selection
-opacity. Keep the 13 pt regular text centered; no ripple or rounded button well.
+in Flutter and the same native draw metrics: 28 pt minimum click height and
+bold text on hover, press, and keyboard focus, with a hand cursor. Preserve the
+underlying colors, including Agnoster segment backgrounds and joins. Reserve
+both text weights during layout so labels and ribbon shapes never shift.
+The active tab fills the entire bar height with the workspace background color,
+joining the content below. Its resting text stays regular; do not add a `*`
+marker. Keep text centered, with no ripple or rounded button well.
+
+![Agnoster PR hover and a selected tab joining the workspace, rendered with synthetic data](images/workspace-bar-hover.png)
Do not show a tooltip that repeats a visible tab name (the numeric prefix does
not make it a different name). Show a different underlying name or the full
label when it is truncated. Keep action hints on symbols and status links.
The new-tab `+` uses the same plain-text control as `>` `@` `:` `*`: no resting
-box, with a flat rectangular terminal-selection highlight on hover or keyboard
+box, with bold text on hover or keyboard
focus. Keep its New Tab tooltip and shortcut hint.
Tab labels, status text, pane titles, and model selectors use **13 pt SF Mono,
-regular weight** on macOS. Linux uses its platform monospace stack at the same
+regular weight at rest** on macOS. Linux uses its platform monospace stack at the same
size. Use `workspaceBarTextStyle()` and `workspaceBarCellSizeOf(context)` from
`lib/shared/theme/workspace_bar_style.dart`; the native bar receives that same
font through `barStyle`. Keep this size independent of terminal zoom and avoid
@@ -65,7 +70,7 @@ and size.
The shared bar shows the focused harness's model selector before machine and
project. Pane headers keep the harness title and a hover-only ASCII `x` at their
far right. The `x` closes that pane view, keeps its harness running, and uses the
-shared flat highlight. Its tooltip names Close Pane and the current shortcut.
+shared bold hover treatment. Its tooltip names Close Pane and the current shortcut.
Reserve its width so revealing it does not move the title.
For the model label, prefer
@@ -73,8 +78,8 @@ its local model ID or the daemon's observed subscription model (`selectedModel`)
such as `GPT-6 Astra`, `Fable`, or `Opus`. Keep versions when reported; never infer
a version from a family alias. Older daemons fall back to the provider name.
Keep this label visible without requiring hover, including while disconnected;
-disable switching when the pane is read-only. Use a hand cursor, subtle hover and
-keyboard-focus fill, and a tooltip explaining subscription/local switching.
+disable switching when the pane is read-only. Use a hand cursor, bold text on hover
+and keyboard focus, and a tooltip explaining subscription/local switching.
Do not repeat the model name in that tooltip unless it is truncated or replaced
by `Switching…`. Preserve useful capability details and full truncated names
while offline, but do not advertise switching when it is disabled.
@@ -109,8 +114,8 @@ Keep the full actual path in the tooltip and accessibility detail.
A focused viewer shows its owning harness's context. Omit absent project or Git
metadata; detached commits say `detached:<commit>`. Clear it for an empty tab.
-Each field is independently clickable, with the same flat hover/keyboard-focus
-tint and hand cursor as the status symbols. Machine opens the shared picker scoped by machine
+Each field is independently clickable, with the same bold hover/keyboard-focus
+text and hand cursor as the status symbols. Machine opens the shared picker scoped by machine
identity; project opens its harnesses across matching remote checkouts; branch
opens that project filtered by its exact branch or detached commit. Escape returns
from branch to project, then to project search. Names never establish identity.
@@ -169,14 +174,14 @@ References: [Zsh prompt parameters](https://zsh.sourceforge.io/Doc/Release/Param
[Agnoster](https://github.com/agnoster/agnoster-zsh-theme), and
[Powerlevel10k](https://github.com/romkatv/powerlevel10k).
-Pane headers keep task identity and model selection. Four text symbols sit at the far
+Pane headers keep task identity and the hover-only close action. Four text symbols sit at the far
right, after the focused context and PR: `>` Harnesses, `@` Machines, `:` Models,
and `*` Store. Use the same compact monospace font, size, weight, and baseline as the
status text. Each symbol is centered in an equal four-column slot (at least
28 points wide) with an equally sized click target. In narrow windows, reduce
all four slots together in whole columns. Keep the symbols plain at
-rest; hovering, pressing, or keyboard focus adds a flat selection tint and
-brightens the text. A hand cursor, descriptive tooltip, and accessible button
+rest; hovering, pressing, or keyboard focus makes the text bold without changing
+the background. A hand cursor, descriptive tooltip, and accessible button
name make each action discoverable. Do not show a help symbol for now.
Harnesses opens the existing session manager with Pause and Resume. Machines
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 38d5b770e..56cff8a4d 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -4368,7 +4368,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
- final style = workspaceBarTextStyle(color: theme.foreground);
final names = workspaceTabNames(app);
final labels = [
for (var index = 0; index < app.swarms.length; index++)
@@ -4475,13 +4474,13 @@ class _SwarmScreenState extends State<SwarmScreen> {
).width >
_tabWidths[index] - cell.width * 2,
),
- selection: theme.selection,
+ selectedBackground: grid.AppPalette.swarmWelcome,
selected: selected,
onPressed: _shortcutsEnabled
? () => app.selectSwarm(swarm.id)
: null,
- child: SizedBox(
- height: toolHeight,
+ builder: (context, emphasized) => SizedBox(
+ height: double.infinity,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: cell.width,
@@ -4492,7 +4491,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
- style: style,
+ style: workspaceBarTextStyle(
+ color: theme.foreground,
+ emphasized: emphasized,
+ ),
),
),
),
@@ -4541,7 +4543,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
child: WorkspaceStatusLine(
parts: parts!,
links: _contextLinks(focused),
- selection: theme.selection,
color: prefs.color,
nextBackground: prBackground,
),
@@ -4561,16 +4562,17 @@ class _SwarmScreenState extends State<SwarmScreen> {
key: const ValueKey('workspace-pull-request'),
label: '${pr.label} — Open on GitHub',
tooltip: 'Open pull request #${pr.number} on GitHub',
- selection: theme.selection,
onPressed: _shortcutsEnabled
? () => _openFocusedPullRequest(pr.url.toString())
: null,
- child: SizedBox(
+ builder: (context, emphasized) => SizedBox(
height: toolHeight,
child: Center(
+ widthFactor: 1,
child: StatusLine(
parts: prParts!,
workspaceBar: true,
+ emphasized: emphasized,
color: prefs.color,
segmentOffset: parts?.segments.length ?? 0,
),
@@ -4632,12 +4634,16 @@ class _SwarmScreenState extends State<SwarmScreen> {
key: ValueKey('swarm-$id-button'),
label: label,
tooltip: tooltip ?? label,
- selection: theme.selection,
foreground: theme.foreground,
onPressed: _shortcutsEnabled ? onPressed : null,
- child: SizedBox.fromSize(
+ builder: (context, emphasized) => SizedBox.fromSize(
size: size,
- child: Center(child: Text(symbol, style: workspaceBarTextStyle())),
+ child: Center(
+ child: Text(
+ symbol,
+ style: workspaceBarTextStyle(emphasized: emphasized),
+ ),
+ ),
),
);
}
diff --git a/desktop/lib/shared/theme/workspace_bar_style.dart b/desktop/lib/shared/theme/workspace_bar_style.dart
index 676df4254..9aee25f1b 100644
--- a/desktop/lib/shared/theme/workspace_bar_style.dart
+++ b/desktop/lib/shared/theme/workspace_bar_style.dart
@@ -8,16 +8,17 @@ import '../../terminal/terminal_typography.dart';
/// SF Mono on macOS, with the platform's monospace stack elsewhere.
const workspaceBarFontSize = 13.0;
-TextStyle workspaceBarTextStyle({Color? color}) => TextStyle(
- fontFamily: terminalFontFamily,
- fontFamilyFallback: terminalFontFallback,
- fontSize: workspaceBarFontSize,
- fontWeight: FontWeight.normal,
- height: 1.2,
- letterSpacing: 0,
- wordSpacing: 0,
- color: color,
-);
+TextStyle workspaceBarTextStyle({Color? color, bool emphasized = false}) =>
+ TextStyle(
+ fontFamily: terminalFontFamily,
+ fontFamilyFallback: terminalFontFallback,
+ fontSize: workspaceBarFontSize,
+ fontWeight: emphasized ? FontWeight.bold : FontWeight.normal,
+ height: 1.2,
+ letterSpacing: 0,
+ wordSpacing: 0,
+ color: color,
+ );
/// Measure bar padding and controls using their own character grid.
Size workspaceBarCellSizeOf(BuildContext context) {
@@ -25,17 +26,29 @@ Size workspaceBarCellSizeOf(BuildContext context) {
return Size(size.width / 10, size.height);
}
-/// A common highlight height, including the whitespace above and below text.
+/// A common click target height, including whitespace above and below text.
double workspaceBarControlHeight(BuildContext context) =>
math.max(28, workspaceBarCellSizeOf(context).height);
Size workspaceBarTextSizeOf(BuildContext context, String text) {
- final painter = TextPainter(
- text: TextSpan(text: text, style: workspaceBarTextStyle()),
- textDirection: TextDirection.ltr,
- textScaler: MediaQuery.textScalerOf(context),
- )..layout();
- final size = painter.size;
- painter.dispose();
+ // Reserve both weights, including fallback glyphs, so hover never resizes a
+ // control or moves a neighboring segment.
+ var size = Size.zero;
+ for (final emphasized in [false, true]) {
+ final painter = TextPainter(
+ text: TextSpan(
+ text: text,
+ style: workspaceBarTextStyle(emphasized: emphasized),
+ ),
+ textDirection: TextDirection.ltr,
+ textScaler: MediaQuery.textScalerOf(context),
+ maxLines: 1,
+ )..layout();
+ size = Size(
+ math.max(size.width, painter.width),
+ math.max(size.height, painter.height),
+ );
+ painter.dispose();
+ }
return size;
}
diff --git a/desktop/lib/widgets/agent_drag.dart b/desktop/lib/widgets/agent_drag.dart
index 154a7e9f2..9d898a8fc 100644
--- a/desktop/lib/widgets/agent_drag.dart
+++ b/desktop/lib/widgets/agent_drag.dart
@@ -130,13 +130,17 @@ class PaneCloseButton extends StatelessWidget {
'Close Pane',
if (hint != null && hint.isNotEmpty) hint,
].join(' · '),
- selection: theme.selection,
foreground: theme.foreground,
onPressed: onPressed,
- child: SizedBox(
+ builder: (context, emphasized) => SizedBox(
width: workspaceBarCellSizeOf(context).width * 3,
height: workspaceBarControlHeight(context),
- child: Center(child: Text('x', style: workspaceBarTextStyle())),
+ child: Center(
+ child: Text(
+ 'x',
+ style: workspaceBarTextStyle(emphasized: emphasized),
+ ),
+ ),
),
),
);
diff --git a/desktop/lib/widgets/grid_model_picker.dart b/desktop/lib/widgets/grid_model_picker.dart
index 5e0d4842b..0a430b02e 100644
--- a/desktop/lib/widgets/grid_model_picker.dart
+++ b/desktop/lib/widgets/grid_model_picker.dart
@@ -542,10 +542,9 @@ class _GridModelPickerState extends State<GridModelPicker> {
if (widget.enabled) 'Switch model · Subscription or local models',
?sentence,
].join('\n'),
- selection: theme.selection,
foreground: theme.foreground,
onPressed: widget.enabled ? _open : null,
- child: SizedBox(
+ builder: (context, emphasized) => SizedBox(
width: math.min(labelSize.width, textWidth) + padding * 2,
height: workspaceBarControlHeight(context),
child: Padding(
@@ -555,7 +554,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: workspaceBarTextStyle(),
+ style: workspaceBarTextStyle(emphasized: emphasized),
),
),
),
diff --git a/desktop/lib/widgets/status_line.dart b/desktop/lib/widgets/status_line.dart
index d4ecff640..ab0db3288 100644
--- a/desktop/lib/widgets/status_line.dart
+++ b/desktop/lib/widgets/status_line.dart
@@ -19,6 +19,7 @@ class StatusLine extends StatelessWidget {
this.nextBackground,
this.segmentOffset = 0,
this.workspaceBar = false,
+ this.emphasized = false,
});
final StatusLineParts parts;
final bool color;
@@ -28,6 +29,7 @@ class StatusLine extends StatelessWidget {
final Color? nextBackground;
final int segmentOffset;
final bool workspaceBar;
+ final bool emphasized;
@override
Widget build(BuildContext context) {
@@ -41,7 +43,10 @@ class StatusLine extends StatelessWidget {
terminalThemeStore.value,
);
final style = workspaceBar
- ? workspaceBarTextStyle(color: theme.foreground)
+ ? workspaceBarTextStyle(
+ color: theme.foreground,
+ emphasized: emphasized,
+ )
: terminalContentStyle(color: theme.foreground);
final segments = statusLinePaintSegments(
parts,
@@ -50,7 +55,7 @@ class StatusLine extends StatelessWidget {
segmentOffset: segmentOffset,
);
if (!parts.style.segmented) {
- return Text.rich(
+ final text = Text.rich(
TextSpan(
children: [
for (final segment in segments)
@@ -66,6 +71,15 @@ class StatusLine extends StatelessWidget {
overflow: TextOverflow.ellipsis,
textAlign: textAlign,
);
+ return workspaceBar
+ ? SizedBox(
+ width: workspaceBarTextSizeOf(
+ context,
+ segments.map((s) => s.text).join(),
+ ).width,
+ child: text,
+ )
+ : text;
}
final cell = workspaceBar
? workspaceBarCellSizeOf(context)
@@ -91,7 +105,9 @@ class StatusLine extends StatelessWidget {
}
final widths = [
for (final segment in segments)
- _measure(segment.text, style, scaler),
+ workspaceBar
+ ? workspaceBarTextSizeOf(context, segment.text).width
+ : _measure(segment.text, style, scaler),
];
final natural =
widths.fold(0.0, (a, b) => a + b) +
diff --git a/desktop/lib/widgets/workspace_bar_control.dart b/desktop/lib/widgets/workspace_bar_control.dart
index c89e9cee3..54885860b 100644
--- a/desktop/lib/widgets/workspace_bar_control.dart
+++ b/desktop/lib/widgets/workspace_bar_control.dart
@@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
-/// The same flat target for tabs, status links, symbols, model labels, and pane close actions.
-/// Callers size the child to `workspaceBarControlHeight` and supply only hints
-/// that add information to the visible label.
+/// Shared text emphasis for tabs, status links, symbols, models, and pane close.
+/// Builders keep their layout fixed while drawing emphasized text. Only the
+/// selected tab has a fill; hovering preserves the surface underneath.
class WorkspaceBarControl extends StatefulWidget {
const WorkspaceBarControl({
super.key,
required this.label,
- required this.selection,
- required this.child,
+ required this.builder,
+ this.selectedBackground,
this.tooltip,
this.foreground,
this.selected,
@@ -17,10 +17,10 @@ class WorkspaceBarControl extends StatefulWidget {
final String label;
final String? tooltip;
- final Color selection;
+ final Color? selectedBackground;
final Color? foreground;
final bool? selected;
- final Widget child;
+ final Widget Function(BuildContext context, bool emphasized) builder;
final VoidCallback? onPressed;
@override
@@ -34,23 +34,17 @@ class _WorkspaceBarControlState extends State<WorkspaceBarControl> {
Widget build(BuildContext context) {
final enabled = widget.onPressed != null;
final active = enabled && (_hovered || _focused || _pressed);
- Widget content = widget.child;
+ Widget content = widget.builder(context, active);
if (widget.foreground case final foreground?) {
content = DefaultTextStyle.merge(
style: TextStyle(
- color: foreground.withValues(
- alpha: !enabled
- ? .28
- : active
- ? 1
- : .75,
- ),
+ color: foreground.withValues(alpha: enabled ? .75 : .28),
),
child: content,
);
}
- if (widget.selected == true) {
- content = ColoredBox(color: widget.selection, child: content);
+ if (widget.selected == true && widget.selectedBackground != null) {
+ content = ColoredBox(color: widget.selectedBackground!, child: content);
}
final control = Semantics(
button: true,
@@ -81,22 +75,7 @@ class _WorkspaceBarControlState extends State<WorkspaceBarControl> {
onTapDown: enabled ? (_) => setState(() => _pressed = true) : null,
onTapUp: (_) => setState(() => _pressed = false),
onTapCancel: () => setState(() => _pressed = false),
- child: ExcludeSemantics(
- child: Stack(
- alignment: Alignment.center,
- children: [
- content,
- if (active && widget.selected != true)
- Positioned.fill(
- child: IgnorePointer(
- child: ColoredBox(
- color: widget.selection.withValues(alpha: .5),
- ),
- ),
- ),
- ],
- ),
- ),
+ child: ExcludeSemantics(child: content),
),
),
),
diff --git a/desktop/lib/widgets/workspace_status_line.dart b/desktop/lib/widgets/workspace_status_line.dart
index 55ebcada1..2c757ec03 100644
--- a/desktop/lib/widgets/workspace_status_line.dart
+++ b/desktop/lib/widgets/workspace_status_line.dart
@@ -16,13 +16,11 @@ class WorkspaceStatusLine extends StatelessWidget {
super.key,
required this.parts,
required this.links,
- required this.selection,
required this.color,
this.nextBackground,
});
final StatusLineParts parts;
final Map<StatusLineField, StatusLineLink> links;
- final Color selection;
final bool color;
final Color? nextBackground;
@@ -37,24 +35,14 @@ class WorkspaceStatusLine extends StatelessWidget {
final components = parts.components;
final widths = [
for (final component in components)
- (() {
- final painter = TextPainter(
- text: TextSpan(
- text: component.parts.segments.map((s) => s.text).join(),
- style: workspaceBarTextStyle(),
- ),
- textDirection: TextDirection.ltr,
- textScaler: TextScaler.noScaling,
- maxLines: 1,
- )..layout();
- final width =
- painter.width +
- (parts.style.segmented
- ? component.parts.segments.length * cell.width * 3
- : 0);
- painter.dispose();
- return width;
- })(),
+ component.parts.segments.fold(
+ 0.0,
+ (width, segment) =>
+ width + workspaceBarTextSizeOf(context, segment.text).width,
+ ) +
+ (parts.style.segmented
+ ? component.parts.segments.length * cell.width * 3
+ : 0),
];
return LayoutBuilder(
builder: (context, constraints) {
@@ -66,7 +54,7 @@ class WorkspaceStatusLine extends StatelessWidget {
(() {
final component = components[i];
final link = links[component.field];
- final body = SizedBox(
+ Widget body(BuildContext context, bool emphasized) => SizedBox(
width: fitted[i],
height: height,
child: Center(
@@ -74,6 +62,7 @@ class WorkspaceStatusLine extends StatelessWidget {
parts: component.parts,
color: color,
workspaceBar: true,
+ emphasized: emphasized,
textAlign: TextAlign.left,
segmentOffset: component.offset,
nextBackground: i == components.length - 1
@@ -88,16 +77,15 @@ class WorkspaceStatusLine extends StatelessWidget {
),
);
return link == null
- ? body
+ ? body(context, false)
: WorkspaceBarControl(
key: ValueKey(
'workspace-context-${component.field!.name}',
),
label: link.label,
tooltip: link.label,
- selection: selection,
onPressed: link.onPressed,
- child: body,
+ builder: body,
);
})(),
],
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index c04b5ef81..44417b7be 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -829,7 +829,7 @@ private struct SwarmNativePalette: Equatable {
}
}
-/// Match the quiet rounded hover well used by the app's pane controls.
+/// Generic native icon controls retain their rounded hover wells.
private class SwarmIconButton: NSButton {
private(set) var hovered = false
private(set) var hasKeyboardFocus = false
@@ -885,22 +885,25 @@ private func workspaceBarControlHeight(_ font: NSFont) -> CGFloat {
max(28, ceil(font.pointSize * 1.2))
}
-private func drawWorkspaceBarHover(_ rect: NSRect, selection: NSColor) {
- selection.withAlphaComponent(0.5).setFill()
- rect.fill()
+private func workspaceBarEmphasisFont(_ font: NSFont) -> NSFont {
+ NSFontManager.shared.convert(font, toHaveTrait: .boldFontMask)
+}
+
+private func workspaceBarTextWidth(_ text: String, font: NSFont) -> CGFloat {
+ max((text as NSString).size(withAttributes: [.font: font]).width,
+ (text as NSString).size(withAttributes: [.font: workspaceBarEmphasisFont(font)]).width)
}
/// Terminal symbols with a shared text baseline and a visible hover/focus cue.
private final class SwarmStatusSymbolButton: SwarmIconButton {
var foreground = NSColor(white: 0.85, alpha: 1) { didSet { needsDisplay = true } }
- var selection = NSColor(white: 0.35, alpha: 1) { didSet { needsDisplay = true } }
override func draw(_ dirtyRect: NSRect) {
let active = isEnabled && (hovered || hasKeyboardFocus || isHighlighted)
- defer { if active { drawWorkspaceBarHover(bounds, selection: selection) } }
+ let regularFont = font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
let line = NSAttributedString(string: title, attributes: [
- .font: font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular),
- .foregroundColor: foreground.withAlphaComponent(!isEnabled ? 0.28 : active ? 1 : 0.75),
+ .font: active ? workspaceBarEmphasisFont(regularFont) : regularFont,
+ .foregroundColor: foreground.withAlphaComponent(isEnabled ? 0.75 : 0.28),
])
let size = line.size()
line.draw(in: NSRect(x: (bounds.width - size.width) / 2,
@@ -941,7 +944,6 @@ private struct SwarmStatusSegment {
/// Dart sends the same resolved segments that Flutter uses for its previews.
/// Shapes are drawn in cells; no Powerline/Nerd Font installation is needed.
private final class SwarmContextButton: SwarmIconButton {
- var selection = NSColor(white: 0.35, alpha: 1)
var onField: ((String, Int) -> Void)?
fileprivate private(set) var fieldButtons: [SwarmContextButton] = []
private var field: String?
@@ -962,7 +964,7 @@ private final class SwarmContextButton: SwarmIconButton {
private var textFont: NSFont { font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular) }
private var cellWidth: CGFloat { ("m" as NSString).size(withAttributes: [.font: textFont]).width }
private var naturalWidths: [CGFloat] {
- segments.map { ($0.text as NSString).size(withAttributes: [.font: textFont]).width }
+ segments.map { workspaceBarTextWidth($0.text, font: textFont) }
}
var preferredWidth: CGFloat {
if !fieldButtons.isEmpty { return fieldButtons.reduce(0) { $0 + $1.preferredWidth } }
@@ -992,7 +994,6 @@ private final class SwarmContextButton: SwarmIconButton {
button.font = font
button.textAlignment = .left
button.foreground = foreground
- button.selection = selection
button.update(values, enabled: enabled)
button.setAccessibilityLabel(values["detail"] as? String ?? values["text"] as? String)
}
@@ -1056,18 +1057,15 @@ private final class SwarmContextButton: SwarmIconButton {
paragraph.lineBreakMode = .byTruncatingTail
paragraph.alignment = alignment
return NSAttributedString(string: value, attributes: [
- .font: textFont, .foregroundColor: color, .paragraphStyle: paragraph,
+ .font: isEnabled && (hovered || hasKeyboardFocus || isHighlighted)
+ ? workspaceBarEmphasisFont(textFont) : textFont,
+ .foregroundColor: color, .paragraphStyle: paragraph,
])
}
override func draw(_ dirtyRect: NSRect) {
guard fieldButtons.isEmpty, bounds.width > 0, !segments.isEmpty else { return }
NSGraphicsContext.saveGraphicsState()
- defer {
- if isEnabled && (hovered || hasKeyboardFocus || isHighlighted) {
- drawWorkspaceBarHover(bounds, selection: selection)
- }
- NSGraphicsContext.restoreGraphicsState()
- }
+ defer { NSGraphicsContext.restoreGraphicsState() }
bounds.clip()
if !drawsSegments {
let line = NSMutableAttributedString(string: "")
@@ -1145,7 +1143,6 @@ private final class SwarmTabStrip: NSView {
fileprivate let storeButton = SwarmStatusSymbolButton()
private var barFont = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
private var terminalForeground = NSColor(white: 0.85, alpha: 1)
- private var terminalSelection = NSColor(white: 0.35, alpha: 1)
private var tabs: [SwarmTabButton] = []
private var activeId = ""
private var revealActiveAfterLayout = false
@@ -1247,28 +1244,23 @@ private final class SwarmTabStrip: NSView {
barFont = families.lazy.compactMap { NSFont(name: $0, size: size) }.first
?? NSFont.monospacedSystemFont(ofSize: size, weight: .regular)
terminalForeground = statusColor(style["foreground"], fallback: terminalForeground)
- terminalSelection = statusColor(style["selection"], fallback: terminalSelection)
}
for control in [newButton, harnessesButton, machinesButton, modelsButton, storeButton] {
control.font = barFont
control.foreground = terminalForeground
- control.selection = terminalSelection
control.isEnabled = actionsEnabled
}
focusedModelButton.font = barFont
focusedModelButton.foreground = terminalForeground
- focusedModelButton.selection = terminalSelection
focusedModelButton.contentPadding = ("m" as NSString).size(withAttributes: [.font: barFont]).width
focusedModelTarget = state["focusedModel"] as? [String: Any]
focusedModelButton.update(focusedModelTarget, enabled: actionsEnabled)
focusedModelButton.isHidden = focusedModelTarget == nil
contextButton.font = barFont
contextButton.foreground = terminalForeground
- contextButton.selection = terminalSelection
contextButton.update(state["focusedContext"] as? [String: Any], enabled: actionsEnabled)
pullRequestButton.font = barFont
pullRequestButton.foreground = terminalForeground
- pullRequestButton.selection = terminalSelection
pullRequestButton.update(state["pullRequest"] as? [String: Any], enabled: actionsEnabled)
pullRequestButton.isHidden = state["pullRequest"] == nil
let rows = state["tabs"] as? [[String: Any]] ?? []
@@ -1288,7 +1280,6 @@ private final class SwarmTabStrip: NSView {
tab.displayLabel = row["label"] as? String ?? tab.name
tab.labelFont = barFont
tab.foreground = terminalForeground
- tab.selection = terminalSelection
tab.selected = id == activeId
tab.actionsEnabled = actionsEnabled
tab.attention = (row["attention"] as? Int ?? 0) > 0
@@ -1458,9 +1449,8 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
var name = "New Tab" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
var displayLabel = "New Tab" { didSet { if displayLabel != oldValue { invalidateLabel() } } }
var foreground = NSColor(white: 0.85, alpha: 1) { didSet { if foreground != oldValue { invalidateLabel() } } }
- var selection = NSColor(white: 0.35, alpha: 1) { didSet { if selection != oldValue { needsDisplay = true } } }
private var cellWidth: CGFloat { ceil(("m" as NSString).size(withAttributes: [.font: labelFont]).width) }
- var preferredWidth: CGFloat { min(cellWidth * 24, ceil(label.size().width / cellWidth) * cellWidth + cellWidth * 2) }
+ var preferredWidth: CGFloat { min(cellWidth * 24, ceil(max(label.size().width, emphasizedLabel.size().width) / cellWidth) * cellWidth + cellWidth * 2) }
var selected = false { didSet { if selected != oldValue { invalidateLabel(); updateAccessibility() } } }
var attention = false { didSet { if attention != oldValue { needsDisplay = true; updateAccessibility() } } }
var showsDivider = false { didSet { if showsDivider != oldValue { needsDisplay = true } } }
@@ -1476,6 +1466,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
didSet { if oldValue != labelFont { invalidateLabel() } }
}
private var cachedLabel: NSAttributedString?
+ private var cachedEmphasizedLabel: NSAttributedString?
var actionsEnabled = true {
didSet {
selectButton.isEnabled = actionsEnabled
@@ -1516,7 +1507,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
.trimmingCharacters(in: .whitespacesAndNewlines)
let fullName = name.trimmingCharacters(in: .whitespacesAndNewlines)
var hints: [String] = []
- if label.size().width > max(0, bounds.width - cellWidth * 2) { hints.append(displayLabel) }
+ if max(label.size().width, emphasizedLabel.size().width) > max(0, bounds.width - cellWidth * 2) { hints.append(displayLabel) }
if !fullName.isEmpty && fullName != visibleName && fullName != displayLabel { hints.append(name) }
toolTip = hints.isEmpty ? nil : hints.joined(separator: "\n")
}
@@ -1538,6 +1529,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
}
private func invalidateLabel() {
cachedLabel = nil
+ cachedEmphasizedLabel = nil
needsDisplay = true
needsLayout = true
}
@@ -1546,27 +1538,26 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
let paragraph = NSMutableParagraphStyle()
paragraph.lineBreakMode = .byTruncatingTail
paragraph.alignment = .center
- // One weight for every tab: the selected one is already told apart by its
- // fill and its brighter ink, and a bold name also changes width, so the
- // strip re-truncated whenever the selection moved (owner, 2026-09-24).
let label = NSAttributedString(string: displayLabel,
attributes: [.font: labelFont,
.foregroundColor: foreground, .paragraphStyle: paragraph])
cachedLabel = label
return label
}
+ private var emphasizedLabel: NSAttributedString {
+ if let cachedEmphasizedLabel { return cachedEmphasizedLabel }
+ let emphasized = NSMutableAttributedString(attributedString: label)
+ emphasized.addAttribute(.font, value: workspaceBarEmphasisFont(labelFont),
+ range: NSRange(location: 0, length: emphasized.length))
+ cachedEmphasizedLabel = emphasized
+ return emphasized
+ }
override func draw(_ dirtyRect: NSRect) {
- let text = label
- let height = workspaceBarControlHeight(labelFont)
- let row = NSRect(x: 0, y: contentCenterY - height / 2, width: bounds.width, height: height)
+ let active = actionsEnabled && (hovered || selectButton.hasKeyboardFocus || selectButton.isHighlighted)
+ let text = active ? emphasizedLabel : label
if selected {
- selection.setFill()
- row.fill()
- }
- defer {
- if !selected && (hovered || selectButton.hasKeyboardFocus || selectButton.isHighlighted) && actionsEnabled {
- drawWorkspaceBarHover(row, selection: selection)
- }
+ palette.workspace.setFill()
+ bounds.fill()
}
text.draw(in: NSRect(x: cellWidth, y: contentCenterY - text.size().height / 2,
width: max(0, bounds.width - cellWidth * 2), height: text.size().height))
diff --git a/desktop/test/workspace_context_navigation_test.dart b/desktop/test/workspace_context_navigation_test.dart
index ccc8ecb19..732e15d56 100644
--- a/desktop/test/workspace_context_navigation_test.dart
+++ b/desktop/test/workspace_context_navigation_test.dart
@@ -6,6 +6,7 @@ import 'package:harness/core/models.dart';
import 'package:harness/shared/theme/appearance_prefs_store.dart';
import 'package:harness/shared/theme/prompt_style.dart';
import 'package:harness/shared/theme/status_line_style.dart';
+import 'package:harness/shared/theme/workspace_bar_style.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/state/swarm_search.dart';
import 'package:harness/state/swarm_navigation.dart';
@@ -338,7 +339,7 @@ void main() {
}
testWidgets(
- 'status links highlight only their own rectangle and activate from keyboard',
+ 'status links emphasize text without a fill and activate from keyboard',
(tester) async {
final previousHighlight = FocusManager.instance.highlightStrategy;
FocusManager.instance.highlightStrategy =
@@ -357,12 +358,14 @@ void main() {
rebuild = setState;
return WorkspaceBarControl(
label: 'Find harnesses on M2',
- selection: Colors.grey,
onPressed: enabled ? () => calls++ : null,
- child: const SizedBox(
+ builder: (context, emphasized) => SizedBox(
width: 100,
height: 28,
- child: Text('M2'),
+ child: Text(
+ 'M2',
+ style: workspaceBarTextStyle(emphasized: emphasized),
+ ),
),
);
},
@@ -374,24 +377,36 @@ void main() {
Finder highlights() =>
find.descendant(of: control, matching: find.byType(ColoredBox));
expect(highlights(), findsNothing);
+ FontWeight? weight() =>
+ tester.widget<Text>(find.text('M2')).style?.fontWeight;
+ expect(weight(), FontWeight.normal);
+ final rect = tester.getRect(control);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(tester.getCenter(control));
await tester.pump();
- expect(highlights(), findsOneWidget);
- expect(tester.getSize(highlights()), const Size(100, 28));
+ expect(highlights(), findsNothing);
+ expect(weight(), FontWeight.bold);
+ expect(tester.getRect(control), rect);
await mouse.moveTo(const Offset(400, 400));
await tester.pump();
expect(highlights(), findsNothing);
+ expect(weight(), FontWeight.normal);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();
- expect(highlights(), findsOneWidget);
+ expect(highlights(), findsNothing);
+ expect(weight(), FontWeight.bold);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
expect(calls, 1);
rebuild(() => enabled = false);
await tester.pump();
expect(highlights(), findsNothing);
+ expect(weight(), FontWeight.normal);
+ await mouse.moveTo(tester.getCenter(control));
+ await tester.pump();
+ expect(weight(), FontWeight.normal);
+ expect(tester.getRect(control), rect);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
expect(calls, 1);
await mouse.removePointer();
diff --git a/desktop/test/workspace_status_test.dart b/desktop/test/workspace_status_test.dart
index 47155b083..591ca5bd0 100644
--- a/desktop/test/workspace_status_test.dart
+++ b/desktop/test/workspace_status_test.dart
@@ -11,6 +11,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/shared/theme/appearance_prefs_store.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/prompt_style.dart';
import 'package:harness/shared/theme/status_line_style.dart';
import 'package:harness/state/swarm.dart';
@@ -83,14 +84,20 @@ class _PaneModelConnection extends _PRConnection {
}
}
-Future<void> captureControls(WidgetTester tester, String name) async {
+Future<void> captureControls(
+ WidgetTester tester,
+ String name, {
+ double? height,
+}) async {
final directory =
Platform.environment['HARNESS_WORKSPACE_CONTROLS_CAPTURE_DIR'];
if (directory == null) return;
final view = tester.binding.renderViews.first;
final layer = view.debugLayer! as OffsetLayer;
await tester.runAsync(() async {
- final image = await layer.toImage(Offset.zero & view.size);
+ final image = await layer.toImage(
+ Rect.fromLTWH(0, 0, view.size.width, height ?? view.size.height),
+ );
final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
final file = File('$directory/$name.png');
await file.parent.create(recursive: true);
@@ -264,6 +271,23 @@ void main() {
for (var i = 0; i < 2; i++) {
expect(tester.getRect(titles.at(i)), titleRects[i]);
}
+ await mouse.moveTo(tester.getCenter(close.hitTestable()));
+ await tester.pump();
+ final closeText = find.descendant(
+ of: close.hitTestable(),
+ matching: find.text('x'),
+ );
+ expect(tester.widget<Text>(closeText).style?.fontWeight, FontWeight.bold);
+ expect(
+ find.descendant(
+ of: close.hitTestable(),
+ matching: find.byType(ColoredBox),
+ ),
+ findsNothing,
+ );
+ for (var i = 0; i < 2; i++) {
+ expect(tester.getRect(titles.at(i)), titleRects[i]);
+ }
await tester.pump(const Duration(milliseconds: 100));
await captureControls(tester, 'pane-hover-close');
await tester.tap(close.hitTestable());
@@ -366,7 +390,78 @@ void main() {
? closeTo(contextRight, .01)
: greaterThan(contextRight),
);
+ if (style.segmented) {
+ final ribbon = find.descendant(
+ of: badge,
+ matching: find.byType(CustomPaint),
+ );
+ expect(
+ tester.getRect(ribbon).left,
+ closeTo(tester.getRect(badge).left, .01),
+ );
+ expect(
+ tester.getRect(ribbon).right,
+ closeTo(tester.getRect(badge).right, .01),
+ );
+ }
+ }
+ final controls = find.descendant(
+ of: find.byKey(const ValueKey('workspace-status-bar')),
+ matching: find.byType(WorkspaceBarControl),
+ );
+ final controlsBefore = controls
+ .evaluate()
+ .map((element) => tester.getRect(find.byWidget(element.widget)))
+ .toList();
+ final mouse = await tester.createGesture(
+ kind: PointerDeviceKind.mouse,
+ );
+ await mouse.addPointer(location: Offset.zero);
+ for (final key in [
+ 'workspace-context-project',
+ 'workspace-pull-request',
+ ]) {
+ final target = find.byKey(ValueKey(key));
+ await mouse.moveTo(tester.getCenter(target));
+ await tester.pump();
+ final lines = find.descendant(
+ of: target,
+ matching: find.byType(StatusLine),
+ );
+ expect(tester.widget<StatusLine>(lines).emphasized, isTrue);
+ expect(
+ find.descendant(of: target, matching: find.byType(ColoredBox)),
+ findsNothing,
+ );
+ expect(
+ controls.evaluate().map(
+ (element) => tester.getRect(find.byWidget(element.widget)),
+ ),
+ controlsBefore,
+ );
+ if (key == 'workspace-pull-request') {
+ expect(
+ tester
+ .widget<StatusLine>(
+ find.descendant(
+ of: find.byKey(
+ const ValueKey('workspace-context-project'),
+ ),
+ matching: find.byType(StatusLine),
+ ),
+ )
+ .emphasized,
+ isFalse,
+ );
+ await captureControls(
+ tester,
+ 'bar-hover-${style.name}',
+ height: 100,
+ );
+ }
}
+ await mouse.removePointer();
+ await tester.pump();
}
}
expect(connection.reads, 1);
@@ -732,8 +827,26 @@ void main() {
);
final secondTab = find.byKey(ValueKey(app.activeSwarmId));
final barControls = find.byType(WorkspaceBarControl);
+ final bar = find.byKey(const ValueKey('workspace-status-bar'));
for (final element in barControls.evaluate()) {
- expect(tester.getSize(find.byWidget(element.widget)).height, 28);
+ final control = element.widget as WorkspaceBarControl;
+ final rect = tester.getRect(find.byWidget(control));
+ expect(
+ rect.height,
+ control.selected == null ? 28 : tester.getSize(bar).height,
+ );
+ if (control.selected == true) {
+ final fill = find.descendant(
+ of: find.byWidget(control),
+ matching: find.byType(ColoredBox),
+ );
+ expect(
+ tester.widget<ColoredBox>(fill).color,
+ grid.AppPalette.swarmWelcome,
+ );
+ expect(tester.getRect(fill).top, tester.getRect(bar).top);
+ expect(tester.getRect(fill).bottom, tester.getRect(bar).bottom);
+ }
}
expect(tester.getSize(secondTab).width, lessThan(150));
final harnesses = find.byKey(const ValueKey('swarm-harnesses-button'));
@@ -819,20 +932,24 @@ void main() {
final symbol = find.descendant(of: machines, matching: find.text('@'));
Color? color() => DefaultTextStyle.of(tester.element(symbol)).style.color;
final resting = color();
+ FontWeight? weight() => tester.widget<Text>(symbol).style?.fontWeight;
+ expect(weight(), FontWeight.normal);
final pointer = await tester.createGesture(kind: PointerDeviceKind.mouse);
await pointer.addPointer(location: Offset.zero);
await pointer.moveTo(tester.getCenter(machines));
await tester.pump(const Duration(milliseconds: 800));
await tester.pump(const Duration(milliseconds: 200));
expect(find.text('Machines'), findsOneWidget);
- expect(color(), isNot(resting));
+ expect(color(), resting);
+ expect(weight(), FontWeight.bold);
await pointer.removePointer();
await tester.pumpAndSettle();
final focus = Focus.of(tester.element(symbol));
focus.requestFocus();
await tester.pumpAndSettle();
expect(focus.hasFocus, isTrue);
- expect(color(), isNot(resting));
+ expect(color(), resting);
+ expect(weight(), FontWeight.bold);
await tester.pump(const Duration(milliseconds: 100));
await tester.pumpWidget(const SizedBox());
},
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index b4637c214..a1dd017b9 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -64,20 +64,24 @@ private extension SwarmTabButton {
let symbol = SwarmStatusSymbolButton(frame: NSRect(x: 0, y: 0, width: 32, height: 28))
symbol.title = "+"
- symbol.selection = selection
let hover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
timestamp: 0, windowNumber: 0, context: nil, eventNumber: 0, clickCount: 0, pressure: 0)!
+ let symbolResting = symbol.renderedPixels()
symbol.mouseEntered(with: hover)
- let expectedColor = symbol.renderedBitmap().colorAt(x: 1, y: 1)!
+ try checkTitlebar(symbol.renderedPixels() != symbolResting &&
+ symbol.renderedBitmap().colorAt(x: 1, y: 1)!.alphaComponent == 0,
+ "Symbols become bold on hover without adding a background")
+ let width = preferredWidth
+ let resting = renderedPixels()
mouseEntered(with: hover)
let hovered = renderedBitmap()
let filledRows = (0..<hovered.pixelsHigh).filter { hovered.colorAt(x: 1, y: $0)!.alphaComponent > 0 }
- try checkTitlebar(filledRows.count == Int(symbol.bounds.height),
- "Tab and symbol hover rectangles have the same height")
- try checkTitlebar(hovered.colorAt(x: 1, y: 20) == expectedColor,
- "Tab and symbol hover rectangles use the same selection tint")
+ try checkTitlebar(filledRows.isEmpty && renderedPixels() != resting,
+ "Tabs become bold on hover without adding a background")
+ try checkTitlebar(preferredWidth == width &&
+ NSFontManager.shared.traits(of: emphasizedLabel.attribute(.font, at: 0, effectiveRange: nil) as! NSFont).contains(.boldFontMask),
+ "Hover uses a bold font while preserving the tab width")
mouseExited(with: hover)
- let resting = renderedPixels()
selectButton.highlight(true)
try checkTitlebar(renderedPixels() != resting, "Pressing a tab uses the same visible highlight")
selectButton.highlight(false)
@@ -88,8 +92,18 @@ private extension SwarmTabButton {
selected = true
let active = renderedBitmap()
let selectedRows = (0..<active.pixelsHigh).filter { active.colorAt(x: 1, y: $0)!.alphaComponent > 0 }
- try checkTitlebar(selectedRows == filledRows && active.colorAt(x: 1, y: 20)!.alphaComponent == 1,
- "Tab selection shares hover geometry with full selection opacity")
+ try checkTitlebar(selectedRows.count == Int(bounds.height) && active.colorAt(x: 1, y: 20)!.alphaComponent == 1,
+ "Selected tabs fill the full bar height")
+ mouseExited(with: hover)
+ for argb in [Int64(0xff282828), Int64(0xfff0f2f5)] {
+ palette = SwarmNativePalette(["workspace": argb])
+ let background = palette.workspace
+ let pixel = renderedBitmap().colorAt(x: 1, y: 1)!.usingColorSpace(.sRGB)!
+ try checkTitlebar(abs(pixel.redComponent - background.redComponent) < 0.01 &&
+ abs(pixel.greenComponent - background.greenComponent) < 0.01 &&
+ abs(pixel.blueComponent - background.blueComponent) < 0.01,
+ "Active tabs join the workspace color in light and dark palettes")
+ }
}
func checkDoubleClickIsolation() throws {
@@ -259,6 +273,9 @@ private extension SwarmTabStrip {
setFrameSize(originalSize)
update(prState)
let mergedPixels = pullRequestButton.renderedPixels()
+ let mergedBitmap = pullRequestButton.renderedBitmap()
+ let prFrame = pullRequestButton.frame
+ let prWidth = pullRequestButton.preferredWidth
try checkTitlebar(!mergedPixels.isEmpty && pullRequestButton.accessibilityValue() as? String == "#298 Merged",
"Segmented PR renders and exposes its full state")
pullRequestButton.performClick(nil)
@@ -266,7 +283,14 @@ private extension SwarmTabStrip {
let pointer = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
timestamp: 0, windowNumber: 0, context: nil, eventNumber: 0, clickCount: 0, pressure: 0)!
pullRequestButton.mouseEntered(with: pointer)
- try checkTitlebar(pullRequestButton.renderedPixels() != mergedPixels, "A PR has the same visible rectangular hover cue")
+ try checkTitlebar(pullRequestButton.renderedPixels() != mergedPixels, "A PR uses the same bold hover cue")
+ let mergedHover = pullRequestButton.renderedBitmap()
+ try checkTitlebar((0..<mergedBitmap.pixelsWide).allSatisfy {
+ mergedBitmap.colorAt(x: $0, y: 1) == mergedHover.colorAt(x: $0, y: 1)
+ }, "PR hover leaves the space around the ribbon untouched")
+ try checkTitlebar(mergedBitmap.colorAt(x: 1, y: 14) == mergedHover.colorAt(x: 1, y: 14) &&
+ pullRequestButton.frame == prFrame && pullRequestButton.preferredWidth == prWidth,
+ "PR hover preserves the segment background and geometry")
pullRequestButton.mouseExited(with: pointer)
let join = SwarmContextButton(frame: NSRect(x: 0, y: 0, width: 100, height: 28))
join.font = contextButton.font
@@ -303,7 +327,7 @@ private extension SwarmTabStrip {
for control in contextButton.fieldButtons {
let before = control.renderedPixels()
control.mouseEntered(with: pointer)
- try checkTitlebar(control.renderedPixels() != before, "Each context field advertises its own clickable rectangle")
+ try checkTitlebar(control.renderedPixels() != before, "Each context field emphasizes its own text")
control.mouseExited(with: pointer)
control.performClick(nil)
try checkTitlebar(control.toolTip?.hasPrefix("Find harnesses") == true, "Context tooltip explains navigation")
@@ -331,7 +355,9 @@ private extension SwarmTabStrip {
"Model hint explains switching without repeating the visible name")
let modelResting = focusedModelButton.renderedPixels()
focusedModelButton.mouseEntered(with: pointer)
- try checkTitlebar(focusedModelButton.renderedPixels() != modelResting, "Model uses the same flat hover feedback")
+ try checkTitlebar(focusedModelButton.renderedPixels() != modelResting &&
+ focusedModelButton.renderedBitmap().colorAt(x: 1, y: 1)!.alphaComponent == 0,
+ "Model uses bold hover feedback without a background well")
focusedModelButton.mouseExited(with: pointer)
focusedModelButton.performClick(nil)
try checkTitlebar(modelClicks.count == 1 && modelClicks[0].0 == 7 && modelClicks[0].1 == "a0",
@@ -506,7 +532,7 @@ private extension SwarmTabStrip {
let unfocusedNew = newButton.renderedPixels()
try checkTitlebar(window.makeFirstResponder(newButton), "New swarm accepts keyboard focus")
try checkTitlebar(newButton.hasKeyboardFocus && newButton.renderedPixels() != unfocusedNew,
- "Keyboard focus gives the new-tab icon the same visible background as hover")
+ "Keyboard focus gives the new-tab symbol the same bold emphasis as hover")
newButton.performClick(nil)
messenger.finishNextReply()
try checkTitlebar(window.firstResponder === window.contentInput && messenger.calls.last?.method == "new",