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.

Web: an account menu behind the avatar and a small + menu replace the left menu (Huy) (#2515)

0xken15ff39f43a51fa
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 726e1cf92..cb5ec7e5b 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -1016,6 +1016,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
_unregisterModels?.call();
_modelsOverlay?.remove();
_modelsOverlay?.dispose();
+ // Cleared, or the open titlebar dropdown below removes it a second time.
+ _modelsOverlay = null;
_onboarding.removeListener(_onboardingChanged);
if (widget.onboarding == null) _onboarding.dispose();
app.modelManager.removeListener(_modelManagerChanged);
@@ -1066,6 +1068,9 @@ class _SwarmScreenState extends State<SwarmScreen> {
unawaited(_deviceWindowRequests?.cancel());
_deviceRevealCooldown?.cancel();
app.systemNotifications.onTap = null;
+ // It sits in the page's overlay, above this screen: name and email must not
+ // outlive the session that drew them.
+ _titlebarDropdown?.$2();
if (_menuHost) {
unawaited(_menuBus.send('machinesState', {'machines': []}));
app.removeListener(_syncNative);
@@ -2483,7 +2488,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
Future<void> _actOnNative(MethodCall call) async {
if (mounted && call.method == 'keymapCommand') {
final command = (call.arguments as Map?)?['command'];
- if (command is String && dispatchSwarmQuickSwitcherCommand(command)) return;
+ if (command is String && dispatchSwarmQuickSwitcherCommand(command))
+ return;
}
if (mounted && call.method == 'keymapPending') {
@@ -3375,9 +3381,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
// --- The tab row's last control: Sign in, or the account ----------------
// Like a browser's toolbar (owner, 2026-10-11): everything before it is an
// icon, and this is Sign in while this computer holds no account, and whose
- // account it is afterwards. A viewer build's bar is as it was: it has no
- // guest, and its own ways to its account.
- bool get _accountControlShown => app.viewer == null;
+ // account it is afterwards. A viewer build has no guest; its host says
+ // whether it wears the avatar.
+ bool get _accountControlShown =>
+ app.viewer == null || widget.chrome?.showsAccount == true;
/// What the native tab row draws for it. Absent, it draws nothing.
Map<String, Object?>? get _accountPayload => !_accountControlShown
@@ -3400,10 +3407,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
/// The control and the gap before it, for a row this app draws.
- List<Widget> _accountControl() => !_accountControlShown
+ List<Widget> _accountControl({bool compact = false}) => !_accountControlShown
? const []
: [
- const SizedBox(width: DesktopChrome.controlGap),
+ if (!compact) const SizedBox(width: DesktopChrome.controlGap),
if (app.isGuest)
WorkspaceSignInButton(
key: const ValueKey('swarm-sign-in-button'),
@@ -3412,13 +3419,16 @@ class _SwarmScreenState extends State<SwarmScreen> {
else
KeyedSubtree(
key: _accountButtonKey,
- child: WorkspaceAvatarButton(
- key: const ValueKey('swarm-account-button'),
- initial: _accountInitial,
- tooltip: _accountTooltip,
- onPressed: _shortcutsEnabled
- ? () => unawaited(_showAccountMenu())
- : null,
+ child: fingerTarget(
+ enabled: compact,
+ WorkspaceAvatarButton(
+ key: const ValueKey('swarm-account-button'),
+ initial: _accountInitial,
+ tooltip: _accountTooltip,
+ onPressed: _shortcutsEnabled
+ ? () => unawaited(_showAccountMenu())
+ : null,
+ ),
),
),
];
@@ -3445,6 +3455,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
name: user?.name ?? '',
email: user?.email ?? '',
topInset: _native ? 0 : _tabBarHeight,
+ // Pairing a phone is for a computer; a phone is already here.
+ forPhone: _compact(context),
onOpen: onOpen,
ownsPointer: (position) => _owns(_accountButtonKey, position),
),
@@ -6428,7 +6440,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
additionalDestinations: [
if (superTabTarget != null)
for (final agent
- in app.superTabs.peek(superTabTarget.tabId)?.snapshot?.teamAgents ??
+ in app.superTabs
+ .peek(superTabTarget.tabId)
+ ?.snapshot
+ ?.teamAgents ??
[])
SwarmDestination(
id: agentDestinationId(agent.machineId, agent.harnessId),
@@ -9061,15 +9076,13 @@ class _SwarmScreenState extends State<SwarmScreen> {
(showAddPhone ? addPhoneWidth : 0) +
(showDevices ? devicesWidth : 0) +
accountWidth;
- final leadingWidth = chrome?.leadingWidth(context) ?? 0.0;
final tabBudget = math.max(
0.0,
constraints.maxWidth -
cell.width * 5 -
grid.AppDesktop.tabBarTrailingInset -
actionsWidth -
- (_slotShown ? 44 : 0) -
- leadingWidth,
+ (_slotShown ? 44 : 0),
);
_tabWidths = List.filled(
labels.length,
@@ -9095,11 +9108,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
child: Row(
children: [
SizedBox(width: cell.width),
- if (chrome != null)
- SizedBox(
- width: leadingWidth,
- child: chrome.leading(context, _workspaceCommands),
- ),
_withTabArrows(
arrows,
color: theme.foreground,
@@ -9269,15 +9277,16 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
),
),
- _statusToolIcon(
- 'new-tab',
- 'New Tab',
- _newTab,
- AppIcons.plus,
- Size(cell.width * 3, toolHeight),
- theme,
- tooltip: _commandTooltip('New Tab', 'swarm.new'),
- ),
+ chrome?.newTabControl?.call(context, _workspaceCommands) ??
+ _statusToolIcon(
+ 'new-tab',
+ 'New Tab',
+ _newTab,
+ AppIcons.plus,
+ Size(cell.width * 3, toolHeight),
+ theme,
+ tooltip: _commandTooltip('New Tab', 'swarm.new'),
+ ),
if (_tabActivityOffered)
ListenableBuilder(
listenable: _tabActivity,
@@ -9420,44 +9429,38 @@ class _SwarmScreenState extends State<SwarmScreen> {
);
/// A compact host uses a tab switcher instead of the tab list.
- Widget _compactTabStrip(
- WorkspaceChrome chrome,
- TerminalTheme theme,
- ) => Builder(
- builder: (context) {
- final cell = workspaceBarCellSizeOf(context);
- return Material(
- key: const ValueKey('workspace-tab-bar'),
- color: grid.AppPalette.swarmTabBar,
- // A phone's bar: every control a finger's size, its icon as it
- // was, so the bar is at least that tall too.
- child: SizedBox(
- height: math.max(
- kFingerTarget,
- math.max(_tabBarHeight, cell.height * 2),
- ),
- child: Row(
- children: [
- SizedBox(width: cell.width),
- SizedBox(
- width: math.max(chrome.leadingWidth(context), kFingerTarget),
- child: fingerTarget(
- enabled: true,
- chrome.leading(context, _workspaceCommands),
- ),
+ Widget _compactTabStrip(WorkspaceChrome chrome, TerminalTheme theme) =>
+ Builder(
+ builder: (context) {
+ final cell = workspaceBarCellSizeOf(context);
+ return Material(
+ key: const ValueKey('workspace-tab-bar'),
+ color: grid.AppPalette.swarmTabBar,
+ // A phone's bar: every control a finger's size, its icon as it
+ // was, so the bar is at least that tall too.
+ child: SizedBox(
+ height: math.max(
+ kFingerTarget,
+ math.max(_tabBarHeight, cell.height * 2),
),
- Expanded(child: chrome.compactTabs!(context, _workspaceCommands)),
- fingerTarget(enabled: true, _searchButton(theme)),
- fingerTarget(enabled: true, _notificationsButton(theme)),
- if (kIsWeb && _slotShown)
- fingerTarget(enabled: true, _daemonTabButton()),
- SizedBox(width: cell.width),
- ],
- ),
- ),
+ child: Row(
+ children: [
+ SizedBox(width: cell.width),
+ Expanded(
+ child: chrome.compactTabs!(context, _workspaceCommands),
+ ),
+ fingerTarget(enabled: true, _searchButton(theme)),
+ fingerTarget(enabled: true, _notificationsButton(theme)),
+ if (kIsWeb && _slotShown)
+ fingerTarget(enabled: true, _daemonTabButton()),
+ ..._accountControl(compact: true),
+ SizedBox(width: cell.width),
+ ],
+ ),
+ ),
+ );
+ },
);
- },
- );
Widget _statusToolIcon(
String id,
diff --git a/desktop/lib/state/workspace_chrome.dart b/desktop/lib/state/workspace_chrome.dart
index 427d2d35a..4eb64e226 100644
--- a/desktop/lib/state/workspace_chrome.dart
+++ b/desktop/lib/state/workspace_chrome.dart
@@ -50,13 +50,13 @@ class WorkspaceFooter {
}
/// What a host composition adds to the shared workspace. Desktop passes none;
-/// the web build (`lib/web/`) puts its mouse-first menu before the tabs, a bar
-/// over the picker, and names a machine for New Harness. [leadingWidth] is reserved before the tabs
-/// are measured.
+/// the web build (`lib/web/`) makes `+` a mouse-first menu, adds the account's
+/// avatar, a bar over the picker, and names a machine for
+/// New Harness.
class WorkspaceChrome {
const WorkspaceChrome({
- required this.leadingWidth,
- required this.leading,
+ this.newTabControl,
+ this.showsAccount = false,
this.newHarnessMachine,
this.pickerShowsBack = false,
this.showsKeyHints = true,
@@ -78,10 +78,7 @@ class WorkspaceChrome {
/// What a workspace with no host chrome (Desktop) reads: every switch at
/// today's behavior.
- static final _none = WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- );
+ static const _none = WorkspaceChrome();
/// The chrome the enclosing workspace was given, or the defaults when it
/// was given none. For widgets the workspace builds, its overlays included;
@@ -94,9 +91,14 @@ class WorkspaceChrome {
/// picker.
final Widget Function(BuildContext context)? firstMachine;
- final double Function(BuildContext context) leadingWidth;
- final Widget Function(BuildContext context, WorkspaceCommands commands)
- leading;
+ /// Replaces the wide bar's `+`, which otherwise opens a new tab. A compact
+ /// host's [compactTabs] draws its own.
+ final Widget Function(BuildContext context, WorkspaceCommands commands)?
+ newTabControl;
+
+ /// True puts the account's avatar on a viewer build's bar, as a local build
+ /// always has it.
+ final bool showsAccount;
/// Where New Harness starts when no machine is this computer — a browser
/// runs none. Null (or no answer) keeps sending the person to Machines.
diff --git a/desktop/lib/web/shell/web_app_menu.dart b/desktop/lib/web/shell/web_app_menu.dart
deleted file mode 100644
index 9cdc6d0fa..000000000
--- a/desktop/lib/web/shell/web_app_menu.dart
+++ /dev/null
@@ -1,137 +0,0 @@
-import 'package:harness/shared/theme/app_icons.dart';
-
-import 'dart:async';
-
-import 'package:flutter/material.dart';
-
-import '../../shared/theme/app_theme.dart' as grid;
-import '../../shared/theme/workspace_bar_style.dart';
-import '../../state/app_state.dart';
-import '../../state/workspace_chrome.dart';
-import '../../terminal/terminal_theme.dart';
-import '../../theme/app_theme.dart' show AppColors;
-import '../../terminal/terminal_theme_store.dart';
-import '../../widgets/finger_target.dart';
-import '../../widgets/pane_menu.dart';
-import '../../widgets/workspace_bar_control.dart';
-import 'web_layout.dart';
-import 'web_menu_items.dart';
-
-/// The browser has no native menu bar, so everything desktop keeps there is
-/// one click away here. Rows run the same workspace commands keys do.
-class WebAppMenuButton extends StatelessWidget {
- const WebAppMenuButton({
- super.key,
- required this.app,
- required this.commands,
- });
-
- final AppNotifier app;
- final WorkspaceCommands commands;
-
- static double widthOf(BuildContext context) =>
- workspaceBarCellSizeOf(context).width * 4;
-
- @override
- Widget build(BuildContext context) {
- final theme = terminalThemeFor(
- grid.AppTheme.palette.value,
- terminalThemeStore.value,
- );
- final enabled = commands.enabled();
- return WorkspaceBarControl(
- key: const ValueKey('web-app-menu-button'),
- label: 'Menu',
- tooltip: 'Menu',
- onPressed: enabled ? () => _open(context) : null,
- builder: (context, emphasized) => SizedBox(
- width: widthOf(context),
- height: workspaceBarControlHeight(context),
- child: Icon(
- AppIcons.menu,
- size: 16,
- color: theme.foreground.withValues(
- alpha: !enabled
- ? .28
- : emphasized
- ? 1
- : .75,
- ),
- ),
- ),
- );
- }
-
- Future<void> _open(BuildContext context) async {
- final box = context.findRenderObject() as RenderBox?;
- final overlay =
- Overlay.of(context).context.findRenderObject() as RenderBox?;
- if (box == null || overlay == null) return;
- final origin = box.localToGlobal(Offset.zero, ancestor: overlay);
- // Resolved as it opens, so the rows match the workspace's state right now.
- final compact = isWebCompact(context);
- final groups = runnableWebMenu(commands.canRun, compact: compact);
- final chosen = await showPaneMenu<String>(
- context: context,
- // Opened by a click: no row is lit until the pointer picks one.
- focusFirst: false,
- position: RelativeRect.fromLTRB(
- origin.dx,
- origin.dy + box.size.height + 6,
- overlay.size.width - origin.dx - WebAppMenuButton.widthOf(context),
- 0,
- ),
- minWidth: 240,
- maxWidth: 320,
- children: (close) => _rows(groups, close, compact: compact),
- );
- // Run after the menu closed and handed focus back, never inside it.
- if (chosen == _signOut) {
- unawaited(app.logout());
- } else if (chosen != null) {
- commands.run(chosen);
- }
- }
-
- static const _signOut = 'web.sign_out';
-
- List<Widget> _rows(
- List<List<WebMenuItem>> groups,
- void Function(String?) close, {
- required bool compact,
- }) {
- // Uncoloured on purpose: the row's ink tints it, so it turns with the
- // label when the row lights up.
- Widget row(String id, String label, Widget icon) => paneMenuItem(
- onTap: () => close(id),
- // On a phone the row is a finger's height; a mouse keeps it as it was.
- child: fingerTarget(
- enabled: compact,
- PaneMenuRow(
- key: ValueKey('web-menu:$id'),
- selected: false,
- title: label,
- leading: IconTheme.merge(
- data: const IconThemeData(size: AppIcons.inlineSize),
- child: icon,
- ),
- ),
- ),
- );
- final rule = Divider(
- height: 9,
- thickness: 1,
- indent: 14,
- endIndent: 14,
- color: AppColors.border,
- );
- return [
- for (final group in groups) ...[
- for (final item in group) row(item.command, item.label, item.icon),
- rule,
- ],
- if (app.currentUser?.email case final email?) paneMenuEmpty(email),
- row(_signOut, 'Sign out', const Icon(AppIcons.logOut)),
- ];
- }
-}
diff --git a/desktop/lib/web/shell/web_chrome.dart b/desktop/lib/web/shell/web_chrome.dart
index 6b03ff06e..3639bb505 100644
--- a/desktop/lib/web/shell/web_chrome.dart
+++ b/desktop/lib/web/shell/web_chrome.dart
@@ -5,12 +5,12 @@ import '../onboarding/saved_computers.dart';
import '../onboarding/web_first_machine.dart';
import '../footer/web_footer_bar.dart';
import '../tabs/web_tab_switcher.dart';
-import 'web_app_menu.dart';
import 'web_layout.dart';
import 'web_machine_choice.dart';
+import 'web_new_menu.dart';
-/// Everything the browser adds to the shared workspace: a menu before the
-/// tabs, a tab switcher and a one-dropdown footer on narrow screens, a clickable Back in the picker
+/// Everything the browser adds to the shared workspace: a `+` that opens a small
+/// menu, the account's avatar, a tab switcher and a one-dropdown footer on narrow screens, a clickable Back in the picker
/// with its key hints hidden, and a connected machine for New Harness, since
/// a browser is not a machine. It also turns on a menu on every tab, worded
/// pane states and the compact pane header, which the web reads and Desktop
@@ -26,9 +26,9 @@ WorkspaceChrome webWorkspaceChrome(AppNotifier app) =>
final _webChromes = Expando<WorkspaceChrome>('webWorkspaceChrome');
WorkspaceChrome _webWorkspaceChrome(AppNotifier app) => WorkspaceChrome(
- leadingWidth: WebAppMenuButton.widthOf,
- leading: (context, commands) =>
- WebAppMenuButton(app: app, commands: commands),
+ newTabControl: (context, commands) =>
+ WebNewMenuButton(app: app, commands: commands),
+ showsAccount: true,
newHarnessMachine: () => webNewHarnessMachine(app),
pickerShowsBack: true,
showsKeyHints: false,
diff --git a/desktop/lib/web/shell/web_menu_items.dart b/desktop/lib/web/shell/web_menu_items.dart
index cb6b60601..24712fa1a 100644
--- a/desktop/lib/web/shell/web_menu_items.dart
+++ b/desktop/lib/web/shell/web_menu_items.dart
@@ -7,9 +7,9 @@ import '../../shared/theme/app_pane_icon.dart';
/// bar already shows, others make no sense on a phone.
enum WebMenuWidth { any, compact, wide }
-/// One entry of the web app menu: a workspace command id, its menu label and
-/// the glyph the desktop menu bar gives the same command. The command itself
-/// lives in the workspace's shared command table.
+/// One entry of the `+` menu: a workspace command id, its menu label and the
+/// glyph the desktop menu bar gives the same command. The command itself lives
+/// in the workspace's shared command table.
typedef WebMenuItem = ({
String command,
String label,
@@ -17,93 +17,115 @@ typedef WebMenuItem = ({
WebMenuWidth width,
});
-/// What the menu offers, in groups a thin rule separates. Only what has no
-/// other door in the browser chrome: new work is the `+` beside the tabs
-/// (a new tab opens on "Start an agent"), agents the search button, tabs the
-/// tab bar and switcher, attention the bell, closing a pane its own header;
-/// keyboard tours and grid layout stay out of a mouse-first menu. New Swarm is
-/// here because its only other door is a key (Alt+S), which a phone has not.
-/// Splitting is here because the header gave it up: a split is an edge to
-/// hover, which a finger cannot. Sharing is not — Share is an experimental button, off until
-/// its setting is switched on, and a row here would put it back for everyone.
-/// All commands still reaches every one.
+/// What the `+` beside the tabs offers, in groups a thin rule separates: new
+/// work and what opens it (Huy, 2026-11-02). Machines and Models are the
+/// footer's links, as on Desktop; who is signed in, Settings and Appearance are
+/// the avatar's. New Swarm is here because its only other door is a key
+/// (Alt+S), which a phone has not. Splitting is here because a split is an edge
+/// to hover, which a finger cannot.
const List<List<WebMenuItem>> kWebMenuGroups = [
[
(
- command: 'super_tab.new',
- label: 'New Swarm',
- icon: Icon(AppIcons.users),
+ command: 'swarm.new',
+ label: 'New tab',
+ icon: Icon(AppIcons.plus),
width: WebMenuWidth.any,
),
- ],
- [
(
- command: 'machines.list',
- label: 'Machines',
- icon: Icon(AppIcons.server),
- width: WebMenuWidth.any,
- ),
- (
- command: 'models.list',
- label: 'Models',
- icon: Icon(AppIcons.cpu),
+ command: 'super_tab.new',
+ label: 'New Swarm',
+ icon: Icon(AppIcons.users),
width: WebMenuWidth.any,
),
- // The wide bar has its own Store button; the phone bar gives it up.
- (
- command: 'app.store',
- label: 'Store',
- icon: Icon(AppIcons.store),
- width: WebMenuWidth.compact,
- ),
],
[
// One split, always to the right: a second "down" row only lengthens the
- // menu, and All commands still has Split down.
+ // menu, and `>` in search still has Split down.
(
command: 'pane.split_right',
label: 'Split pane',
icon: AppPaneIcon(AppPaneSymbol.splitRight, size: AppIcons.inlineSize),
width: WebMenuWidth.any,
),
- ],
- [
(
command: 'navigation.history',
label: 'History',
icon: Icon(AppIcons.history),
width: WebMenuWidth.any,
),
+ // The wide bar has its own Store button; the phone bar gives it up.
(
- command: 'navigation.commands',
- label: 'All commands',
- icon: Icon(AppIcons.command),
- width: WebMenuWidth.any,
- ),
- ],
- [
- (
- command: 'app.settings',
- label: 'Settings',
- icon: Icon(AppIcons.settings),
- width: WebMenuWidth.any,
- ),
- (
- command: 'app.customize',
- label: 'Appearance',
- icon: Icon(AppIcons.palette),
- width: WebMenuWidth.any,
- ),
- // Pairing a phone is for a computer; a phone is already here.
- (
- command: 'app.add_phone',
- label: 'Add phone',
- icon: Icon(AppIcons.smartphone),
- width: WebMenuWidth.wide,
+ command: 'app.store',
+ label: 'Store',
+ icon: Icon(AppIcons.store),
+ width: WebMenuWidth.compact,
),
],
];
+/// Behind the `+` menu's More: what a mouse-first page must keep clickable and
+/// a phone has no key for, now All commands is gone.
+const List<WebMenuItem> kWebMoreItems = [
+ (
+ command: 'pane.zoom',
+ label: 'Zoom pane',
+ icon: Icon(AppIcons.maximize),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'pane.move_left',
+ label: 'Move pane left',
+ icon: Icon(AppIcons.arrowLeft),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'pane.move_right',
+ label: 'Move pane right',
+ icon: Icon(AppIcons.arrowRight),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'pane.move_up',
+ label: 'Move pane up',
+ icon: Icon(AppIcons.arrowUp),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'pane.move_down',
+ label: 'Move pane down',
+ icon: Icon(AppIcons.arrowDown),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'pane.move_to_tab',
+ label: 'Move pane to another tab',
+ icon: Icon(AppIcons.arrowRightLeft),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'pane.layout',
+ label: 'Layouts',
+ icon: Icon(AppIcons.layoutGrid),
+ width: WebMenuWidth.any,
+ ),
+ (
+ command: 'swarm.reopen',
+ label: 'Reopen closed tab',
+ icon: Icon(AppIcons.rotateCcw),
+ width: WebMenuWidth.any,
+ ),
+];
+
+/// Commands that only change how several panes sit, so one pane has no use for
+/// them.
+const _needsTwoPanes = {
+ 'pane.zoom',
+ 'pane.move_left',
+ 'pane.move_right',
+ 'pane.move_up',
+ 'pane.move_down',
+};
+
/// The groups as they can be drawn right now: rows for the other layout, and
/// commands that cannot run in this workspace state, are left out, and a group
/// left empty goes with them.
@@ -123,3 +145,14 @@ List<List<WebMenuItem>> runnableWebMenu(
case final items when items.isNotEmpty)
items,
];
+
+/// More's rows as they can be drawn right now. Empty means no More row.
+List<WebMenuItem> runnableWebMore(
+ bool Function(String command) canRun, {
+ required int panes,
+}) => [
+ for (final item in kWebMoreItems)
+ if (canRun(item.command) &&
+ (panes > 1 || !_needsTwoPanes.contains(item.command)))
+ item,
+];
diff --git a/desktop/lib/web/shell/web_new_menu.dart b/desktop/lib/web/shell/web_new_menu.dart
new file mode 100644
index 000000000..7ac8d6060
--- /dev/null
+++ b/desktop/lib/web/shell/web_new_menu.dart
@@ -0,0 +1,196 @@
+import 'package:flutter/material.dart';
+
+import '../../shared/theme/app_icons.dart';
+import '../../shared/theme/app_theme.dart' as grid;
+import '../../shared/theme/workspace_bar_style.dart';
+import '../../state/app_state.dart';
+import '../../state/workspace_chrome.dart';
+import '../../terminal/terminal_theme.dart';
+import '../../terminal/terminal_theme_store.dart';
+import '../../theme/app_theme.dart' show AppColors;
+import '../../widgets/finger_target.dart';
+import '../../widgets/pane_menu.dart';
+import '../../widgets/workspace_bar_control.dart';
+import 'web_dropdown_control.dart';
+import 'web_layout.dart';
+import 'web_menu_items.dart';
+
+/// The `+` beside the tabs, as a small menu: the browser has no native menu
+/// bar, so new work, and what has no other door, is one click away here. Rows
+/// run the same workspace commands keys do.
+///
+/// Its menu sits in the page's overlay, above the workspace, so it closes with
+/// this button: sign-out or a lost session must not leave it over the next
+/// screen, nor run a row tapped as it went.
+class WebNewMenuButton extends StatefulWidget {
+ const WebNewMenuButton({
+ super.key,
+ required this.app,
+ required this.commands,
+ });
+
+ final AppNotifier app;
+ final WorkspaceCommands commands;
+
+ @override
+ State<WebNewMenuButton> createState() => _WebNewMenuButtonState();
+}
+
+class _WebNewMenuButtonState extends State<WebNewMenuButton> {
+ static const _more = 'web.more';
+
+ void Function()? _closeOpen;
+
+ @override
+ void dispose() {
+ _closeOpen?.call();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = terminalThemeFor(
+ grid.AppTheme.palette.value,
+ terminalThemeStore.value,
+ );
+ final enabled = widget.commands.enabled();
+ return WorkspaceBarControl(
+ key: const ValueKey('web-new-menu-button'),
+ label: 'New',
+ tooltip: 'New',
+ foreground: theme.foreground,
+ onPressed: enabled ? _toggle : null,
+ builder: (context, emphasized) => SizedBox(
+ width: workspaceBarCellSizeOf(context).width * 3,
+ height: workspaceBarControlHeight(context),
+ child: Center(
+ child: Icon(
+ AppIcons.plus,
+ size: AppIcons.inlineSize,
+ color: theme.foreground.withValues(
+ alpha: !enabled
+ ? .28
+ : emphasized
+ ? 1
+ : .75,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ /// A press with its menu open closes it, as the avatar's does.
+ Future<void> _toggle() async {
+ if (_closeOpen case final close?) {
+ close();
+ return;
+ }
+ final compact = isWebCompact(context);
+ // Resolved as it opens, so the rows match the workspace's state right now.
+ final canRun = widget.commands.canRun;
+ final more = runnableWebMore(canRun, panes: widget.app.panes.length);
+ final chosen = await _show(
+ compact: compact,
+ children: (close) => [
+ for (final (index, group) in runnableWebMenu(
+ canRun,
+ compact: compact,
+ ).indexed) ...[
+ if (index > 0) _rule(),
+ for (final item in group)
+ _row(item.command, item.label, item.icon, close, compact: compact),
+ ],
+ if (more.isNotEmpty) ...[
+ _rule(),
+ _row(
+ _more,
+ 'More',
+ const Icon(AppIcons.chevronRight),
+ close,
+ compact: compact,
+ ),
+ ],
+ ],
+ );
+ if (!mounted || chosen == null) return;
+ if (chosen != _more) {
+ // Run after the menu closed and handed focus back, never inside it.
+ widget.commands.run(chosen);
+ return;
+ }
+ final further = await _show(
+ compact: compact,
+ children: (close) => [
+ paneMenuHeader('More'),
+ for (final item in more)
+ _row(item.command, item.label, item.icon, close, compact: compact),
+ ],
+ );
+ if (mounted && further != null) widget.commands.run(further);
+ }
+
+ Future<String?> _show({
+ required bool compact,
+ required List<Widget> Function(void Function(String?) close) children,
+ }) async {
+ final position = webMenuAnchor(context);
+ if (position == null) return null;
+ try {
+ return await showPaneMenu<String>(
+ context: context,
+ // Opened by a click: no row is lit until the pointer picks one.
+ focusFirst: false,
+ position: position,
+ minWidth: 240,
+ maxWidth: 320,
+ onOpen: (_, close) => _closeOpen = close,
+ ownsPointer: _ownsPointer,
+ children: children,
+ );
+ } finally {
+ _closeOpen = null;
+ }
+ }
+
+ /// The button toggles its own menu rather than having it close under it.
+ bool _ownsPointer(Offset position) {
+ final box = context.findRenderObject();
+ return box is RenderBox &&
+ box.hasSize &&
+ (box.localToGlobal(Offset.zero) & box.size).contains(position);
+ }
+
+ Widget _rule() => Divider(
+ height: 9,
+ thickness: 1,
+ indent: 14,
+ endIndent: 14,
+ color: AppColors.border,
+ );
+
+ // Uncoloured on purpose: the row's ink tints the icon, so it turns with the
+ // label when the row lights up.
+ Widget _row(
+ String id,
+ String label,
+ Widget icon,
+ void Function(String?) close, {
+ required bool compact,
+ }) => paneMenuItem(
+ onTap: () => close(id),
+ // On a phone the row is a finger's height; a mouse keeps it as it was.
+ child: fingerTarget(
+ enabled: compact,
+ PaneMenuRow(
+ key: ValueKey('web-menu:$id'),
+ selected: false,
+ title: label,
+ leading: IconTheme.merge(
+ data: const IconThemeData(size: AppIcons.inlineSize),
+ child: icon,
+ ),
+ ),
+ ),
+ );
+}
diff --git a/desktop/lib/web/tabs/web_tab_switcher.dart b/desktop/lib/web/tabs/web_tab_switcher.dart
index 91d77b8c7..883f0dba7 100644
--- a/desktop/lib/web/tabs/web_tab_switcher.dart
+++ b/desktop/lib/web/tabs/web_tab_switcher.dart
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:xterm/xterm.dart' show TerminalTheme;
import '../../shared/theme/app_theme.dart' as grid;
-import '../../shared/theme/workspace_bar_style.dart';
import '../../state/app_state.dart';
import '../../state/harness_activity.dart';
import '../../state/workspace_chrome.dart';
@@ -16,8 +15,8 @@ import '../../widgets/finger_target.dart';
import '../../widgets/pane_menu.dart';
import '../../widgets/pane_grid.dart' show soloPaneId;
import '../shell/web_dropdown_control.dart';
+import '../shell/web_new_menu.dart';
import 'web_tab_menu.dart';
-import '../../widgets/workspace_bar_control.dart';
/// The tab list on a phone: the current tab as one control; its harnesses and
/// every tab one tap away in a menu. A row of tabs leaves room for one, and a
@@ -58,7 +57,10 @@ class WebTabSwitcher extends StatelessWidget {
_switcher(context, label, enabled, theme),
),
),
- fingerTarget(enabled: true, _newTabButton(context, enabled, theme)),
+ fingerTarget(
+ enabled: true,
+ WebNewMenuButton(app: app, commands: commands),
+ ),
],
);
}
@@ -76,28 +78,6 @@ class WebTabSwitcher extends StatelessWidget {
onPressed: enabled ? () => _open(context) : null,
);
- /// Desktop's `+` beside the tabs: a new tab, which opens on "Start an agent".
- Widget _newTabButton(
- BuildContext context,
- bool enabled,
- TerminalTheme theme,
- ) => WorkspaceBarControl(
- key: const ValueKey('web-new-tab-button'),
- label: 'New Tab',
- tooltip: 'New Tab',
- foreground: theme.foreground,
- onPressed: enabled && commands.canRun('swarm.new')
- ? () => commands.run('swarm.new')
- : null,
- builder: (context, emphasized) => SizedBox(
- width: workspaceBarCellSizeOf(context).width * 3,
- height: workspaceBarControlHeight(context),
- child: Center(
- child: Text('+', style: workspaceBarTextStyle(emphasized: emphasized)),
- ),
- ),
- );
-
Future<void> _open(BuildContext context) async {
final position = webMenuAnchor(context);
if (position == null) return;
diff --git a/desktop/lib/widgets/account_menu.dart b/desktop/lib/widgets/account_menu.dart
index cfc9d9280..cba83efcc 100644
--- a/desktop/lib/widgets/account_menu.dart
+++ b/desktop/lib/widgets/account_menu.dart
@@ -4,6 +4,7 @@ import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_menu.dart';
import 'desktop_chrome.dart';
+import 'finger_target.dart';
import 'pane_menu.dart';
import 'workspace_account_button.dart';
@@ -30,6 +31,7 @@ Future<AccountMenuChoice?> showAccountMenu(
required String email,
double topInset = 0,
bool focusFirst = false,
+ bool forPhone = false,
void Function(void Function() close)? onOpen,
bool Function(Offset position)? ownsPointer,
}) => showPaneMenu<AccountMenuChoice>(
@@ -40,7 +42,12 @@ Future<AccountMenuChoice?> showAccountMenu(
focusFirst: focusFirst,
onOpen: onOpen == null ? null : (_, close) => onOpen(close),
ownsPointer: ownsPointer,
- body: (close) => AccountMenu(name: name, email: email, onChoose: close),
+ body: (close) => AccountMenu(
+ name: name,
+ email: email,
+ forPhone: forPhone,
+ onChoose: close,
+ ),
);
class AccountMenu extends StatelessWidget {
@@ -49,6 +56,7 @@ class AccountMenu extends StatelessWidget {
required this.name,
required this.email,
required this.onChoose,
+ this.forPhone = false,
});
/// As the account gives it; empty when it has only an email.
@@ -56,6 +64,10 @@ class AccountMenu extends StatelessWidget {
final String email;
final void Function(AccountMenuChoice? choice) onChoose;
+ /// The web on a phone: rows a finger can hit, and no Add Phone (a phone is
+ /// already here).
+ final bool forPhone;
+
static const width = 264.0;
// Add Phone stays once the account has a phone: a second one is added the
@@ -128,16 +140,21 @@ class AccountMenu extends StatelessWidget {
),
),
const AppMenuDivider(),
- for (final (choice, icon, label) in _rows) ...[
- // Sign out stands apart from what opens something.
- if (choice == AccountMenuChoice.signOut) const AppMenuDivider(),
- AppMenuItem(
- key: ValueKey('account-menu-${choice.name}'),
- icon: icon,
- label: label,
- onPressed: () => onChoose(choice),
- ),
- ],
+ for (final (choice, icon, label) in _rows)
+ if (!forPhone || choice != AccountMenuChoice.addPhone) ...[
+ // Sign out stands apart from what opens something.
+ if (choice == AccountMenuChoice.signOut)
+ const AppMenuDivider(),
+ fingerTarget(
+ enabled: forPhone,
+ AppMenuItem(
+ key: ValueKey('account-menu-${choice.name}'),
+ icon: icon,
+ label: label,
+ onPressed: () => onChoose(choice),
+ ),
+ ),
+ ],
],
),
),
diff --git a/desktop/test/new_agent_dialog_phone_test.dart b/desktop/test/new_agent_dialog_phone_test.dart
index a6c96c21f..51e65a897 100644
--- a/desktop/test/new_agent_dialog_phone_test.dart
+++ b/desktop/test/new_agent_dialog_phone_test.dart
@@ -29,12 +29,7 @@ Future<void> _open(WidgetTester tester, Size size) async {
MaterialApp(
theme: grid.buildAppTheme(brightness: Brightness.dark),
home: WorkspaceChromeScope(
- chrome: WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- compactBelow: 720,
- showsKeyHints: false,
- ),
+ chrome: WorkspaceChrome(compactBelow: 720, showsKeyHints: false),
child: Builder(
builder: (context) => Scaffold(
body: TextButton(
@@ -127,7 +122,7 @@ void main() {
),
);
await tester.pump(const Duration(milliseconds: 200));
- await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
await tester.pump(const Duration(milliseconds: 300));
await tester.tap(find.byKey(const ValueKey('web-menu:pane.split_right')));
await tester.pump(const Duration(milliseconds: 500));
diff --git a/desktop/test/new_harness_phone_test.dart b/desktop/test/new_harness_phone_test.dart
index bae1b15a1..a2b49db99 100644
--- a/desktop/test/new_harness_phone_test.dart
+++ b/desktop/test/new_harness_phone_test.dart
@@ -34,11 +34,7 @@ Future<void> _mount(WidgetTester tester, Size size) async {
MaterialApp(
theme: ThemeData.dark(),
home: WorkspaceChromeScope(
- chrome: WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- compactBelow: 720,
- ),
+ chrome: WorkspaceChrome(compactBelow: 720),
child: Scaffold(
body: NewHarnessForm(
controller: box,
diff --git a/desktop/test/new_tab_actions_test.dart b/desktop/test/new_tab_actions_test.dart
index a4f8f76ba..471e8f5a8 100644
--- a/desktop/test/new_tab_actions_test.dart
+++ b/desktop/test/new_tab_actions_test.dart
@@ -23,11 +23,7 @@ const _buttons = {
};
/// What the web chrome sets, and nothing else.
-final _web = WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- showsKeyHints: false,
-);
+final _web = WorkspaceChrome(showsKeyHints: false);
class _Account extends AppNotifier {
_Account()
diff --git a/desktop/test/super_tab_recovers_test.dart b/desktop/test/super_tab_recovers_test.dart
index f2e87f5af..639fc10e9 100644
--- a/desktop/test/super_tab_recovers_test.dart
+++ b/desktop/test/super_tab_recovers_test.dart
@@ -15,11 +15,7 @@ import 'package:harness/web/shell/web_chrome.dart';
import 'support/super_tab_fixture.dart';
-final _recovers = WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- superTabRecovers: true,
-);
+final _recovers = WorkspaceChrome(superTabRecovers: true);
void main() {
final loading = find.textContaining('Loading conversation');
@@ -143,13 +139,7 @@ void main() {
configStore: null,
);
addTearDown(app.dispose);
- expect(
- WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- ).superTabRecovers,
- isFalse,
- );
+ expect(WorkspaceChrome().superTabRecovers, isFalse);
expect(webWorkspaceChrome(app).superTabRecovers, isTrue);
},
);
diff --git a/desktop/test/support/super_tab_phone.dart b/desktop/test/support/super_tab_phone.dart
index a793e5f82..0b311f9b1 100644
--- a/desktop/test/support/super_tab_phone.dart
+++ b/desktop/test/support/super_tab_phone.dart
@@ -9,11 +9,7 @@ import 'package:harness/super_tabs/view.dart';
import 'super_tab_fixture.dart';
-final _phoneChrome = WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- compactBelow: 720,
-);
+final _phoneChrome = WorkspaceChrome(compactBelow: 720);
/// The lead conversation, with one message from its owner and [seed]'s, in a
/// [size] window. [desktop] mounts it without chrome, as Desktop does.
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index d4cfdcab9..f3f006919 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -1166,6 +1166,60 @@ void main() {
},
);
+ testWidgets('the workspace goes cleanly with the Models controls open', (
+ tester,
+ ) async {
+ const channel = MethodChannel('harness/swarm_tabs');
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ (call) async => null,
+ );
+ addTearDown(
+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ null,
+ ),
+ );
+ final app = createApp();
+ final projects = SwarmProjectStore();
+ await app.modelManager.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ home: SwarmScreen(
+ notifier: app,
+ nativeTabs: true,
+ projectStore: projects,
+ ),
+ ),
+ );
+ await tester.pump();
+ final reply = Completer<void>();
+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(
+ channel.name,
+ const StandardMethodCodec().encodeMethodCall(
+ const MethodCall('modelControls'),
+ ),
+ (_) => reply.complete(),
+ );
+ for (var frame = 0; frame < 5 && !reply.isCompleted; frame++) {
+ await tester.pump();
+ }
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(ModelsPanel), findsOneWidget);
+
+ // A sign-out or a lost session: the page stays, the workspace goes.
+ await tester.pumpWidget(
+ const MaterialApp(home: Scaffold(body: Text('Sign in'))),
+ );
+ await tester.pump();
+ expect(tester.takeException(), isNull);
+ expect(find.byType(ModelsPanel), findsNothing);
+ expect(find.text('Sign in'), findsOneWidget);
+ await tester.pumpWidget(const SizedBox());
+ projects.dispose();
+ app.dispose();
+ });
+
testWidgets('the pane × is full ink at rest, as the tab ×', (tester) async {
final app = createApp();
addTearDown(app.dispose);
diff --git a/desktop/test/web/web_app_menu_test.dart b/desktop/test/web/web_app_menu_test.dart
index 4c2003280..2d6309e19 100644
--- a/desktop/test/web/web_app_menu_test.dart
+++ b/desktop/test/web/web_app_menu_test.dart
@@ -48,26 +48,34 @@ Future<AppNotifier> _mount(
return app;
}
+Future<void> _openAccount(WidgetTester tester) async {
+ await tester.tap(find.byKey(const ValueKey('swarm-account-button')));
+ await tester.pump(const Duration(milliseconds: 100));
+}
+
Future<void> _openMenu(WidgetTester tester) async {
- await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
await tester.pump(const Duration(milliseconds: 100));
}
void main() {
- testWidgets('the menu button opens Settings with one click', (tester) async {
+ testWidgets('a browser wears the avatar; it opens Settings in one click', (
+ tester,
+ ) async {
final app = await _mount(tester);
+ expect(app.viewer, isNotNull);
await _openMenu(tester);
- expect(
- find.byKey(const ValueKey('web-menu:machines.list')),
- findsOneWidget,
- );
- expect(find.byKey(const ValueKey('web-menu:web.sign_out')), findsOneWidget);
// An empty tab has no pane to split.
expect(
find.byKey(const ValueKey('web-menu:pane.split_right')),
findsNothing,
);
- await tester.tap(find.byKey(const ValueKey('web-menu:app.settings')));
+ expect(find.byKey(const ValueKey('web-menu:swarm.new')), findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 100));
+ await _openAccount(tester);
+ expect(find.byKey(const ValueKey('account-menu-signOut')), findsOneWidget);
+ await tester.tap(find.byKey(const ValueKey('account-menu-settings')));
await tester.pump(const Duration(milliseconds: 400));
expect(find.byType(SettingsScreen), findsOneWidget);
expect(tester.takeException(), isNull);
@@ -84,14 +92,14 @@ void main() {
Focus.of(tester.element(find.byKey(ValueKey('web-menu:$id'))))
.hasPrimaryFocus;
// Opened by a click: the pointer picks the row, so none starts lit.
- expect(lit('super_tab.new'), isFalse);
+ expect(lit('swarm.new'), isFalse);
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
- // The first row: New Swarm.
- expect(lit('super_tab.new'), isTrue);
+ // The first row: New tab.
+ expect(lit('swarm.new'), isTrue);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump(const Duration(milliseconds: 100));
- expect(find.byKey(const ValueKey('web-menu:machines.list')), findsNothing);
+ expect(find.byKey(const ValueKey('web-menu:swarm.new')), findsNothing);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox.shrink());
app.dispose();
@@ -123,8 +131,7 @@ void main() {
testWidgets('View on a machine picks it and closes Machines', (tester) async {
final app = await _mount(tester, connectedMachine: 'remote-box');
- await _openMenu(tester);
- await tester.tap(find.byKey(const ValueKey('web-menu:machines.list')));
+ await tester.tap(find.textContaining('Machines ').hitTestable());
await tester.pump(const Duration(milliseconds: 400));
final search = tester
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
diff --git a/desktop/test/web/web_tab_context_menu_test.dart b/desktop/test/web/web_tab_context_menu_test.dart
index 5c9e2ad9b..17e38509a 100644
--- a/desktop/test/web/web_tab_context_menu_test.dart
+++ b/desktop/test/web/web_tab_context_menu_test.dart
@@ -104,13 +104,7 @@ void main() {
tester,
) async {
await tester.pumpWidget(
- host(
- chrome: WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- menuOnEveryTab: true,
- ),
- ),
+ host(chrome: WorkspaceChrome(menuOnEveryTab: true)),
);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
addTearDown(mouse.removePointer);
diff --git a/desktop/test/web_chrome_menus_test.dart b/desktop/test/web_chrome_menus_test.dart
new file mode 100644
index 000000000..76fed264a
--- /dev/null
+++ b/desktop/test/web_chrome_menus_test.dart
@@ -0,0 +1,391 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/settings/settings_screen.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/state/app_state.dart';
+import 'package:harness/state/terminal_pane.dart';
+import 'package:harness/web/shell/web_chrome.dart';
+import 'package:harness/widgets/account_menu.dart';
+import 'package:harness/widgets/swarm_switcher.dart';
+
+import 'support/capture.dart';
+import 'support/real_fonts.dart';
+import 'swarm_state_test.dart' show createApp;
+
+/// The web bar after Huy's ask (2026-11-02): no left menu; the avatar's account
+/// menu; no Machines or Models on the bar (the footer has them); `+` opens a
+/// small menu whose More keeps what a phone has no key for. `HARNESS_WEB_MENUS_CAPTURE_DIR` writes what it
+/// draws.
+const _wide = Size(1280, 800);
+const _phone = Size(390, 844);
+final _captureDir = Platform.environment['HARNESS_WEB_MENUS_CAPTURE_DIR'];
+
+final _plus = find.byKey(const ValueKey('web-new-menu-button'));
+final _avatar = find.byKey(const ValueKey('swarm-account-button'));
+final _accountMenu = find.byKey(const ValueKey('account-menu'));
+Finder _row(String id) => find.byKey(ValueKey('web-menu:$id'));
+Finder _accountRow(String id) => find.byKey(ValueKey('account-menu-$id'));
+
+AppNotifier _app({int panes = 3}) {
+ final app = createApp()
+ ..currentUser = const CurrentUserProfile(
+ name: 'Huy Pham',
+ email: '[email protected]',
+ );
+ const machine = Machine(
+ machineId: 'm',
+ name: 'box',
+ authMode: MachineAuthMode.remote,
+ );
+ app.machines.add(machine);
+ app.machineStates['m'] = MachineState(machine)
+ ..nodeOnline = true
+ ..connectionStatus = ConnectionStatus.connected
+ ..agents = [for (var i = 0; i < 4; i++) Agent(id: 'a$i', name: 'Agent $i')];
+ app.newSwarm(newTabPage: true);
+ app.activeSwarm.panes.addAll([
+ for (var i = 0; i < panes; i++)
+ TerminalPane(id: 100 + i, machineId: 'm', agentId: 'a$i'),
+ ]);
+ app.focusPane(100);
+ return app;
+}
+
+Future<AppNotifier> _mount(
+ WidgetTester tester,
+ Size size, {
+ AppNotifier? app,
+ bool web = true,
+ Brightness brightness = Brightness.dark,
+}) async {
+ final notifier = app ?? _app();
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = size;
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: SwarmScreen(
+ notifier: notifier,
+ nativeTabs: false,
+ chrome: web ? webWorkspaceChrome(notifier) : null,
+ ),
+ ),
+ );
+ await tester.pump(const Duration(milliseconds: 200));
+ return notifier;
+}
+
+Future<void> _tap(WidgetTester tester, Finder target) async {
+ await tester.tap(target);
+ await tester.pump(const Duration(milliseconds: 150));
+}
+
+/// Takes the workspace down with the page still up, as a sign-out or a lost
+/// session does: the menus' overlay is the page's, not the workspace's.
+Future<void> _signOutScreen(WidgetTester tester) async {
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: const Scaffold(body: Text('Sign in')),
+ ),
+ );
+ await tester.pump(const Duration(milliseconds: 100));
+}
+
+Future<void> _done(WidgetTester tester, AppNotifier app) async {
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox.shrink());
+ app.dispose();
+}
+
+void main() {
+ setUpAll(() => loadCaptureFonts(_captureDir));
+
+ group('the wide bar', () {
+ testWidgets('has no left menu; Machines and Models are the footer\'s', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _wide);
+ final bar = find.byKey(const ValueKey('workspace-tab-bar'));
+ expect(find.byKey(const ValueKey('web-app-menu-button')), findsNothing);
+ for (final button in [_plus, _avatar]) {
+ expect(find.descendant(of: bar, matching: button), findsOneWidget);
+ }
+ for (final word in ['Machines', 'Models']) {
+ expect(
+ find.descendant(of: bar, matching: find.textContaining(word)),
+ findsNothing,
+ reason: word,
+ );
+ }
+ // Still one click away, in the status bar.
+ await _tap(tester, find.textContaining('Machines ').hitTestable());
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ await _done(tester, app);
+ });
+
+ testWidgets('the avatar sits at the right end, Store before it', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _wide);
+ final store = find.byKey(const ValueKey('swarm-store-button'));
+ expect(
+ tester.getTopLeft(_avatar).dx,
+ greaterThan(tester.getTopRight(store).dx - 1),
+ );
+ await _done(tester, app);
+ });
+
+ testWidgets('+ offers New tab, New Swarm, Split pane, History and More', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _wide);
+ await _tap(tester, _plus);
+ for (final id in [
+ 'swarm.new',
+ 'super_tab.new',
+ 'pane.split_right',
+ 'navigation.history',
+ 'web.more',
+ ]) {
+ expect(_row(id), findsOneWidget, reason: id);
+ }
+ expect(_row('app.store'), findsNothing);
+ expect(find.text('All commands'), findsNothing);
+ await captureWindow(tester, _captureDir, 'wide-dark-plus-menu');
+
+ final tabs = app.swarms.length;
+ await _tap(tester, _row('swarm.new'));
+ expect(app.swarms, hasLength(tabs + 1));
+ expect(_row('swarm.new'), findsNothing);
+ await _done(tester, app);
+ });
+
+ testWidgets('a second press on + closes its menu', (tester) async {
+ final app = await _mount(tester, _wide);
+ await _tap(tester, _plus);
+ expect(_row('swarm.new'), findsOneWidget);
+ await _tap(tester, _plus);
+ expect(_row('swarm.new'), findsNothing);
+ await _done(tester, app);
+ });
+
+ testWidgets('the avatar opens the account menu with Add Phone', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _wide);
+ await _tap(tester, _avatar);
+ expect(_accountMenu, findsOneWidget);
+ expect(find.text('Huy Pham'), findsOneWidget);
+ expect(find.text('[email protected]'), findsOneWidget);
+ for (final choice in AccountMenuChoice.values) {
+ expect(_accountRow(choice.name), findsOneWidget, reason: choice.name);
+ }
+ await captureWindow(tester, _captureDir, 'wide-dark-account-menu');
+ await _tap(tester, _accountRow('settings'));
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(find.byType(SettingsScreen), findsOneWidget);
+ await _done(tester, app);
+ });
+ });
+
+ group('the phone bar', () {
+ testWidgets('the account menu has no Add Phone, and finger-tall rows', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _phone);
+ await _tap(tester, _avatar);
+ expect(_accountRow('addPhone'), findsNothing);
+ for (final choice in [
+ AccountMenuChoice.customize,
+ AccountMenuChoice.notifications,
+ AccountMenuChoice.settings,
+ AccountMenuChoice.signOut,
+ ]) {
+ expect(
+ tester.getSize(_accountRow(choice.name)).height,
+ greaterThanOrEqualTo(44),
+ reason: choice.name,
+ );
+ }
+ await captureWindow(tester, _captureDir, 'phone-dark-account-menu');
+ await _done(tester, app);
+ });
+
+ testWidgets('+ adds Store, and More holds zoom, move, layouts, reopen', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _phone);
+ await _tap(tester, _plus);
+ expect(_row('app.store'), findsOneWidget);
+ await captureWindow(tester, _captureDir, 'phone-dark-plus-menu');
+ await _tap(tester, _row('web.more'));
+ expect(_row('swarm.new'), findsNothing);
+ for (final id in [
+ 'pane.zoom',
+ 'pane.move_left',
+ 'pane.move_right',
+ 'pane.move_up',
+ 'pane.move_down',
+ 'pane.move_to_tab',
+ 'pane.layout',
+ ]) {
+ expect(_row(id), findsOneWidget, reason: id);
+ expect(
+ tester.getSize(_row(id)).height,
+ greaterThanOrEqualTo(44),
+ reason: id,
+ );
+ }
+ await captureWindow(tester, _captureDir, 'phone-dark-more-menu');
+
+ // A row of More runs: Zoom really zooms the focused pane.
+ expect(app.zoomedPaneId, isNull);
+ await _tap(tester, _row('pane.zoom'));
+ expect(app.zoomedPaneId, 100);
+ await _done(tester, app);
+ });
+
+ testWidgets('Move pane right and Reopen closed tab run from More', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _phone);
+ final order = [for (final pane in app.panes) pane.id];
+ await _tap(tester, _plus);
+ await _tap(tester, _row('web.more'));
+ await _tap(tester, _row('pane.move_right'));
+ expect([
+ for (final pane in app.panes) pane.id,
+ ], isNot(orderedEquals(order)));
+
+ await tester.runAsync(() => app.requestCloseSwarm(app.activeSwarmId));
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(app.canReopenLastClosed, isTrue);
+ final tabs = app.swarms.length;
+ await _tap(tester, _plus);
+ await _tap(tester, _row('web.more'));
+ await _tap(tester, _row('swarm.reopen'));
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(app.swarms, hasLength(tabs + 1));
+ await _done(tester, app);
+ });
+
+ for (final width in [360.0, 390.0]) {
+ testWidgets('every control fits and is a finger wide at $width', (
+ tester,
+ ) async {
+ final app = await _mount(tester, Size(width, 740));
+ final rects = <Rect>[];
+ for (final key in [
+ 'web-tab-switcher',
+ 'web-new-menu-button',
+ 'swarm-search-button',
+ 'workspace-notifications-button',
+ 'swarm-account-button',
+ ]) {
+ final rect = tester.getRect(find.byKey(ValueKey(key)));
+ expect(rect.width, greaterThanOrEqualTo(44), reason: key);
+ expect(rect.height, greaterThanOrEqualTo(44), reason: key);
+ expect(rect.right, lessThanOrEqualTo(width), reason: key);
+ for (final other in rects) {
+ expect(rect.overlaps(other), isFalse, reason: key);
+ }
+ rects.add(rect);
+ }
+ await captureWindow(tester, _captureDir, 'phone-$width-dark-bar');
+ await _done(tester, app);
+ });
+ }
+
+ testWidgets('Machines and Models stay in the phone footer\'s menu', (
+ tester,
+ ) async {
+ final app = await _mount(tester, _phone);
+ await _tap(tester, find.byKey(const ValueKey('web-footer-menu-button')));
+ final machines = find.textContaining('Machines ');
+ expect(machines, findsOneWidget);
+ expect(find.textContaining('Models '), findsOneWidget);
+ await _tap(tester, machines);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ await _done(tester, app);
+ });
+
+ testWidgets('a 320 px phone still fits the bar', (tester) async {
+ final app = await _mount(tester, const Size(320, 640));
+ expect(tester.getRect(_avatar).right, lessThanOrEqualTo(320));
+ await _done(tester, app);
+ });
+ });
+
+ group('access lost with a menu open', () {
+ for (final (name, size) in [('wide', _wide), ('phone', _phone)]) {
+ testWidgets('the account menu leaves no name or email on $name', (
+ tester,
+ ) async {
+ final app = await _mount(tester, size);
+ await _tap(tester, _avatar);
+ expect(find.text('[email protected]'), findsOneWidget);
+ await _signOutScreen(tester);
+ expect(_accountMenu, findsNothing);
+ expect(find.text('Huy Pham'), findsNothing);
+ expect(find.text('[email protected]'), findsNothing);
+ expect(find.text('Sign in'), findsOneWidget);
+ await _done(tester, app);
+ });
+
+ testWidgets('the + menu goes with the workspace on $name', (
+ tester,
+ ) async {
+ final app = await _mount(tester, size);
+ await _tap(tester, _plus);
+ expect(_row('swarm.new'), findsOneWidget);
+ await _signOutScreen(tester);
+ expect(_row('swarm.new'), findsNothing);
+ await _done(tester, app);
+ });
+
+ testWidgets('More goes with the workspace on $name', (tester) async {
+ final app = await _mount(tester, size);
+ await _tap(tester, _plus);
+ await _tap(tester, _row('web.more'));
+ expect(_row('pane.layout'), findsOneWidget);
+ await _signOutScreen(tester);
+ expect(_row('pane.layout'), findsNothing);
+ await _done(tester, app);
+ });
+ }
+
+ testWidgets('Desktop keeps its + and has no web buttons', (tester) async {
+ final app = await _mount(tester, _wide, web: false);
+ final tabs = app.swarms.length;
+ expect(_plus, findsNothing);
+ await _tap(tester, find.byKey(const ValueKey('swarm-new-tab-button')));
+ expect(app.swarms, hasLength(tabs + 1));
+ await _done(tester, app);
+ });
+ });
+
+ // The pictures for the pull request; the dark ones are taken above.
+ testWidgets('light theme pictures', (tester) async {
+ if (_captureDir == null) return;
+ for (final (name, size) in [('wide', _wide), ('phone', _phone)]) {
+ final app = await _mount(tester, size, brightness: Brightness.light);
+ await _tap(tester, _plus);
+ await captureWindow(tester, _captureDir, '$name-light-plus-menu');
+ await _tap(tester, _row('web.more'));
+ await captureWindow(tester, _captureDir, '$name-light-more-menu');
+ await tester.tapAt(const Offset(5, 500));
+ await tester.pump(const Duration(milliseconds: 100));
+ await _tap(tester, _avatar);
+ await captureWindow(tester, _captureDir, '$name-light-account-menu');
+ await _done(tester, app);
+ }
+ });
+}
diff --git a/desktop/test/web_footer_subscriptions_test.dart b/desktop/test/web_footer_subscriptions_test.dart
index c020d0eb6..b495556a6 100644
--- a/desktop/test/web_footer_subscriptions_test.dart
+++ b/desktop/test/web_footer_subscriptions_test.dart
@@ -120,8 +120,6 @@ void main() {
await mount(
tester,
chrome: (app) => WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
compactTabs: (context, commands) =>
WebTabSwitcher(app: app, commands: commands),
compactFooter: (context, footer) => WebFooterBar(footer: footer),
diff --git a/desktop/test/web_machine_list_watch_test.dart b/desktop/test/web_machine_list_watch_test.dart
index a002a6d98..08b81c335 100644
--- a/desktop/test/web_machine_list_watch_test.dart
+++ b/desktop/test/web_machine_list_watch_test.dart
@@ -150,8 +150,6 @@ void main() {
notifier: app,
chrome: browser
? WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox(),
firstMachine: (_) => const SizedBox(key: _connectPage),
)
: null,
diff --git a/desktop/test/web_menu_items_test.dart b/desktop/test/web_menu_items_test.dart
index 84d2758de..2c8f51639 100644
--- a/desktop/test/web_menu_items_test.dart
+++ b/desktop/test/web_menu_items_test.dart
@@ -17,28 +17,38 @@ void main() {
}
});
- test('a phone gets Store, a wide window gets Add phone', () {
+ test('a phone gets Store; a wide window has its own Store button', () {
final phone = _commands(runnableWebMenu((_) => true, compact: true));
final wide = _commands(runnableWebMenu((_) => true, compact: false));
expect(phone, contains('app.store'));
- expect(phone, isNot(contains('app.add_phone')));
- expect(wide, contains('app.add_phone'));
expect(wide, isNot(contains('app.store')));
});
- test('controls the bar already has, and keyboard tours, stay out', () {
+ test('the + menu is New tab, New Swarm, Split pane, History', () {
+ expect(_commands(runnableWebMenu((_) => true, compact: false)), [
+ 'swarm.new',
+ 'super_tab.new',
+ 'pane.split_right',
+ 'navigation.history',
+ ]);
+ });
+
+ test('what moved to the bar or the avatar, and keyboard tours, stay out', () {
final all = _commands(runnableWebMenu((_) => true, compact: true));
for (final elsewhere in [
+ 'machines.list',
+ 'models.list',
+ 'navigation.commands',
+ 'app.settings',
+ 'app.customize',
+ 'app.add_phone',
'agent.new',
- 'swarm.new',
'harnesses.list',
'navigation.needs_input',
// Share is the Experimental setting's to show, never the menu's.
'agent.share',
'pane.split_down',
'pane.close',
- 'pane.zoom',
- 'pane.layout',
'keyboard.help',
'keyboard.quick_start',
]) {
@@ -46,14 +56,38 @@ void main() {
}
});
- test('one split, to the right, has a row', () {
- final all = _commands(runnableWebMenu((_) => true, compact: true));
- expect(all, contains('pane.split_right'));
+ test('More keeps zoom, move, layouts and reopen reachable', () {
+ final more = [
+ for (final item in runnableWebMore((_) => true, panes: 2)) item.command,
+ ];
+ final registered = {for (final command in harnessCommands) command.id};
+ expect(registered, containsAll(more));
+ expect(
+ more,
+ containsAll([
+ 'pane.zoom',
+ 'pane.move_left',
+ 'pane.move_right',
+ 'pane.move_up',
+ 'pane.move_down',
+ 'pane.move_to_tab',
+ 'pane.layout',
+ 'swarm.reopen',
+ ]),
+ );
+ });
+
+ test('one pane has nothing to zoom or move; nothing runnable, no More', () {
+ final one = [
+ for (final item in runnableWebMore((_) => true, panes: 1)) item.command,
+ ];
+ expect(one, ['pane.move_to_tab', 'pane.layout', 'swarm.reopen']);
+ expect(runnableWebMore((_) => false, panes: 2), isEmpty);
});
test('rows that cannot run, and groups left empty, are not drawn', () {
final menu = runnableWebMenu(
- (command) => !command.startsWith('pane.'),
+ (command) => !command.startsWith('swarm.') && command != 'super_tab.new',
compact: false,
);
expect(menu, hasLength(kWebMenuGroups.length - 1));
diff --git a/desktop/test/web_menus_test.dart b/desktop/test/web_menus_test.dart
index a639261de..78c434c80 100644
--- a/desktop/test/web_menus_test.dart
+++ b/desktop/test/web_menus_test.dart
@@ -15,7 +15,7 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/app_state.dart';
import 'package:harness/state/terminal_pane.dart';
import 'package:harness/state/workspace_chrome.dart';
-import 'package:harness/web/shell/web_app_menu.dart';
+import 'package:harness/web/shell/web_new_menu.dart';
import 'package:harness/web/shell/web_chrome.dart';
import 'package:harness/web/tabs/web_tab_menu.dart';
import 'package:harness/widgets/desktop_workspace_tab.dart';
@@ -132,7 +132,7 @@ Future<void> _openSettings(WidgetTester tester, Size size) async {
}
Future<void> _openAppMenu(WidgetTester tester) async {
- await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
await tester.pump(const Duration(milliseconds: 100));
}
@@ -306,7 +306,7 @@ void main() {
await _workspace(tester, _phone);
await _openAppMenu(tester);
- for (final row in ['super_tab.new', 'machines.list', 'web.sign_out']) {
+ for (final row in ['swarm.new', 'super_tab.new', 'app.store', 'web.more']) {
expect(
_target(tester, ValueKey('web-menu:$row')).height,
greaterThanOrEqualTo(_finger),
@@ -321,7 +321,7 @@ void main() {
await _openAppMenu(tester);
expect(
- _target(tester, const ValueKey('web-menu:machines.list')).height,
+ _target(tester, const ValueKey('web-menu:super_tab.new')).height,
32,
);
await tester.pumpWidget(const SizedBox.shrink());
@@ -385,15 +385,9 @@ void main() {
}) async {
await _workspace(tester, size, harness: true, desktop: desktop);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- final menu = find.byKey(const ValueKey('web-app-menu-button'));
- if (menu.evaluate().isNotEmpty) {
- await _openAppMenu(tester);
- await tester.tap(find.byKey(const ValueKey('web-menu:machines.list')));
- } else {
- await tester.tap(find.byKey(const ValueKey('swarm-search-button')));
- await tester.pump(const Duration(milliseconds: 200));
- await tester.enterText(find.byType(EditableText).first, '@');
- }
+ await tester.tap(find.byKey(const ValueKey('swarm-search-button')));
+ await tester.pump(const Duration(milliseconds: 200));
+ await tester.enterText(find.byType(EditableText).first, '@');
await tester.pump(const Duration(milliseconds: 400));
await _openMachines(tester);
}
@@ -486,7 +480,7 @@ void main() {
home: Scaffold(
body: Align(
alignment: Alignment.topLeft,
- child: WebAppMenuButton(
+ child: WebNewMenuButton(
app: app,
commands: WorkspaceCommands(
enabled: () => true,
diff --git a/desktop/test/web_phone_targets_test.dart b/desktop/test/web_phone_targets_test.dart
index e725ca5a6..cbfcbce87 100644
--- a/desktop/test/web_phone_targets_test.dart
+++ b/desktop/test/web_phone_targets_test.dart
@@ -140,7 +140,9 @@ void main() {
testWidgets('a phone\'s New tab page rows are a finger tall', (tester) async {
await _mount(tester, const Size(360, 740), () => withPanes(signedIn(), 3));
- await tester.tap(find.byKey(const ValueKey('web-new-tab-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
+ await tester.pump(const Duration(milliseconds: 100));
+ await tester.tap(find.byKey(const ValueKey('web-menu:swarm.new')));
await tester.pump(const Duration(milliseconds: 500));
for (final height in _newTabRowHeights(tester)) {
expect(height, greaterThanOrEqualTo(44));
diff --git a/desktop/test/web_tab_switcher_test.dart b/desktop/test/web_tab_switcher_test.dart
index a054c3a46..ec0f81f67 100644
--- a/desktop/test/web_tab_switcher_test.dart
+++ b/desktop/test/web_tab_switcher_test.dart
@@ -116,7 +116,9 @@ void main() {
expect(app.activeSwarmId, first);
final count = app.swarms.length;
- await tester.tap(find.byKey(const ValueKey('web-new-tab-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
+ await tester.pump(const Duration(milliseconds: 100));
+ await tester.tap(find.byKey(const ValueKey('web-menu:swarm.new')));
await tester.pump(const Duration(milliseconds: 100));
expect(app.swarms.length, count + 1);
@@ -167,11 +169,10 @@ void main() {
await tester.pump(const Duration(milliseconds: 300));
expect(app.panes.map((pane) => pane.id), [100, 101]);
- await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
await tester.pump(const Duration(milliseconds: 100));
- // The phone menu carries Store (its bar has no Store button), not Add phone.
+ // The phone menu carries Store: its bar has no Store button.
expect(find.byKey(const ValueKey('web-menu:app.store')), findsOneWidget);
- expect(find.byKey(const ValueKey('web-menu:app.add_phone')), findsNothing);
await capture(tester, 'web-phone-app-menu');
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox.shrink());
@@ -203,7 +204,7 @@ void main() {
);
// One harness drawn alone still has a desk to split: the menu offers it.
- await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));
+ await tester.tap(find.byKey(const ValueKey('web-new-menu-button')));
await tester.pump(const Duration(milliseconds: 100));
expect(
find.byKey(const ValueKey('web-menu:pane.split_right')),
@@ -236,9 +237,8 @@ void main() {
);
const barControls = [
- 'web-app-menu-button',
'web-tab-switcher',
- 'web-new-tab-button',
+ 'web-new-menu-button',
'swarm-search-button',
'workspace-notifications-button',
];
@@ -262,7 +262,7 @@ void main() {
}
rects.add(rect);
}
- for (final key in ['web-app-menu-button', 'swarm-search-button']) {
+ for (final key in ['swarm-search-button']) {
final icon = tester.widget<Icon>(
find.descendant(
of: find.byKey(ValueKey(key)),
@@ -280,7 +280,7 @@ void main() {
tester,
) async {
final app = await mount(tester, const Size(1280, 800));
- for (final key in ['web-app-menu-button', 'swarm-search-button']) {
+ for (final key in ['swarm-search-button']) {
expect(tester.getSize(find.byKey(ValueKey(key))).height, 28);
}
await tester.pumpWidget(const SizedBox.shrink());
diff --git a/desktop/test/workspace_chrome_scope_test.dart b/desktop/test/workspace_chrome_scope_test.dart
index 9a192d3f3..50620adaa 100644
--- a/desktop/test/workspace_chrome_scope_test.dart
+++ b/desktop/test/workspace_chrome_scope_test.dart
@@ -46,8 +46,6 @@ AppNotifier _appWithPane() {
}
WorkspaceChrome _hostChrome({bool flags = false}) => WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
menuOnEveryTab: flags,
labelsPaneStatus: flags,
compactPaneHeader: flags,
@@ -90,10 +88,7 @@ void main() {
});
test('a host chrome that names none of them leaves them off', () {
- final chrome = WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox.shrink(),
- );
+ final chrome = WorkspaceChrome();
expect(chrome.menuOnEveryTab, isFalse);
expect(chrome.labelsPaneStatus, isFalse);
diff --git a/desktop/test/workspace_first_connection_test.dart b/desktop/test/workspace_first_connection_test.dart
index 27c9ba651..efaa8ef3f 100644
--- a/desktop/test/workspace_first_connection_test.dart
+++ b/desktop/test/workspace_first_connection_test.dart
@@ -81,8 +81,6 @@ void main() {
notifier: app,
chrome: connectPage
? WorkspaceChrome(
- leadingWidth: (_) => 0,
- leading: (_, _) => const SizedBox(),
firstMachine: (_) => const SizedBox(key: _connectPage),
)
: null,
diff --git a/desktop/tool/web_ux/checks.mjs b/desktop/tool/web_ux/checks.mjs
index 234f65175..aecae5d00 100644
--- a/desktop/tool/web_ux/checks.mjs
+++ b/desktop/tool/web_ux/checks.mjs
@@ -28,8 +28,9 @@ const COMPUTER = VIEWPORTS.find((v) => v.name === '1440');
// Flows whose controls are measured for tap size on phones: on the Super Tab
// fixture, all of them.
const TAP_FLOWS = FIXTURE !== 'app' ? FLOWS.map((f) => f.name) : [
- 'signin', 'first-machine', 'computers', 'workspace', 'app-menu', 'tab-switcher',
- 'footer-menu', 'notifications', 'open-harness', 'machines', 'all-commands',
+ 'signin', 'first-machine', 'computers', 'workspace', 'new-menu', 'more-menu',
+ 'account-menu', 'tab-switcher',
+ 'footer-menu', 'notifications', 'open-harness', 'machines',
'appearance', 'split-pane', 'store', 'settings', 'settings-notifications',
'settings-keyboard-shortcuts', 'new-tab', 'error-banner', 'new-device', 'link-password',
'taken-over', 'view-only',
@@ -48,7 +49,6 @@ const SCROLLERS = [
{ flow: 'many-tabs', area: 'tab row (trackpad sideways)', box: [60, 0, 1300, 40], wheel: [-300, 0] },
{ flow: 'store', area: 'store page', box: [120, 60, 1300, 860], wheel: [0, 600] },
{ flow: 'open-harness', area: 'picker filter chips', box: [320, 330, 1100, 360], wheel: [0, 200] },
- { flow: 'all-commands', area: 'command list', box: [320, 380, 720, 880], wheel: [0, 400] },
{ flow: 'appearance', area: 'appearance panel', box: [1230, 120, 1440, 900], wheel: [0, 500] },
{ flow: 'settings-keyboard-shortcuts', area: 'shortcut list', box: [270, 100, 1440, 900], wheel: [0, 600] },
{ flow: 'split-pane', area: 'new harness form', box: [300, 150, 1140, 880], wheel: [0, 400] },
@@ -58,24 +58,22 @@ const SCROLLERS = [
const SWIPES = [
{ flow: 'tab-switcher', area: 'tab switcher list', from: [195, 600], to: [195, 250] },
{ flow: 'machines', area: 'machines list', from: [195, 600], to: [195, 250] },
- { flow: 'app-menu', area: 'app menu', from: [120, 500], to: [120, 200] },
{ flow: 'store', area: 'store page', from: [195, 650], to: [195, 200] },
{ flow: 'settings', area: 'settings list', from: [195, 650], to: [195, 200] },
{ flow: 'settings-keyboard-shortcuts', area: 'shortcut list', from: [195, 650], to: [195, 200] },
- { flow: 'all-commands', area: 'command list', from: [195, 650], to: [195, 250] },
{ flow: 'first-machine', area: 'connect page', from: [195, 650], to: [195, 200] },
{ flow: 'signin', area: 'sign-in page', from: [195, 650], to: [195, 200] },
];
// Controls hovered with the mouse at 1440.
const HOVERS = [
- { flow: 'workspace', name: 'New Tab' },
+ { flow: 'workspace', name: 'New', exact: true },
{ flow: 'workspace', name: 'Open Harness' },
{ flow: 'workspace', name: 'Close Pane' },
{ flow: 'workspace', name: 'Agent: Claude Code' },
{ flow: 'workspace', name: 'Click to open Harness Monitor' },
{ flow: 'many-tabs', name: 'docs' },
- { flow: 'app-menu', name: 'Settings', exact: true },
+ { flow: 'account-menu', name: 'Settings', exact: true },
{ flow: 'signin', name: 'Continue with Google' },
{ flow: 'first-machine', name: 'Download app' },
{ flow: 'settings', name: 'Privacy', exact: true },
diff --git a/desktop/tool/web_ux/flows/base.mjs b/desktop/tool/web_ux/flows/base.mjs
index c9fac56ab..703be5bd9 100644
--- a/desktop/tool/web_ux/flows/base.mjs
+++ b/desktop/tool/web_ux/flows/base.mjs
@@ -2,15 +2,15 @@
//
// Fix group: none (shared). Each group keeps its flows here, so parallel groups never
// edit the same file; load-flows.mjs reads every file in this folder.
-import { menu } from './steps.mjs';
+import { account, menu, picker } from './steps.mjs';
export const FLOWS = [
{ name: 'workspace', scenario: 'workspace' },
{ name: 'notifications', scenario: 'workspace', steps: [['exact', 'Notifications']] },
{ name: 'open-harness', scenario: 'workspace', steps: [['exact', 'Open Harness']] },
- { name: 'models', scenario: 'workspace', steps: menu('Models') },
+ { name: 'models', scenario: 'workspace', steps: picker(':') },
{ name: 'history', scenario: 'workspace', steps: menu('History') },
- { name: 'appearance', scenario: 'workspace', steps: menu('Appearance') },
+ { name: 'appearance', scenario: 'workspace', steps: account('Appearance') },
{ name: 'add-phone', scenario: 'workspace', only: 'wide', steps: [['exact', 'Add Phone']] },
{ name: 'harness-monitor', scenario: 'workspace', only: 'wide', steps: [['click', 'Click to open Harness Monitor']] },
];
diff --git a/desktop/tool/web_ux/flows/menus.mjs b/desktop/tool/web_ux/flows/menus.mjs
index b8cd5ff9b..510a026af 100644
--- a/desktop/tool/web_ux/flows/menus.mjs
+++ b/desktop/tool/web_ux/flows/menus.mjs
@@ -2,17 +2,18 @@
//
// Fix group: 1, web menus, commands and hit sizes. Each group keeps its flows here, so parallel groups never
// edit the same file; load-flows.mjs reads every file in this folder.
-import { menu } from './steps.mjs';
+import { account, menu, picker } from './steps.mjs';
export const FLOWS = [
- { name: 'app-menu', scenario: 'workspace', steps: [['exact', 'Menu']] },
+ { name: 'new-menu', scenario: 'workspace', steps: [['exact', 'New']] },
+ { name: 'more-menu', scenario: 'workspace', steps: menu('More') },
+ { name: 'account-menu', scenario: 'workspace', steps: [['exact', 'Account']] },
{ name: 'many-tabs', scenario: 'many-tabs' },
{ name: 'tab-switcher', scenario: 'many-tabs', only: 'compact', steps: [['click', 'Tabs:']] },
{ name: 'tab-menu', scenario: 'many-tabs', only: 'wide', steps: [['rclick', 'docs']] },
{ name: 'footer-menu', scenario: 'workspace', only: 'compact', steps: [['click', 'Status:']] },
- { name: 'all-commands', scenario: 'workspace', steps: menu('All commands') },
- { name: 'machines', scenario: 'workspace', steps: menu('Machines') },
- { name: 'settings', scenario: 'workspace', steps: menu('Settings') },
+ { name: 'machines', scenario: 'workspace', steps: picker('@') },
+ { name: 'settings', scenario: 'workspace', steps: account('Settings') },
// Group 1's own: what New Swarm opens, and the phone tab menu's Rename Tab… dialog.
{ name: 'new-swarm', scenario: 'workspace', steps: menu('New Swarm') },
// The same Swarm by its key, for comparison with the menu's.
diff --git a/desktop/tool/web_ux/flows/search.mjs b/desktop/tool/web_ux/flows/search.mjs
index ae04fb138..f20387d9a 100644
--- a/desktop/tool/web_ux/flows/search.mjs
+++ b/desktop/tool/web_ux/flows/search.mjs
@@ -4,9 +4,9 @@
//
// Fix group: phone search drill-down. Each group keeps its flows here, so parallel groups never
// edit the same file; load-flows.mjs reads every file in this folder.
-import { menu } from './steps.mjs';
+import { picker } from './steps.mjs';
-const machines = menu('Machines');
+const machines = picker('@');
export const FLOWS = [
{ name: 'search-machines', scenario: 'workspace', steps: machines },
diff --git a/desktop/tool/web_ux/flows/steps.mjs b/desktop/tool/web_ux/flows/steps.mjs
index 93ec6618e..e988f7778 100644
--- a/desktop/tool/web_ux/flows/steps.mjs
+++ b/desktop/tool/web_ux/flows/steps.mjs
@@ -1,11 +1,17 @@
// Click paths more than one flow file uses.
-/// ☰ then a row of the web app menu.
-export const menu = (row) => [['exact', 'Menu'], ['exact', row]];
+/// + then a row of the web's New menu.
+export const menu = (row) => [['exact', 'New'], ['exact', row]];
-/// One Settings section, opened from the app menu: flow `settings-<section>`.
+/// The avatar then a row of its account menu.
+export const account = (row) => [['exact', 'Account'], ['exact', row]];
+
+/// A mode of the search box, at every width: `@` machines, `:` models.
+export const picker = (prefix) => [['exact', 'Open Harness'], ['key', prefix]];
+
+/// One Settings section, opened from the account menu: flow `settings-<section>`.
export const settings = (section) => ({
name: `settings-${section.toLowerCase().replace(/ /g, '-')}`,
scenario: 'workspace',
- steps: [...menu('Settings'), ['exact', section]],
+ steps: [...account('Settings'), ['exact', section]],
});
diff --git a/desktop/tool/web_ux/flows/store.mjs b/desktop/tool/web_ux/flows/store.mjs
index 08c2e93d6..6b2e03e46 100644
--- a/desktop/tool/web_ux/flows/store.mjs
+++ b/desktop/tool/web_ux/flows/store.mjs
@@ -4,7 +4,7 @@
// edit the same file; load-flows.mjs reads every file in this folder.
const toStore = {
wide: [['exact', 'Harness Store']],
- compact: [['exact', 'Menu'], ['exact', 'Store']],
+ compact: [['exact', 'New'], ['exact', 'Store']],
};
const claude = ['text', 'Work with Claude directly'];
// The rail's entry on a computer and a tablet, its chip on a phone.