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.

desktop: pane header shows folder/branch/PR under the name, model and ⋮ at the right

Timeab5b54f6f4e
diff --git a/desktop/lib/widgets/grid_model_picker.dart b/desktop/lib/widgets/grid_model_picker.dart
index b5be6c468..91ae41a85 100644
--- a/desktop/lib/widgets/grid_model_picker.dart
+++ b/desktop/lib/widgets/grid_model_picker.dart
@@ -476,38 +476,27 @@ class _GridModelPickerState extends State<GridModelPicker> {
horizontal: widget.compact ? 3 : 6,
vertical: 3,
),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: widget.compact ? 44 : 140,
- ),
- child: Text(
- label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: AppType.monoLabel(
- fontWeight: FontWeight.w400,
- color: AppColors.textSoft,
- ),
+ // The model's name alone, no dropdown arrow: the room goes to the name, which is
+ // what a person reads here. A read in flight dims it rather than adding a spinner,
+ // so nothing beside it moves.
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ // Compact: the old label plus the arrow's 14px, so a narrow header keeps its fit.
+ maxWidth: widget.compact ? 58 : 200,
+ ),
+ child: AnimatedOpacity(
+ opacity: _loading ? .45 : 1,
+ duration: const Duration(milliseconds: 120),
+ child: Text(
+ label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: AppType.monoLabel(
+ fontWeight: FontWeight.w400,
+ color: AppColors.textSoft,
),
),
- // Replace the arrow while loading so a read cannot squeeze
- // the session name or move the pane's other controls.
- if (_loading)
- const SizedBox(
- width: 14,
- height: 14,
- child: CircularProgressIndicator(strokeWidth: 1.5),
- )
- else
- Icon(
- Icons.arrow_drop_down,
- size: 14,
- color: AppColors.mutedStrong,
- ),
- ],
+ ),
),
),
),
diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dart
index a78c3442c..629628b7e 100644
--- a/desktop/lib/widgets/pane_header_actions.dart
+++ b/desktop/lib/widgets/pane_header_actions.dart
@@ -1,12 +1,12 @@
+import 'dart:async';
+
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../theme/app_theme.dart';
-import '../shortcuts/keymap.dart';
-import '../shortcuts/app_keymap.dart';
import 'box_chrome.dart';
-import 'transient_menus.dart';
+import 'pane_menu.dart';
/// Direct pane controls, in a stable order even when an action is unavailable.
class PaneHeaderActions extends StatelessWidget {
@@ -99,10 +99,13 @@ class PaneHeaderActions extends StatelessWidget {
);
final visible = _PaneHeaderVisibility.of(context);
+ // The ⋮ menu is always in view: it is one small mark at the edge, not a row of icons that
+ // would crowd the title at rest.
+ final shown = visible || compact;
final controls = IgnorePointer(
- ignoring: !visible,
+ ignoring: !shown,
child: AnimatedOpacity(
- opacity: visible ? 1 : 0,
+ opacity: shown ? 1 : 0,
alwaysIncludeSemantics: true,
duration: MediaQuery.disableAnimationsOf(context)
? Duration.zero
@@ -115,12 +118,19 @@ class PaneHeaderActions extends StatelessWidget {
const SizedBox(width: 2),
],
if (compact)
+ // The row of icons, as a menu: each action keeps the icon it had in the row.
_CompactPaneActions(
items: [
- (label: 'Zoom Pane', callback: onZoom),
+ if (onShare != null)
+ (
+ label: 'Share harness',
+ icon: Icons.person_add_alt_1_outlined,
+ callback: onShare,
+ ),
if (onToggleViewer != null)
(
label: viewerVisible ? 'Hide viewer' : 'Show viewer',
+ icon: LucideIcons.sparkles,
callback: onToggleViewer,
),
if (onToggleComposer != null)
@@ -128,20 +138,31 @@ class PaneHeaderActions extends StatelessWidget {
label: composerVisible
? 'Hide message composer'
: 'Show message composer',
+ icon: LucideIcons.keyboard,
callback: onToggleComposer,
),
- if (onShare != null)
- (label: 'Share harness', callback: onShare),
+ (
+ label: 'Zoom Pane',
+ icon: zoomed ? LucideIcons.minimize : LucideIcons.maximize,
+ callback: onZoom,
+ ),
(
label: terminal ? 'Restart Terminal' : 'Restart Harness',
+ icon: LucideIcons.refreshCw,
callback: onRestart,
),
- if (onFork != null) (label: 'Fork Harness', callback: onFork),
- (label: 'Close Pane', callback: onClose),
+ if (onFork != null)
+ (
+ label: 'Fork Harness',
+ icon: LucideIcons.gitFork,
+ callback: onFork,
+ ),
(
label: terminal ? 'Stop Terminal' : 'Stop Harness',
+ icon: Icons.stop_rounded,
callback: onDelete,
),
+ (label: 'Close Pane', icon: LucideIcons.x, callback: onClose),
],
)
else ...[
@@ -223,12 +244,15 @@ class PaneHeaderActions extends StatelessWidget {
],
);
if (modelPicker == null) return actionArea;
+ // The model, then the ⋮ menu on the header's right edge. Both keep one place in every pane:
+ // the folder, branch and PR that used to sit between them, and push the picker around with
+ // their length, now live under the pane's name.
return Row(
mainAxisSize: MainAxisSize.min,
children: [
- modelPicker!,
- const SizedBox(width: 4),
- Flexible(child: actionArea),
+ Flexible(child: modelPicker!),
+ const SizedBox(width: 2),
+ actionArea,
],
);
}
@@ -238,93 +262,86 @@ class PaneHeaderActions extends StatelessWidget {
/// room for its title. Native titlebar actions dismiss this menu too.
class _CompactPaneActions extends StatefulWidget {
const _CompactPaneActions({required this.items});
- final List<({String label, VoidCallback? callback})> items;
+ final List<({String label, IconData icon, VoidCallback? callback})> items;
@override
State<_CompactPaneActions> createState() => _CompactPaneActionsState();
}
class _CompactPaneActionsState extends State<_CompactPaneActions> {
- final _controller = MenuController();
- final _triggerFocus = FocusNode(debugLabel: 'Pane actions');
- final _firstFocus = FocusNode(debugLabel: 'First pane action');
- VoidCallback? _unregister;
-
- @override
- void dispose() {
- _unregister?.call();
- _triggerFocus.dispose();
- _firstFocus.dispose();
- super.dispose();
- }
+ bool _open = false;
- @override
- Widget build(BuildContext context) {
+ /// The pane menu, the same surface as the model picker beside it: its box, its rows and its
+ /// hover. Each row keeps the icon the action had when it was a row of icons.
+ Future<void> _show() async {
+ if (_open) return;
+ final box = context.findRenderObject() as RenderBox?;
+ final overlay =
+ Overlay.of(context).context.findRenderObject() as RenderBox?;
+ if (box == null || overlay == null) return;
final enabled = widget.items
.where((item) => item.callback != null)
.toList();
- return MenuAnchor(
- controller: _controller,
- childFocusNode: _triggerFocus,
- onOpen: () {
- _unregister = registerTransientMenu(_controller.close);
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (mounted && _controller.isOpen) _firstFocus.requestFocus();
- });
- },
- onClose: () {
- _unregister?.call();
- _unregister = null;
- },
- style: grid.AppMenu.style(maxHeight: double.infinity).copyWith(
- shape: WidgetStatePropertyAll(
- RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(3),
- side: BorderSide(color: AppColors.border),
- ),
- ),
- padding: const WidgetStatePropertyAll(EdgeInsets.all(4)),
+ if (enabled.isEmpty) return;
+ final origin = box.localToGlobal(Offset.zero, ancestor: overlay);
+ setState(() => _open = true);
+ final chosen = await showPaneMenu<VoidCallback>(
+ context: context,
+ position: RelativeRect.fromLTRB(
+ origin.dx,
+ origin.dy + box.size.height + 6,
+ overlay.size.width - origin.dx - box.size.width,
+ 0,
),
- menuChildren: [
- for (var i = 0; i < enabled.length; i++)
- KeymapRegion(
- contextKind: KeymapContext.picker,
- child: MenuItemButton(
- focusNode: i == 0 ? _firstFocus : null,
- onPressed: enabled[i].callback,
- style: ButtonStyle(
- textStyle: WidgetStatePropertyAll(grid.AppType.body()),
- foregroundColor: WidgetStatePropertyAll(AppColors.text),
- minimumSize: const WidgetStatePropertyAll(Size(180, 30)),
- shape: const WidgetStatePropertyAll(RoundedRectangleBorder()),
+ minWidth: 200,
+ maxWidth: 340,
+ children: (close) => [
+ for (final item in enabled)
+ paneMenuItem(
+ onTap: () => close(item.callback),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: kPaneMenuRowPadding,
+ vertical: 7,
+ ),
+ child: Row(
+ children: [
+ Icon(item.icon, size: 15, color: AppColors.mutedStrong),
+ const SizedBox(width: 10),
+ // Flexible: a large text setting shortens the label rather than overflowing.
+ Flexible(
+ child: Text(
+ item.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: grid.AppType.body(color: AppColors.text),
+ ),
+ ),
+ ],
),
- child: Text(enabled[i].label),
),
),
],
- builder: (context, controller, _) => IconButton(
- focusNode: _triggerFocus,
- tooltip: 'Pane actions',
- onPressed: enabled.isEmpty
- ? null
- : () {
- if (controller.isOpen) {
- controller.close();
- } else {
- controller.open();
- }
- },
- icon: const Icon(Icons.more_horiz, size: 16),
- style: IconButton.styleFrom(
- foregroundColor: AppColors.mutedStrong,
- fixedSize: const Size(28, 28),
- minimumSize: const Size(28, 28),
- padding: EdgeInsets.zero,
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- ),
);
+ if (mounted) setState(() => _open = false);
+ chosen?.call();
}
+
+ @override
+ Widget build(BuildContext context) => IconButton(
+ tooltip: 'Pane actions',
+ onPressed: widget.items.any((item) => item.callback != null)
+ ? () => unawaited(_show())
+ : null,
+ icon: const Icon(Icons.more_vert, size: 16),
+ style: IconButton.styleFrom(
+ foregroundColor: _open ? AppColors.text : AppColors.mutedStrong,
+ fixedSize: const Size(28, 28),
+ minimumSize: const Size(28, 28),
+ padding: EdgeInsets.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ ),
+ );
}
/// Only header controls depend on this hover state, so the terminal and title
diff --git a/desktop/lib/widgets/pull_request_badge.dart b/desktop/lib/widgets/pull_request_badge.dart
index 49ec31645..4a448919b 100644
--- a/desktop/lib/widgets/pull_request_badge.dart
+++ b/desktop/lib/widgets/pull_request_badge.dart
@@ -88,10 +88,15 @@ class _PullRequestBadgeState extends State<PullRequestBadge> {
return Tooltip(
message: 'PR #$number · $state — Open on GitHub',
child: TextButton(
+ // The small folder line's height and type: it sits under the pane's name, beside the
+ // folder and branch.
style: TextButton.styleFrom(
- minimumSize: const Size(0, 28),
- padding: const EdgeInsets.symmetric(horizontal: 6),
- textStyle: grid.AppType.monoLabel(),
+ minimumSize: Size.zero,
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ visualDensity: VisualDensity.compact,
+ // Room for descenders, as on the folder line beside it.
+ textStyle: grid.AppType.monoLabel(height: 1.3).copyWith(fontSize: 10),
),
onPressed: found
? () async {
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index b958f6268..b27c81a41 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -1981,7 +1981,8 @@ class _TerminalHeader extends StatelessWidget {
// Reserve space for the visible model name and the pane controls.
// Engines without a picker keep their existing header width.
final showModelPicker = !readOnly && modelPickerSupports(session.engineId);
- final pickerWidth = showModelPicker ? 170.0 : 0.0;
+ // The picker's name runs to 200px with its padding, and no arrow beside it.
+ final pickerWidth = showModelPicker ? 212.0 : 0.0;
final actionsWidth =
(remoteComposer == null ? 148.0 : 178.0) +
pickerWidth +
@@ -1992,7 +1993,9 @@ class _TerminalHeader extends StatelessWidget {
final forkedFrom = agent?.forkedFrom;
final strip = PaneHeaderHover(
child: SizedBox(
- height: compact ? 38 : 46,
+ // The usual height at the default text size; a larger text setting grows it so the name
+ // and the folder line under it both still fit.
+ height: (compact ? 38 : 46) * math.max(1, grid.appTextScaleOf(context)),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: _stripPadding),
child: LayoutBuilder(
@@ -2005,16 +2008,11 @@ class _TerminalHeader extends StatelessWidget {
agent != null &&
project?.shownBranch != null &&
constraints.maxWidth >= 360 * math.max(1, scale);
- final badgeWidth = showPr ? (narrow ? 150.0 : 180.0) : 0.0;
- final rightWidth = narrow
- ? math.max(
- (showModelPicker ? 100.0 : 28.0) + badgeWidth,
- constraints.maxWidth * .36,
- )
- : math.max(
- actionsWidth + badgeWidth,
- constraints.maxWidth * .55,
- );
+ // The right side holds only the ⋮ menu and the model: folder, branch and PR sit
+ // under the name.
+ final rightWidth = showModelPicker
+ ? (narrow ? 100.0 : pickerWidth + 36)
+ : 28.0;
return Row(
children: [
if (agent != null)
@@ -2026,114 +2024,199 @@ class _TerminalHeader extends StatelessWidget {
// engine it runs on is the dialog's and the tooltip's to say.
const SizedBox(width: 10),
Expanded(
- child: Row(
+ // The name, and under it where it works (folder, branch, PR): two short
+ // lines about as tall as the mark beside them. They used to share the
+ // controls' space on the right and fade on hover.
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Flexible(
- child: Tooltip(
- message: identityDetail,
- waitDuration: const Duration(milliseconds: 700),
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onDoubleTap: () => unawaited(
- showAgentRenameDialog(
- context,
- notifier,
- session.machineId,
- session.agentId,
- session.agentName,
- ),
- ),
- child: Text(
- session.agentName,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: grid.AppType.monoLabel(
- color: AppColors.text,
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- ),
- ),
- if (status != null || !compact)
- const SizedBox(width: 8),
- if (status != null && narrow)
- Tooltip(
- message: '${status.label}: ${status.detail}',
- child: IconButton(
- tooltip: status.actionLabel ?? status.label,
- onPressed: statusAction,
- icon: Icon(status.icon, size: 14),
- style: IconButton.styleFrom(
- foregroundColor: color,
- disabledForegroundColor: color,
- fixedSize: const Size(28, 28),
- minimumSize: const Size(28, 28),
- padding: EdgeInsets.zero,
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- ),
- )
- else if (status != null)
- ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: math.max(
- 0,
- math.min(
- constraints.maxWidth * .22,
- constraints.maxWidth - actionsWidth - 110,
+ // A fixed name line: a status chip appearing beside the name must not
+ // nudge the folder line under it.
+ SizedBox(
+ height: 14 * math.max(1, scale),
+ child: Row(
+ children: [
+ Flexible(
+ child: Tooltip(
+ message: identityDetail,
+ waitDuration: const Duration(
+ milliseconds: 700,
+ ),
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onDoubleTap: () => unawaited(
+ showAgentRenameDialog(
+ context,
+ notifier,
+ session.machineId,
+ session.agentId,
+ session.agentName,
+ ),
+ ),
+ child: Text(
+ session.agentName,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: grid.AppType.monoLabel(
+ color: AppColors.text,
+ fontWeight: FontWeight.w600,
+ height: 1.2,
+ ).copyWith(fontSize: 11),
+ ),
+ ),
),
),
- ),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Tooltip(
- message: status.detail,
- child: TextButton(
- onPressed: statusAction,
- style: TextButton.styleFrom(
- foregroundColor: color,
- disabledForegroundColor: AppColors.textSoft,
- minimumSize: Size.zero,
- tapTargetSize:
- MaterialTapTargetSize.shrinkWrap,
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
- vertical: 4,
+ if (status != null || !compact)
+ const SizedBox(width: 8),
+ if (status != null && narrow)
+ Tooltip(
+ message: '${status.label}: ${status.detail}',
+ child: IconButton(
+ tooltip: status.actionLabel ?? status.label,
+ onPressed: statusAction,
+ icon: Icon(status.icon, size: 12),
+ style: IconButton.styleFrom(
+ foregroundColor: color,
+ disabledForegroundColor: color,
+ // The name's line height: the folder line sits under it.
+ fixedSize: const Size(16, 16),
+ minimumSize: const Size(16, 16),
+ padding: EdgeInsets.zero,
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap,
+ ),
+ ),
+ )
+ else if (status != null)
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: math.max(
+ 0,
+ math.min(
+ constraints.maxWidth * .22,
+ constraints.maxWidth -
+ actionsWidth -
+ 110,
+ ),
),
),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(status.icon, size: 14),
- const SizedBox(width: 6),
- Flexible(
- child: Text(
- // The chip names the STATE; what
- // pressing it does is in the tooltip
- // and in `actionLabel`. "Link
- // required" that can be pressed reads
- // better than a bare verb where every
- // neighbour is a status.
- status.label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: grid.AppType.monoLabel(
- fontWeight: FontWeight.w400,
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Tooltip(
+ message: status.detail,
+ child: TextButton(
+ onPressed: statusAction,
+ style: TextButton.styleFrom(
+ foregroundColor: color,
+ disabledForegroundColor:
+ AppColors.textSoft,
+ minimumSize: Size.zero,
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap,
+ // The name's line height: the folder line sits under it.
+ padding: const EdgeInsets.symmetric(
+ horizontal: 6,
),
),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(status.icon, size: 12),
+ const SizedBox(width: 6),
+ Flexible(
+ child: Text(
+ // The chip names the STATE; what
+ // pressing it does is in the tooltip
+ // and in `actionLabel`. "Link
+ // required" that can be pressed reads
+ // better than a bare verb where every
+ // neighbour is a status.
+ status.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: grid.AppType.monoLabel(
+ fontWeight: FontWeight.w400,
+ height: 1,
+ ).copyWith(fontSize: 11),
+ ),
+ ),
+ ],
+ ),
),
- ],
+ ),
+ ),
+ )
+ else if (!compact)
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 4,
+ ),
+ child: Icon(
+ Icons.circle,
+ size: 8,
+ color: color,
+ ),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 1),
+ Row(
+ children: [
+ Flexible(
+ child: Tooltip(
+ message: [
+ if (forkedFrom != null)
+ 'Forked from ${forkedFrom.name}',
+ if (project != null) project.cwd,
+ ?project?.branchDetail,
+ machineName,
+ ].join('\n'),
+ child: PromptContextView(
+ // Small, so the two lines stay about the mark's height. The
+ // line height leaves room for descenders: at 1.0 the tails of
+ // g, p and y were cut off.
+ textStyle: grid.AppType.monoLabel(
+ color: AppColors.textSoft,
+ height: 1.3,
+ ).copyWith(fontSize: 10),
+ contextData: PromptContext(
+ // This computer goes without saying.
+ machine: machine?.isLocalMachine == true
+ ? null
+ : machineName,
+ // The folder as it was chosen and its repository's branch;
+ // the full working folder is in the tooltip.
+ project: project?.label,
+ // Not a branch Harness made up that waits for the
+ // session's name, nor a commit an agent checked out.
+ branch: project?.shownBranch,
+ leading: forkedFrom != null
+ ? 'forked from ${forkedFrom.name}'
+ : null,
),
),
),
),
- )
- else if (!compact)
- Padding(
- padding: const EdgeInsets.all(4),
- child: Icon(Icons.circle, size: 8, color: color),
- ),
+ if (showPr) ...[
+ const SizedBox(width: 6),
+ PullRequestBadge(
+ compact: narrow,
+ identity: (
+ session.machineId,
+ agent.id,
+ project?.cwd,
+ project?.shownBranch,
+ ),
+ read: () => notifier.readAgentPullRequest(
+ session.machineId,
+ agent.id,
+ ),
+ ),
+ ],
+ ],
+ ),
],
),
),
@@ -2153,25 +2236,8 @@ class _TerminalHeader extends StatelessWidget {
ConstrainedBox(
constraints: BoxConstraints(maxWidth: rightWidth),
child: PaneHeaderActions(
- trailing: showPr
- ? ConstrainedBox(
- constraints: BoxConstraints(maxWidth: badgeWidth),
- child: PullRequestBadge(
- compact: narrow,
- identity: (
- session.machineId,
- agent.id,
- project?.cwd,
- project?.shownBranch,
- ),
- read: () => notifier.readAgentPullRequest(
- session.machineId,
- agent.id,
- ),
- ),
- )
- : null,
- compact: narrow,
+ // One ⋮ menu for the pane's actions at every width, not a row of icons.
+ compact: true,
// Keep the current model visible, including while the
// terminal reconnects, without shifting the other controls.
modelPicker: showModelPicker
@@ -2245,32 +2311,6 @@ class _TerminalHeader extends StatelessWidget {
viewerColor: agent == null
? null
: agentIdentity(agent).color,
- details: Tooltip(
- message: [
- if (forkedFrom != null)
- 'Forked from ${forkedFrom.name}',
- if (project != null) project.cwd,
- ?project?.branchDetail,
- machineName,
- ].join('\n'),
- child: PromptContextView(
- contextData: PromptContext(
- // This computer goes without saying.
- machine: machine?.isLocalMachine == true
- ? null
- : machineName,
- // The folder as it was chosen and its repository's branch;
- // the full working folder is in the tooltip.
- project: narrow ? null : project?.label,
- // Not a branch Harness made up that waits for the
- // session's name, nor a commit an agent checked out.
- branch: narrow ? null : project?.shownBranch,
- leading: !narrow && forkedFrom != null
- ? 'forked from ${forkedFrom.name}'
- : null,
- ),
- ),
- ),
),
),
],
diff --git a/desktop/test/terminal_panel_header_test.dart b/desktop/test/terminal_panel_header_test.dart
index f62e7b454..c7651daac 100644
--- a/desktop/test/terminal_panel_header_test.dart
+++ b/desktop/test/terminal_panel_header_test.dart
@@ -9,6 +9,7 @@ import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/terminal/terminal_session.dart';
import 'package:harness/theme/app_theme.dart';
+import 'package:harness/widgets/grid_model_picker.dart';
import 'package:harness/widgets/terminal_panel.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
@@ -122,6 +123,30 @@ void main() {
});
}
+ // The model picker is always shown, right before the ⋮ menu on the header's right edge. It used
+ // to sit left of the details/controls stack, whose width follows the branch and the PR badge, so
+ // it drifted from pane to pane.
+ testWidgets(
+ 'the model picker sits before the ⋮ menu and a PR badge does not move it',
+ (tester) async {
+ final session = sessionNamed('Desktop');
+ addTearDown(session.dispose);
+ await pump(tester, session);
+ final picker = find.byType(GridModelPicker);
+ final plain = tester.getRect(picker);
+ final menu = tester.getRect(find.byTooltip('Pane actions'));
+ expect(plain.right, lessThanOrEqualTo(menu.left));
+ expect(menu.left - plain.right, lessThan(8));
+
+ await tester.pumpWidget(const SizedBox());
+ await pump(tester, session, withPr: true);
+ expect(tester.getRect(picker), plain);
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ await tester.pump(const Duration(seconds: 1));
+ },
+ );
+
// Each shape describes the path topology, not an assumed speed: direct link, intermediate hop,
// backend server. Tooltip and semantics use the protocol names people will diagnose with.
testWidgets(
@@ -145,7 +170,8 @@ void main() {
find.widgetWithText(TextButton, label),
);
expect(statusRect.left, greaterThan(nameRect.right));
- expect(statusRect.right, lessThan(projectRect.left));
+ // The project line sits under the name, so the status never reaches it.
+ expect(projectRect.top, greaterThan(nameRect.bottom - 1));
expect(tester.getRect(project), projectRect);
expect(tester.takeException(), isNull);
}
diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dart
index cfa58509d..f48983af1 100644
--- a/desktop/test/terminal_panel_presentation_test.dart
+++ b/desktop/test/terminal_panel_presentation_test.dart
@@ -50,17 +50,19 @@ void main() {
await tester.pump();
revision.value = 1;
await tester.pump();
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(
- location: tester.getCenter(find.text(session.agentName)),
- );
- await tester.pump(const Duration(milliseconds: 120));
- await tester.tap(find.byTooltip('Show message composer'));
- await tester.tap(find.byTooltip('Zoom Pane'));
- await tester.tap(find.byTooltip('Restart Harness'));
- await tester.tap(find.byTooltip('Stop Harness'));
- await tester.tap(find.byTooltip('Close Pane'));
- await tester.pump();
+ // Every pane action is one ⋮ menu away.
+ for (final label in [
+ 'Show message composer',
+ 'Zoom Pane',
+ 'Restart Harness',
+ 'Stop Harness',
+ 'Close Pane',
+ ]) {
+ await tester.tap(find.byTooltip('Pane actions'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text(label));
+ await tester.pumpAndSettle();
+ }
expect(closed, [1]);
expect(deleted, [1]);
expect(restarted, [1]);
@@ -174,7 +176,7 @@ void main() {
);
revision.value = 2;
await tester.pump();
- expect(find.byTooltip('Zoom Pane'), findsOneWidget);
+ expect(find.byTooltip('Pane actions'), findsOneWidget);
session.status = TerminalSessionStatus.takenOver;
revision.value = 3;
await tester.pump();
@@ -198,7 +200,6 @@ void main() {
tester.widget<Text>(find.text('Renamed terminal')).style!.fontFamily,
'Monaco',
);
- await mouse.removePointer();
await tester.pumpWidget(const SizedBox());
revision.dispose();
session.dispose();
@@ -207,7 +208,7 @@ void main() {
);
for (final local in [true, false]) {
testWidgets(
- '${local ? 'local' : 'remote'} header swaps details for actions without moving its title',
+ '${local ? 'local' : 'remote'} header keeps details under the name and shows actions on hover',
(tester) async {
final app = createApp();
app.stateOf('m')!.localOnly = local;
@@ -245,26 +246,25 @@ void main() {
);
await tester.pump();
final title = find.text('Onboarding');
- final details = find.byKey(const ValueKey('pane-header-details'));
final controls = find.byType(PaneHeaderActions);
final terminalWidget = tester.widget<TerminalView>(
find.byType(TerminalView),
);
final titleBounds = tester.getRect(title);
- expect(tester.widget<AnimatedOpacity>(details).opacity, 1);
expect(find.text('harness'), findsOneWidget);
expect(find.text('main'), findsOneWidget);
+ // Folder, branch and machine sit on the line under the name.
if (local) {
// This computer goes without saying.
expect(find.text('Test host'), findsNothing);
expect(
- tester.getRect(find.text('harness')).left,
- greaterThan(titleBounds.right),
+ tester.getRect(find.text('harness')).top,
+ greaterThan(titleBounds.bottom - 1),
);
} else {
expect(
- tester.getRect(find.text('Test host')).left,
- greaterThan(titleBounds.right),
+ tester.getRect(find.text('Test host')).top,
+ greaterThan(titleBounds.bottom - 1),
);
expect(
tester.getRect(find.text('harness')).left,
@@ -275,31 +275,26 @@ void main() {
tester.getRect(find.text('main')).left,
greaterThan(tester.getRect(find.text('harness')).right),
);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsNothing);
+ // One ⋮ menu, always in view, instead of a row of icons that appeared on hover.
expect(
find.descendant(of: controls, matching: find.byType(IconButton)),
- findsNWidgets(local ? 5 : 6),
+ findsOneWidget,
);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: tester.getCenter(title));
- await tester.pump(const Duration(milliseconds: 120));
- expect(tester.widget<AnimatedOpacity>(details).opacity, 0);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsOneWidget);
- expect(find.byTooltip('Share harness').hitTestable(), findsOneWidget);
+ expect(find.byTooltip('Pane actions').hitTestable(), findsOneWidget);
+ await tester.tap(find.byTooltip('Pane actions'));
+ await tester.pumpAndSettle();
+ expect(find.text('Stop Harness'), findsOneWidget);
+ expect(find.text('Share harness'), findsOneWidget);
+ // The details stay in view, and neither the title nor the terminal moves.
+ expect(find.text('main').hitTestable(), findsOneWidget);
expect(tester.getRect(title), titleBounds);
expect(
tester.widget<TerminalView>(find.byType(TerminalView)),
same(terminalWidget),
);
- await mouse.moveTo(const Offset(300, 200));
- await tester.pump(const Duration(milliseconds: 120));
- expect(tester.widget<AnimatedOpacity>(details).opacity, 1);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsNothing);
- // Keyboard users can reveal and reach the same actions without a mouse.
- Focus.of(tester.element(find.byTooltip('Stop Harness'))).nextFocus();
- await tester.pump(const Duration(milliseconds: 120));
- expect(find.byTooltip('Stop Harness').hitTestable(), findsOneWidget);
- await mouse.removePointer();
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ expect(find.text('Stop Harness'), findsNothing);
await tester.pumpWidget(const SizedBox());
session.dispose();
app.dispose();
@@ -359,38 +354,30 @@ void main() {
expect(tester.getSize(title).width, greaterThan(64));
expect(tester.takeException(), isNull);
final titleBefore = tester.getRect(title);
- final button = tester.widget<IconButton>(
- find.widgetWithIcon(IconButton, Icons.more_horiz),
- );
- button.focusNode!.requestFocus();
- await tester.pump(const Duration(milliseconds: 120));
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ final menu = find.widgetWithIcon(IconButton, Icons.more_vert);
+ await tester.tap(menu);
await tester.pumpAndSettle();
expect(find.text('Zoom Pane'), findsOneWidget);
expect(find.text('Show viewer'), findsOneWidget);
expect(find.text('Fork Harness'), findsOneWidget);
expect(find.text('Stop Harness'), findsOneWidget);
expect(tester.getRect(title), titleBefore);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.tap(find.text('Zoom Pane'));
await tester.pumpAndSettle();
expect(zooms, [240.0, 280.0, 420.0].indexOf(width) + 1);
expect(find.text('Zoom Pane'), findsNothing);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.tap(menu);
await tester.pumpAndSettle();
- for (var i = 0; i < 5; i++) {
- await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
- await tester.pump();
- }
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.tap(find.text('Fork Harness'));
await tester.pumpAndSettle();
expect(forks, zooms);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ // Escape and a click elsewhere both close it without choosing anything.
+ await tester.tap(menu);
await tester.pumpAndSettle();
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
expect(find.text('Zoom Pane'), findsNothing);
- expect(button.focusNode!.hasFocus, isTrue);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.tap(menu);
await tester.pumpAndSettle();
dismissTransientMenus();
await tester.pumpAndSettle();