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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
desktop: one dropdown, pane drag and pane modes across the app (#2947)
lingrdad1de26c5159
diff --git a/desktop/design/web-ux-audit/README.md b/desktop/design/web-ux-audit/README.mdindex f61d070c1..248dd6a10 100644--- a/desktop/design/web-ux-audit/README.md+++ b/desktop/design/web-ux-audit/README.md@@ -206,7 +206,7 @@ Each is switched off in code; the line is given so the claim can be checked.| Account avatar menu | `lib/screens/swarm_screen.dart:3268`: `_accountControlShown => app.viewer == null`; the web app menu carries the email and Sign out instead || Finder | `lib/finder/finder_availability.dart:12`: `canOpenFinderOn` needs `!kViewerMode` || Settings ▸ Connectors | `lib/settings/settings_section.dart:110`: hidden when `kIsWeb` |-| In-window menu bar, Export logs, About dialog | Linux/Windows menu bar and the native menu only (`lib/app_shell.dart` `runAppMenuAction`); Settings ▸ Debug hides Export on web (`settings/sections/debug_toolbar.dart:35`) |+| In-window menu bar, Export logs, About dialog | Linux menu strip, the Windows tab-strip menu and the native menu only (`lib/app_shell.dart` `runAppMenuAction`); Settings ▸ Debug hides Export on web (`settings/sections/debug_toolbar.dart:35`) |## Findingsdiff --git a/desktop/design/windows-app-menu.md b/desktop/design/windows-app-menu.mdnew file mode 100644index 000000000..e68e0461b--- /dev/null+++ b/desktop/design/windows-app-menu.md@@ -0,0 +1,105 @@+# Windows app menu++Status: implemented with the tab-strip app menu; custom caption deferred.++## The problem++A Windows window drew two bars stacked: the OS caption (minimise, maximise, close)+and, under it, a 36px strip of menus — **Harness, File, Edit, View, History,+Window, Help** — that `widgets/in_window_menu_bar.dart` draws. The strip exists+because macOS hands its commands to AppKit's menu bar and Linux has no menu bar+either, so the same widget serves Linux and Windows.++Two stacked bars is the legacy Win32 shape. It is what Visual Studio and old MFC+tools do, and almost nothing shipped in the last decade does it:++| Pattern | How it looks | Examples |+| --- | --- | --- |+| Classic caption + menu bar | caption, then a File/Edit/View row | Visual Studio, old Win32 tools |+| Caption + command bar/ribbon | caption, then one commands row | File Explorer, Office |+| Extended title bar, **system caption buttons** | app content in the caption row; DWM draws min/max/close | Windows Terminal, Settings, Notepad, Photos, Outlook |+| Fully custom caption | app draws its own buttons | Chrome, Edge, VS Code, Slack, Discord, Spotify (Electron `titleBarOverlay`), Figma |++Modern Windows apps keep **one** row for window-level things (tabs, title, search,+account) and put the command list behind a button or a command palette:+Chrome's ⋮, VS Code's ☰ plus its palette, Slack's ☰, Windows Terminal's tabs in+the title bar. A menu row of its own under the caption is the thing this change+removes.++## What we do++Windows keeps its **native caption** — snapped windows, eight-way resize,+Alt+Space, DPI, accessibility and Snap Layouts stay the OS's job — and the strip+is gone. Its commands open from one **☰ at the left of the workspace tab strip**,+which is the row the window's own controls already sit in (search,+notifications, Store, account at the right).++- The slot is **at least 32px** — the button's own 8 + 16 + 8 — because two+ cells of the 13px bar font are 14–16px on Windows and a narrower slot does not+ overflow, it squashes the ☰ silently (10px in a 26px slot, 0 at 16). The tab+ budget comes down by exactly that.+- The button keeps the design system's **32-point target for icon-only+ controls** (`32 x 32`): the drawn box is the hit area, not a 28px control with+ dead rows either side of the glyph.+- The panel keeps **menuGap 6** from the button like every other menu in the+ app, ends with its last row rather than a rule, and sizes its maximum height+ from the **40px tab strip** it opens from (`Hwin − 40 − 24`).+- Section names are **sentence case** at caption size, the way Windows 11's own+ menus, Slack and Figma label a group; caps read as a settings list.+- Screens before the workspace — sign-in, setup, the welcome tour — have no tab+ strip, so on Windows they keep the strip (the shell mounts it whenever the+ workspace is not on screen, and never as an invisible ghost in it).+- One panel, grouped in the same seven sections in the same order and with the+ same rows as the strip, so nothing becomes unreachable: About, Settings,+ Update, Export Logs, Quick Start, New Tab, Close Tab, Edit's clipboard rows,+ Layout, font sizes, full screen, notifications, machines, models, monitor,+ viewer/composer toggles, history, window rows, Help.+- The rows are **the same widgets** the strip uses: same enabled/disabled+ gating from `SwarmMenuState`, same accelerator hints beside a row, same Edit+ targeting of the focused field or terminal, and View still reads full-screen+ state when the panel opens.+- Keyboard is unchanged: every action keeps the shortcut the keymap gives it+ (that is the point of the hints), so the button is a discovery surface, not the+ only way in.+- macOS is untouched: its commands stay in AppKit's menu bar. Linux is+ untouched: it keeps the strip, because on GNOME that strip *is* the title bar.++## Not doing (yet)++A custom title bar (the "tabs in the caption row" look of Windows Terminal) is+deferred. `window_manager` 0.5.2 does not hide a Windows caption —+`SetTitleBarStyle` only zeroes the DWM frame margins there — so it needs runner+work (`WM_NCCALCSIZE`, hit-testing for drag and eight-way resize, `HTMAXBUTTON`+so Snap Layouts still opens, Alt+Space, DPI, UIA names). That is its own spec and+its own test matrix on Windows 10/11 x64 and arm64; the menu change above is the+visible win without that risk.++## Design notes++- **Reachability:** the compact panel is built from the strip's own+ `_build*Menu()` methods — one source of rows, not a second list to drift.+- **Identity of the dispatcher:** the tab strip is built by the workspace screen,+ which has no handle on the shell's action switch. The shell installs it in+ `appMenuActionSink` at startup (the same seam shape as `swarmMenuBus`), and the+ compact bar falls back to it when no handler is passed. Rows that talk to the+ swarm bus keep dispatching through `swarmMenuBus`, as the strip did.+- **Where the strip went:** `InWindowMenuBar`'s default visibility is now Linux+ only. `visible:` remains as the test seam it already was.+- **Tests on other hosts:** the button is gated by `RuntimePlatform.isWindows`,+ which a widget test cannot fake, so the screen takes `appMenuButton:` the way+ it already takes `chrome:`; the compact widget itself is exercised directly.+- **Failure:** nothing in the panel is new behaviour — every row is the row the+ strip drew. If the shell's sink were missing, the button would open a panel+ whose app rows do nothing; the swarm rows would still work and every shortcut+ still fires. The sink is installed in `initState` before the first frame.++## Validation++- `flutter analyze`.+- `desktop/test/in_window_menu_bar_test.dart` (strip, unchanged) and the new+ compact-mode tests: button renders, panel opens, all seven sections appear, a+ row dispatches its action, Escape and a second press close it.+- `desktop/test/windows_app_menu_test.dart`.+- On a real Windows machine: the strip is gone, one ☰ sits in the tab row, every+ section opens, and `File ▸ New Tab`, `Edit ▸ Copy` and `View ▸ Enter Full+ Screen` still act.diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dartindex fd7c50f54..3b53606ff 100644--- a/desktop/lib/app_shell.dart+++ b/desktop/lib/app_shell.dart@@ -148,10 +148,11 @@ class HarnessApp extends StatelessWidget {// 2026-09-16). It never appears in a release build whatever this says.// A preview capture that wants a clean corner passes// `--dart-define=HARNESS_CLEAN_PREVIEW=true` instead of turning it off- // for everyone.- debugShowCheckedModeBanner: !const bool.fromEnvironment(- 'HARNESS_CLEAN_PREVIEW',- ),+ // for everyone. Not on Windows, where the corner it covers is the window's+ // close button.+ debugShowCheckedModeBanner:+ !RuntimePlatform.isWindows &&+ !const bool.fromEnvironment('HARNESS_CLEAN_PREVIEW'),// The design system's own `buildAppTheme` — see the note where a second,// hand-written `ThemeData` used to shadow it, in `lib/theme/app_theme.dart`.// The chosen palette owns the appearance; platform text scaling remains@@ -284,6 +285,10 @@ class _RootShellState extends ConsumerState<RootShell>if (kIsWeb) _sharedLocation = SharedAgentLocation.parse(Uri.base);WidgetsBinding.instance.addObserver(this);_appMenuChannel.setMethodCallHandler(_onAppMenu);+ // The Windows tab strip's ☰ is built below this shell, so it dispatches+ // through the sink instead of a callback threaded through three+ // constructors (desktop/design/windows-app-menu.md).+ appMenuActionSink = runAppMenuAction;// Available from startup, including sign-in and setup.if (RuntimePlatform.isWindows && !kUnderTest) windowsStatusTray.install();}@@ -293,6 +298,7 @@ class _RootShellState extends ConsumerState<RootShell>flushAppLog();WidgetsBinding.instance.removeObserver(this);_appMenuChannel.setMethodCallHandler(null);+ appMenuActionSink = null;super.dispose();}@@ -485,10 +491,14 @@ class _RootShellState extends ConsumerState<RootShell>final deviceBands = home && shared == null;return Column(children: [- // The app's commands as a menu strip (Linux and Windows; macOS- // carries them in its native menu bar, and this renders nothing- // there).- InWindowMenuBar(onAction: runAppMenuAction),+ // The app's commands as a menu strip. Linux always (on GNOME it+ // is the title bar); macOS carries them in its native menu bar and+ // renders nothing. Windows draws a ☰ in the workspace tab strip+ // instead, but the screens before it — sign-in, setup, the tour —+ // have no tab strip, so they keep the strip until the workspace is+ // up.+ if (!RuntimePlatform.isWindows || !home)+ InWindowMenuBar(onAction: runAppMenuAction),if (app.hasAvailableUpdate &&!touring &&!signInStep &&diff --git a/desktop/lib/core/desktop_window.dart b/desktop/lib/core/desktop_window.dartindex a8240b4c3..f0111db8b 100644--- a/desktop/lib/core/desktop_window.dart+++ b/desktop/lib/core/desktop_window.dart@@ -18,8 +18,12 @@ bool get hasManagedWindow =>/// Configures the native window before the first Flutter frame.////// On macOS, AppKit places Swarm tabs beside the system traffic lights in a-/// compact unified title bar. Flutter starts below that row. Windows and Linux-/// keep their native caption bar and use the Flutter Swarm-tab fallback.+/// compact unified title bar. Flutter starts below that row. On Windows the+/// system caption is hidden: the workspace tab strip is the title row, with the+/// window's minimise, restore and close buttons at its end and the empty space+/// dragging the window (`widgets/window_chrome.dart`,+/// `desktop/design/windows-app-menu.md`). Linux keeps its native caption and+/// the Flutter Swarm-tab fallback.Future<void> configureDesktopWindow({HarnessPalette palette = HarnessPalette.graphite,}) async {@@ -30,7 +34,12 @@ Future<void> configureDesktopWindow({minimumSize: const Size(880, 560),title: desktopAppName,center: true,- titleBarStyle: TitleBarStyle.normal,+ // Windows: no system caption. window_manager keeps the resize border and+ // the windows 11 maximised inset through WM_NCCALCSIZE; the app draws the+ // caption row itself.+ titleBarStyle: RuntimePlatform.isWindows+ ? TitleBarStyle.hidden+ : TitleBarStyle.normal,);// The plugin's optional callback is a VoidCallback: an async callback would// return before native setup finishes and detach any error from this future.@@ -43,8 +52,11 @@ Future<void> configureDesktopWindow({// Always open filling the screen (owner, 2026-09-15): the tabs, a viewer// beside its terminal and the rail all want the width. The options above// stay the frame the green button returns to.- await windowManager.maximize();+ //+ // Maximise AFTER show: a maximise asked of a window that has not been shown+ // is dropped on Windows, which left the app opening at the 1280x800 default.await windowManager.show();+ await windowManager.maximize();await windowManager.focus();}diff --git a/desktop/lib/devices/devices_screen.dart b/desktop/lib/devices/devices_screen.dartindex 2cd5065be..89ad99129 100644--- a/desktop/lib/devices/devices_screen.dart+++ b/desktop/lib/devices/devices_screen.dart@@ -75,6 +75,9 @@ class _DevicesTabState extends State<DevicesTab> {showCompanion: widget.notifier.experimentalFeatures.enabled(ExperimentalFeature.focusBarCreature,),+ // Under a Swarm's Manage, whose own title and tabs already say where this+ // is.+ underManage: widget.notifier.activeSwarm.isSuperTab,onRefresh: () async {await Future.wait([widget.notifier.refreshDevices(), wifi.refresh()]);},@@ -88,6 +91,7 @@ class DevicesScreen extends StatefulWidget {required this.controller,this.wifi,this.showCompanion = false,+ this.underManage = false,this.openShop,this.onRefresh,this.pickPetFile,@@ -101,6 +105,10 @@ class DevicesScreen extends StatefulWidget {/// Whether the desktop companion is on (Experimental), for the rows that follow it.final bool showCompanion;++ /// Drawn under Manage's title and tabs: no second title, and on the page's+ /// content edge.+ final bool underManage;final Future<bool> Function(Uri)? openShop;final Future<void> Function()? onRefresh;@@ -350,27 +358,20 @@ class _DevicesScreenState extends State<DevicesScreen> {),);if (widget.wifi == null) return button;- return MenuAnchor(+ return AppDropdown(controller: _addMenu,- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(),- menuChildren: [+ children: [AppMenuItem(key: const Key('devices-add-usb'),label: 'USB cable',- onPressed: () {- _addMenu.close();- unawaited(_setup());- },+ leadingSlot: false,+ onPressed: () => unawaited(_setup()),),AppMenuItem(key: const Key('devices-add-wifi'),label: 'Wi-Fi code',- onPressed: () {- _addMenu.close();- unawaited(_pairWifi());- },+ leadingSlot: false,+ onPressed: () => unawaited(_pairWifi()),),],child: button,@@ -390,7 +391,7 @@ class _DevicesScreenState extends State<DevicesScreen> {Widget build(BuildContext context) {grid.AppTheme.watch(context);return ColoredBox(- color: grid.AppPalette.windowBg,+ color: grid.AppPalette.swarmWelcome,child: ListenableBuilder(listenable: widget.controller,builder: (context, _) => LayoutBuilder(@@ -412,11 +413,20 @@ class _DevicesScreenState extends State<DevicesScreen> {devices.firstOrNull;_selectedKey = selected?.key;final pet = _petFor(selected);- final pad = bounds.maxWidth < 640 ? 20.0 : 40.0;+ final pad = widget.underManage+ ? grid.AppDesktop.panelPadding+ : bounds.maxWidth < 640+ ? 20.0+ : 40.0;return SingleChildScrollView(key: const PageStorageKey('devices-page'),controller: _page,- padding: EdgeInsets.fromLTRB(pad, 36, pad, 40),+ padding: EdgeInsets.fromLTRB(+ pad,+ widget.underManage ? grid.AppDesktop.groupGap : 36,+ pad,+ 40,+ ),child: Center(child: ConstrainedBox(constraints: const BoxConstraints(maxWidth: 1120),@@ -429,19 +439,27 @@ class _DevicesScreenState extends State<DevicesScreen> {spacing: 24,runSpacing: 18,children: [- Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text('Devices', style: grid.AppType.display()),- const SizedBox(height: 7),- Text(- 'All your devices. Across your computers.',- style: DesktopChrome.text(- color: DesktopChrome.muted,- ),+ if (widget.underManage)+ Text(+ 'All your devices. Across your computers.',+ style: DesktopChrome.text(+ color: DesktopChrome.muted,),- ],- ),+ )+ else+ Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text('Devices', style: grid.AppType.display()),+ const SizedBox(height: 7),+ Text(+ 'All your devices. Across your computers.',+ style: DesktopChrome.text(+ color: DesktopChrome.muted,+ ),+ ),+ ],+ ),Wrap(spacing: 10,runSpacing: 10,diff --git a/desktop/lib/finder/widgets/finder_context_menu.dart b/desktop/lib/finder/widgets/finder_context_menu.dartindex 0c47568bd..c3646ca13 100644--- a/desktop/lib/finder/widgets/finder_context_menu.dart+++ b/desktop/lib/finder/widgets/finder_context_menu.dart@@ -1,5 +1,7 @@import 'package:flutter/material.dart';+import '../../shared/widgets/app_menu.dart';+/// A right-click menu for a row of the tree or the Changes list, drawn by/// the app's own menu theme (`AppMenuItem` rows).class FinderContextMenu extends StatefulWidget {@@ -22,9 +24,11 @@ class _FinderContextMenuState extends State<FinderContextMenu> {List<Widget> _items = const [];@override- Widget build(BuildContext context) => MenuAnchor(+ Widget build(BuildContext context) => AppDropdown(controller: _menu,- menuChildren: _items,+ consumeOutsideTap: false,+ alignmentOffset: Offset.zero,+ children: _items,child: GestureDetector(onSecondaryTapDown: (details) {setState(() => _items = widget.items());diff --git a/desktop/lib/models/api_connections_panel.dart b/desktop/lib/models/api_connections_panel.dartindex abe435dff..6be7effec 100644--- a/desktop/lib/models/api_connections_panel.dart+++ b/desktop/lib/models/api_connections_panel.dart@@ -509,7 +509,7 @@ class _ApiEditorState extends State<_ApiEditor> {labelText: label,hintText: hint,labelStyle: AppType.caption(color: AppPalette.textSecondary),- hintStyle: AppType.body(color: AppPalette.textFaint),+ hintStyle: AppType.monoLabel(color: AppPalette.textFaint),filled: true,fillColor: AppPalette.windowBg,suffixIcon: secretdiff --git a/desktop/lib/models/models_panel.dart b/desktop/lib/models/models_panel.dartindex 2e178a989..1332a6d84 100644--- a/desktop/lib/models/models_panel.dart+++ b/desktop/lib/models/models_panel.dart@@ -235,10 +235,7 @@ class _ModelsPanelState extends State<ModelsPanel> with SectionWakes {borderRadius: BorderRadius.circular(AppDesktop.fieldRadius,),- borderSide: BorderSide(- color: AppDesktop.focus,- width: AppDesktop.focusWidth,- ),+ borderSide: BorderSide.none,),),onChanged: (_) => setState(() {}),diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 2043bdd28..488ddc0ba 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -66,7 +66,11 @@ import '../state/app_state.dart';import '../state/notification_inbox.dart';import '../state/status_menu.dart';import '../widgets/in_window_menu_bar.dart'- show LinuxTitleBar, linuxTitleBarActions;+ show+ InWindowMenuBar,+ LinuxTitleBar,+ appMenuButtonWidth,+ linuxTitleBarActions;import '../widgets/account_menu.dart';import '../widgets/account_profile_sheet.dart';import '../widgets/notification_inbox.dart';@@ -141,6 +145,7 @@ import '../widgets/new_agent_dialog.dart';import '../widgets/box_chrome.dart';import '../widgets/new_harness_form.dart';import '../widgets/desktop_chrome.dart';+import '../widgets/window_chrome.dart';import '../widgets/account_device_history.dart';import '../widgets/desktop_search_panel.dart';import '../widgets/machine_picker_extras.dart';@@ -208,6 +213,7 @@ class SwarmScreen extends StatefulWidget {this.experimentalFeatures,this.chrome,this.statusTray,+ this.appMenuButton,});final AppNotifier notifier;final bool? nativeTabs;@@ -234,6 +240,12 @@ class SwarmScreen extends StatefulWidget {/// Extra tab-bar controls from a host composition (the web build's menu).final WorkspaceChrome? chrome;+ /// Draws the compact app menu at the strip's left. Defaults to following the+ /// host: Windows, where the menu strip above the workspace is gone+ /// (desktop/design/windows-app-menu.md). A test seam, like [chrome], because+ /// a widget test cannot make \`RuntimePlatform.isWindows\` true.+ final bool? appMenuButton;+/// The Windows tray (`harness/status_menu`): the macOS status menu's rows,/// fed from the same payload. A test passes its own; null off Windows.final WindowsStatusTray? statusTray;@@ -266,6 +278,18 @@ class _SwarmScreenState extends State<SwarmScreen> {? SwarmMenuBus.forChannel(): swarmMenuBus;+ /// Whether the strip draws the compact app menu's ☰: Windows, where no menu+ /// row sits above the workspace, or a test that asked for it.+ bool get _appMenuButton =>+ widget.appMenuButton ??+ (RuntimePlatform.isWindows && !kIsWeb && !kUnderTest);++ /// Whether this host hides the system caption and lets the tab strip be the+ /// title row (Windows). The window's own buttons join the strip's end, and+ /// its empty space drags the window (`widgets/window_chrome.dart`).+ bool get _windowsCaption =>+ RuntimePlatform.isWindows && !kIsWeb && !kUnderTest;+/// The tab the middle button went down on, so an up that slid onto another/// tab closes nothing. Null between presses.String? _middleDownTab;@@ -8430,10 +8454,10 @@ class _SwarmScreenState extends State<SwarmScreen> {app.panes.isEmpty ||app.activeSwarm.isSuperTab? EdgeInsets.zero- : const EdgeInsets.fromLTRB(- kWorkspaceInset,- kWorkspaceInset,- kWorkspaceInset,+ : EdgeInsets.fromLTRB(+ kPaneInset,+ kPaneInset,+ kPaneInset,0,),child: SuperTabWorkspace(@@ -8759,9 +8783,13 @@ class _SwarmScreenState extends State<SwarmScreen> {// Include the pane's former bottom gutter in this row, so its controls sit// halfway between the pane edge and window bottom. Pane height is unchanged.// Keep inventory controls discoverable on the first, empty welcome screen.+ // Windows draws the row at its controls' own height: the extra gutter left+ // ~10pt of empty band above and below one line of text there (owner,+ // 2026-11-03), and its caption row is already the app's only other bar.double get _statusBarHeight => app.activeSwarm.isSuperTab? 0- : workspaceBarControlHeight(context) + kWorkspaceInset;+ : workspaceBarControlHeight(context) ++ (_windowsCaption ? 0 : kWorkspaceInset);Widget _statusBar() {final compactFooter = widget.chrome?.compactFooter;@@ -9130,16 +9158,30 @@ class _SwarmScreenState extends State<SwarmScreen> {// Sign in or the avatar always stays; see [_accountControl]. Search and// notifications beside it; none of it here when the title bar holds them.final accountWidth = _accountControlWidth(context);+ // Windows has search and no bell ([_windowsCaption]).final actionsWidth = _titleBarActions? 0.0- : cell.width * 8 + accountWidth;+ : cell.width * (_windowsCaption ? 4 : 8) + accountWidth;+ // The app menu's ☰, where the host keeps no menu row above the+ // workspace: it comes out of the tabs' budget like any other control.+ // The button is 8 + 16 + 8 wide of its own, and two cells of the bar+ // font are less than that on Windows — a narrower slot silently squashes+ // the glyph (10px at 26, 0px at 16), so the slot never drops below it.+ final menuWidth = _appMenuButton+ ? math.max(cell.width * 2, appMenuButtonWidth)+ : 0.0;final tabBudget = math.max(0.0,constraints.maxWidth -cell.width * 5 -- grid.AppDesktop.tabBarTrailingInset -+ // The strip's end: the window's own buttons on Windows. Left out of+ // the sum, enough tabs pushed them off the window.+ (_windowsCaption+ ? 3 * WindowCaptionButtons.buttonWidth+ : grid.AppDesktop.tabBarTrailingInset) -actionsWidth -- (_slotShown ? 44 : 0),+ (_slotShown ? 44 : 0) -+ menuWidth,);_tabWidths = List.filled(labels.length,@@ -9154,39 +9196,58 @@ class _SwarmScreenState extends State<SwarmScreen> {(arrows ? cell.width * kWorkspaceTabArrowCells * 2 : 0),);_revealSelectedTab(tabsWidth);+ final barHeight = math.max(+ _tabBarHeight,+ MediaQuery.textScalerOf(context).scale(13) * 1.25 + 20,+ );return Material(key: const ValueKey('workspace-tab-bar'),color: grid.AppPalette.swarmTabBar,child: SizedBox(- height: math.max(- _tabBarHeight,- MediaQuery.textScalerOf(context).scale(13) * 1.25 + 20,- ),- child: Row(+ height: barHeight,+ child: Stack(+ fit: StackFit.expand,children: [- SizedBox(width: cell.width),- _withTabArrows(- arrows,- color: theme.foreground,- child: SizedBox(- width: tabsWidth,- child: ReorderableListView.builder(- scrollController: _tabScroll,- itemExtentBuilder: (index, _) => _tabWidths[index],- scrollDirection: Axis.horizontal,- shrinkWrap: true,- buildDefaultDragHandles: false,- itemCount: shown.length,- onReorderItem: (old, to) =>- app.reorderSwarm(shown[old].id, to),- itemBuilder: (context, index) {- final swarm = shown[index];- final selected = app.activeSwarmId == swarm.id;- final activity = activities[index];- final tags = tabWaiting(app, swarm);- // A status cell animates only while its tab is in view.- Widget tabStatus(Widget Function(bool visible) mark) =>- ListenableBuilder(+ // Windows hides the system caption, so this row IS the caption:+ // the space between controls drags the window and a double-click+ // restores it. Behind the row, never around it, so no button+ // waits on the double-tap arena.+ if (_windowsCaption)+ const Positioned.fill(child: WindowCaptionDragArea()),+ Row(+ children: [+ SizedBox(width: cell.width),+ if (_appMenuButton)+ SizedBox(+ width: menuWidth,+ child: const Align(+ alignment: Alignment.centerLeft,+ child: InWindowMenuBar(compact: true),+ ),+ ),+ _withTabArrows(+ arrows,+ color: theme.foreground,+ child: SizedBox(+ width: tabsWidth,+ child: ReorderableListView.builder(+ scrollController: _tabScroll,+ itemExtentBuilder: (index, _) => _tabWidths[index],+ scrollDirection: Axis.horizontal,+ shrinkWrap: true,+ buildDefaultDragHandles: false,+ itemCount: shown.length,+ onReorderItem: (old, to) =>+ app.reorderSwarm(shown[old].id, to),+ itemBuilder: (context, index) {+ final swarm = shown[index];+ final selected = app.activeSwarmId == swarm.id;+ final activity = activities[index];+ final tags = tabWaiting(app, swarm);+ // A status cell animates only while its tab is in view.+ Widget tabStatus(+ Widget Function(bool visible) mark,+ ) => ListenableBuilder(listenable: _tabScroll,builder: (context, _) {final left = _tabWidths@@ -9201,175 +9262,196 @@ class _SwarmScreenState extends State<SwarmScreen> {);},);- return ReorderableDragStartListener(- key: ValueKey(swarm.id),- index: index,- child: Listener(- onPointerDown: (event) {- _middleDownTab = event.buttons == kTertiaryButton- ? swarm.id- : null;- },- onPointerUp: (event) {- final armed = _middleDownTab;- _middleDownTab = null;- if (armed == swarm.id) {- unawaited(app.requestCloseSwarm(swarm.id));- }- },- child: Builder(- builder: (context) {- final nameHint = workspaceTabTooltip(- labels[index],- swarm.name,- clipped:- DesktopWorkspaceTab.naturalWidth(- context,- labels[index],- shortcutHint: _keymap.hint(- 'swarm.select_${index + 1}',- ),- hasActivity: activity != null,- sharedCount: shares[index].count,- ) >- _tabWidths[index],- );- final share = shares[index];- final tabHint = [- ?nameHint,- if (share.count case final count?)- 'Shared tab, $count '- '${count == 1 ? 'harness' : 'harnesses'}',- ?activity?.label,- ].join('\n');- final menus = _shortcutsEnabled;- return DesktopWorkspaceTab(- id: swarm.id,- showShortcuts: _tabShortcutHints,- shortcutHint: _keymap.hint(- 'swarm.select_${index + 1}',- ),- onRename: () => _rename(swarm.id),- onPauseNewWork:- menus &&+ return ReorderableDragStartListener(+ key: ValueKey(swarm.id),+ index: index,+ child: Listener(+ onPointerDown: (event) {+ _middleDownTab =+ event.buttons == kTertiaryButton+ ? swarm.id+ : null;+ },+ onPointerUp: (event) {+ final armed = _middleDownTab;+ _middleDownTab = null;+ if (armed == swarm.id) {+ unawaited(app.requestCloseSwarm(swarm.id));+ }+ },+ child: Builder(+ builder: (context) {+ final nameHint = workspaceTabTooltip(+ labels[index],+ swarm.name,+ clipped:+ DesktopWorkspaceTab.naturalWidth(+ context,+ labels[index],+ shortcutHint: _keymap.hint(+ 'swarm.select_${index + 1}',+ ),+ hasActivity: activity != null,+ sharedCount: shares[index].count,+ ) >+ _tabWidths[index],+ );+ final share = shares[index];+ final tabHint = [+ ?nameHint,+ if (share.count case final count?)+ 'Shared tab, $count '+ '${count == 1 ? 'harness' : 'harnesses'}',+ ?activity?.label,+ ].join('\n');+ final menus = _shortcutsEnabled;+ return DesktopWorkspaceTab(+ id: swarm.id,+ showShortcuts: _tabShortcutHints,+ shortcutHint: _keymap.hint(+ 'swarm.select_${index + 1}',+ ),+ onRename: () => _rename(swarm.id),+ onPauseNewWork:+ menus &&+ swarm.superTabId != null &&+ app.superTabs+ .peek(swarm.superTabId!)+ ?.canWrite ==+ true+ ? () => unawaited(+ _pauseSuperTab(swarm.id),+ )+ : null,+ newWorkPaused:swarm.superTabId != null &&app.superTabs.peek(swarm.superTabId!)- ?.canWrite ==- true- ? () => unawaited(_pauseSuperTab(swarm.id))- : null,- newWorkPaused:- swarm.superTabId != null &&- app.superTabs- .peek(swarm.superTabId!)- ?.snapshot- ?.paused ==- true,- label: labels[index],- selected: selected,- tooltip: tabHint.isEmpty ? null : tabHint,- activityLabel:- tabWaitingLabel(app, swarm) ??- activity?.label,- sharedCount: share.count,- onInvitePeople: menus && share.invite- ? () => unawaited(_invitePeople(swarm.id))- : null,- onShowAgentMessages:- menus && app.agentMessagesOffered(swarm.id)- ? () => unawaited(- _showAgentMessages(swarm.id),- )- : null,- onStopSharing: menus && share.stop- ? () => unawaited(_stopSharingTab(swarm.id))- : null,- onMoveHere: menus && share.moveHere- ? () => unawaited(_moveTabHere(swarm.id))- : null,- onLeave: menus && share.leave- ? () => unawaited(_leaveTab(swarm.id))- : null,- onSelect: _shortcutsEnabled- ? () => app.selectSwarm(swarm.id)- : null,- onClose: _shortcutsEnabled- ? () => unawaited(- app.requestCloseSwarm(swarm.id),- )- : null,- attention: tags > 0,- // A Swarm's tab is its name alone (Quiet Swarm, screen 0).- activity:- swarm.isSuperTab ||- activity == null ||- activity.mark.isEmpty- ? null- : tabStatus(- (visible) => ActivityMark(- key: ValueKey(- 'tab-activity:${swarm.id}',- ),- activity: activity,- color: activityColor(- activity,- theme,- color: prefs.color,+ ?.snapshot+ ?.paused ==+ true,+ label: labels[index],+ selected: selected,+ tooltip: tabHint.isEmpty ? null : tabHint,+ activityLabel:+ tabWaitingLabel(app, swarm) ??+ activity?.label,+ sharedCount: share.count,+ onInvitePeople: menus && share.invite+ ? () =>+ unawaited(_invitePeople(swarm.id))+ : null,+ onShowAgentMessages:+ menus &&+ app.agentMessagesOffered(swarm.id)+ ? () => unawaited(+ _showAgentMessages(swarm.id),+ )+ : null,+ onStopSharing: menus && share.stop+ ? () => unawaited(+ _stopSharingTab(swarm.id),+ )+ : null,+ onMoveHere: menus && share.moveHere+ ? () =>+ unawaited(_moveTabHere(swarm.id))+ : null,+ onLeave: menus && share.leave+ ? () => unawaited(_leaveTab(swarm.id))+ : null,+ onSelect: _shortcutsEnabled+ ? () => app.selectSwarm(swarm.id)+ : null,+ onClose: _shortcutsEnabled+ ? () => unawaited(+ app.requestCloseSwarm(swarm.id),+ )+ : null,+ attention: tags > 0,+ // A Swarm's tab is its name alone (Quiet Swarm, screen 0).+ activity:+ swarm.isSuperTab ||+ activity == null ||+ activity.mark.isEmpty+ ? null+ : tabStatus(+ (visible) => ActivityMark(+ key: ValueKey(+ 'tab-activity:${swarm.id}',+ ),+ activity: activity,+ color: activityColor(+ activity,+ theme,+ color: prefs.color,+ ),+ emphasized: selected,+ tooltip: false,+ visible: visible,+ ),),- emphasized: selected,- tooltip: false,- visible: visible,- ),- ),- );- },- ),- ),- );- },- ),- ),- ),- 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,- builder: (context, _) {- final label = _tabActivity.isOpen(app.activeSwarmId)- ? 'Hide Tab Activity'- : 'Show Tab Activity';- return _statusToolIcon(- 'tab-activity',- label,- _toggleTabActivity,- AppIcons.panelLeft,- Size(cell.width * 3, toolHeight),- theme,- tooltip: _commandTooltip(- label,- 'agent_messages.activity',+ 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'),),- );- },- ),- const Spacer(),- if (!_titleBarActions) ...[- _searchButton(theme),- _notificationsButton(theme),- ..._accountControl(),- ],- if (kIsWeb && _slotShown) _daemonTabButton(),- const SizedBox(width: grid.AppDesktop.tabBarTrailingInset),+ if (_tabActivityOffered)+ ListenableBuilder(+ listenable: _tabActivity,+ builder: (context, _) {+ final label = _tabActivity.isOpen(app.activeSwarmId)+ ? 'Hide Tab Activity'+ : 'Show Tab Activity';+ return _statusToolIcon(+ 'tab-activity',+ label,+ _toggleTabActivity,+ AppIcons.panelLeft,+ Size(cell.width * 3, toolHeight),+ theme,+ tooltip: _commandTooltip(+ label,+ 'agent_messages.activity',+ ),+ );+ },+ ),+ const Spacer(),+ if (!_titleBarActions) ...[+ // Windows' title row ends with search and the account against+ // the window's own buttons, and no bell: the sidebar's Activity+ // row is the way to notifications there, and a second way in+ // the caption was one icon too many (owner, 2026-11-03). Every+ // other host keeps the strip's own order, search first.+ if (!_windowsCaption) ...[+ _searchButton(theme),+ _notificationsButton(theme),+ ],+ if (_windowsCaption) _searchButton(theme),+ ..._accountControl(),+ ],+ if (kIsWeb && _slotShown) _daemonTabButton(),+ if (_windowsCaption)+ WindowCaptionButtons(height: barHeight)+ else+ const SizedBox(width: grid.AppDesktop.tabBarTrailingInset),+ ],+ ),],),),diff --git a/desktop/lib/settings/appearance/palette_section.dart b/desktop/lib/settings/appearance/palette_section.dartindex 41be81cd6..b08547276 100644--- a/desktop/lib/settings/appearance/palette_section.dart+++ b/desktop/lib/settings/appearance/palette_section.dart@@ -90,9 +90,7 @@ class _PaletteChoice extends StatelessWidget {),side: WidgetStateProperty.resolveWith((states) => BorderSide(- color: states.contains(WidgetState.focused)- ? palette.foreground- : selected+ color: selected? palette.accent: MediaQuery.highContrastOf(context)? palette.foreground.withValues(alpha: .6)diff --git a/desktop/lib/settings/appearance/wallpaper_section.dart b/desktop/lib/settings/appearance/wallpaper_section.dartindex 4ee78eabc..6c54b92fc 100644--- a/desktop/lib/settings/appearance/wallpaper_section.dart+++ b/desktop/lib/settings/appearance/wallpaper_section.dart@@ -140,9 +140,7 @@ class _BackgroundCard extends StatelessWidget {padding: const WidgetStatePropertyAll(EdgeInsets.zero),side: WidgetStateProperty.resolveWith((states) => BorderSide(- color: states.contains(WidgetState.focused)- ? grid.AppDesktop.focus- : Colors.transparent,+ color: Colors.transparent,width: grid.AppDesktop.focusWidth,),),diff --git a/desktop/lib/settings/sections/appearance_section.dart b/desktop/lib/settings/sections/appearance_section.dartindex ccf74e871..bf612bb14 100644--- a/desktop/lib/settings/sections/appearance_section.dart+++ b/desktop/lib/settings/sections/appearance_section.dart@@ -2,9 +2,11 @@ import 'dart:async';import 'package:flutter/material.dart';+import '../../shared/theme/app_icons.dart';import '../../shared/theme/app_theme.dart' as grid;import '../appearance/palette_section.dart';import '../../shared/theme/appearance_prefs_store.dart';+import '../../shared/widgets/app_select_field.dart';import '../../shared/widgets/setting_row.dart';import '../../shortcuts/app_keymap.dart';import '../../widgets/key_hints.dart';@@ -18,6 +20,25 @@ class AppearanceSection extends StatelessWidget {const AppearanceSection({super.key, this.store});final AppearancePrefsStore? store;+ /// Fits both pane styles' names and icons at the app's text size.+ static const double _paneStyleWidth = 260;++ /// A switch whose track, not its touch margin, ends at the row's edge: on the+ /// line the fields and buttons above and below it end on.+ static Widget _edgeSwitch({+ required Key key,+ required bool value,+ required ValueChanged<bool> onChanged,+ }) => Align(+ alignment: Alignment.centerLeft,+ child: Switch(+ key: key,+ value: value,+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,+ onChanged: onChanged,+ ),+ );+@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);@@ -32,24 +53,126 @@ class AppearanceSection extends StatelessWidget {children: [ValueListenableBuilder<AppearancePrefs>(valueListenable: preferences,- builder: (context, prefs, _) => SettingRow(- title: 'Shade inactive panes',- controlSemanticLabel: 'Shade inactive panes',- detail:- 'Add a gray shade to panes that aren’t selected.'- '${shortcut == null ? '' : ' Toggle with $shortcut.'}',- control: Align(- alignment: Alignment.centerLeft,- child: Switch(- key: const ValueKey('shade-inactive-panes'),- value: prefs.shadeInactivePanes,- onChanged: (enabled) =>- unawaited(preferences.setShadeInactivePanes(enabled)),+ builder: (context, prefs, _) {+ final panes = prefs.panes;+ void set(PanePrefs next) => unawaited(preferences.setPanes(next));+ Widget toggle({+ required String title,+ required String key,+ required String detail,+ required bool value,+ required ValueChanged<bool> onChanged,+ }) => Padding(+ padding: const EdgeInsets.only(bottom: 10),+ child: SettingRow(+ title: title,+ controlSemanticLabel: title,+ // Every row here says what it does: a row with no detail+ // draws no card, and its control ends at another edge.+ detail: detail,+ control: _edgeSwitch(+ key: ValueKey(key),+ value: value,+ onChanged: onChanged,+ ),),- ),- ),+ );+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Padding(+ padding: const EdgeInsets.only(bottom: 10),+ child: SettingRow(+ title: 'Pane style',+ detail: 'Compact panes are square and touch each other.',+ // A set width: beside the title it would otherwise take+ // all it likes, squeezing the words to nothing in the+ // narrow Customize pane, and past its edge at larger text.+ control: SizedBox(+ width: _paneStyleWidth,+ child: SegmentedButton<PaneStyle>(+ key: const ValueKey('pane-style'),+ showSelectedIcon: false,+ expandedInsets: EdgeInsets.zero,+ style: SegmentedButton.styleFrom(+ selectedBackgroundColor: grid.AppDesktop.selection,+ selectedForegroundColor:+ grid.AppDesktop.onSelection,+ ),+ segments: [+ for (final style in PaneStyle.values)+ ButtonSegment(+ value: style,+ icon: Icon(+ style == PaneStyle.compact+ ? AppIcons.panelsTopLeft+ : AppIcons.layoutGrid,+ size: AppIcons.inlineSize,+ ),+ label: Text(+ style.label,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ ),+ ),+ ],+ selected: {panes.style},+ onSelectionChanged: (selection) =>+ set(panes.copyWith(style: selection.first)),+ ),+ ),+ ),+ ),+ toggle(+ title: 'Highlight active pane edges',+ key: 'highlight-active-pane',+ detail: 'Draw a blue edge around the selected pane.',+ value: panes.highlightActive,+ onChanged: (enabled) =>+ set(panes.copyWith(highlightActive: enabled)),+ ),+ Padding(+ padding: const EdgeInsets.only(bottom: 10),+ child: SettingRow(+ title: 'Fade inactive panes',+ detail:+ 'Fade panes that aren’t selected.'+ '${shortcut == null ? '' : ' Toggle with $shortcut.'}',+ control: Align(+ alignment: Alignment.centerLeft,+ child: AppSelectField<PaneFade>(+ key: const ValueKey('fade-inactive-panes'),+ width: 180,+ value: panes.fade,+ options: [+ for (final fade in PaneFade.values)+ SelectOption(value: fade, label: fade.label),+ ],+ onChanged: (fade) => set(panes.copyWith(fade: fade)),+ ),+ ),+ ),+ ),+ toggle(+ title: 'Autobalance splits',+ key: 'autobalance-splits',+ detail: 'Even out pane sizes when you split a pane or move one.',+ value: panes.autobalanceSplits,+ onChanged: (enabled) =>+ set(panes.copyWith(autobalanceSplits: enabled)),+ ),+ toggle(+ title: 'Focus follows mouse',+ key: 'focus-follows-mouse',+ detail: 'Select a pane by pointing at it.',+ value: panes.focusFollowsMouse,+ onChanged: (enabled) =>+ set(panes.copyWith(focusFollowsMouse: enabled)),+ ),+ ],+ );+ },),- const SizedBox(height: 10),ValueListenableBuilder<AppearancePrefs>(valueListenable: preferences,builder: (context, prefs, _) => SettingRow(@@ -58,14 +181,11 @@ class AppearanceSection extends StatelessWidget {detail:'Names a tab for its repo and the work in it, in the ''background — e.g. Harness TUI LMStudio',- control: Align(- alignment: Alignment.centerLeft,- child: Switch(- key: const ValueKey('auto-rename-tabs'),- value: prefs.autoRenameTabs,- onChanged: (enabled) =>- unawaited(preferences.setAutoRenameTabs(enabled)),- ),+ control: _edgeSwitch(+ key: const ValueKey('auto-rename-tabs'),+ value: prefs.autoRenameTabs,+ onChanged: (enabled) =>+ unawaited(preferences.setAutoRenameTabs(enabled)),),),),diff --git a/desktop/lib/settings/settings_nav.dart b/desktop/lib/settings/settings_nav.dartindex 4467eea1f..e5990a991 100644--- a/desktop/lib/settings/settings_nav.dart+++ b/desktop/lib/settings/settings_nav.dart@@ -37,9 +37,9 @@ class SettingsNav extends StatefulWidget {/// shortcuts is left out.final bool compact;- /// The machine rail's own default width, so Settings opens without the left- /// column jumping.- static const double width = 260;+ /// The workspace sidebar's width with its rule, so Settings opens without the+ /// left column jumping.+ static const double width = 276;@overrideState<SettingsNav> createState() => _SettingsNavState();@@ -140,7 +140,7 @@ class _SettingsNavState extends State<SettingsNav> {grid.AppTheme.watch(context);return Container(width: widget.railWidth,- color: grid.AppSurface.recess,+ color: grid.AppPalette.swarmWelcome,child: Padding(// Rows add their own icon gutter: their glyphs and group captions sit// on the same 24px content inset as the section on the right.diff --git a/desktop/lib/settings/settings_screen.dart b/desktop/lib/settings/settings_screen.dartindex 22d97dd1b..0743b8617 100644--- a/desktop/lib/settings/settings_screen.dart+++ b/desktop/lib/settings/settings_screen.dart@@ -9,6 +9,7 @@ import '../shortcuts/keymap_commands.dart';import '../shortcuts/keymap_keyboard.dart';import '../state/app_state.dart';import '../widgets/harness_customize_pane.dart';+import '../widgets/window_chrome.dart';import 'experimental_features.dart';import 'settings_body.dart';import 'settings_compact.dart';@@ -242,13 +243,38 @@ class _SettingsScreenState extends State<SettingsScreen> {return FocusScope(onKeyEvent: _key,child: Scaffold(- backgroundColor: grid.AppPalette.windowBg,- body: Row(- crossAxisAlignment: CrossAxisAlignment.stretch,+ backgroundColor: grid.AppPalette.swarmWelcome,+ body: Stack(children: [- SettingsNav(section: _section, onSelect: _show),- VerticalDivider(width: 1, color: grid.AppPalette.divider),- Expanded(child: body),+ Positioned.fill(+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ SettingsNav(+ section: _section,+ onSelect: _show,+ // A ring around an untouched field on a page opened to read.+ autofocusSearch: !drawsWindowCaption,+ ),+ VerticalDivider(width: 1, color: grid.AppPalette.divider),+ Expanded(child: body),+ ],+ ),+ ),+ if (drawsWindowCaption) ...[+ Positioned(+ top: 0,+ left: SettingsNav.width + 1,+ right: 3 * WindowCaptionButtons.buttonWidth,+ height: 24,+ child: const WindowCaptionDragArea(),+ ),+ const Positioned(+ top: 0,+ right: 0,+ child: WindowCaptionButtons(height: kWindowCaptionHeight),+ ),+ ],],),),diff --git a/desktop/lib/shared/layouts/widgets/rail_section_header.dart b/desktop/lib/shared/layouts/widgets/rail_section_header.dartindex c4a809412..2fab8a0c3 100644--- a/desktop/lib/shared/layouts/widgets/rail_section_header.dart+++ b/desktop/lib/shared/layouts/widgets/rail_section_header.dart@@ -37,12 +37,12 @@ class RailSectionHeader extends StatelessWidget {AppTheme.watch(context);final text = Padding(padding: const EdgeInsets.symmetric(vertical: 4),+ // As the workspace sidebar's headings read ("Projects").child: Text(- label.toUpperCase(),- semanticsLabel: label,- style: AppType.monoMeta(- color: AppPalette.textFaint,- fontWeight: AppFont.medium,+ label,+ style: AppType.caption(+ color: AppPalette.textSecondary,+ fontWeight: FontWeight.w600,),),);diff --git a/desktop/lib/shared/layouts/widgets/sidebar_item.dart b/desktop/lib/shared/layouts/widgets/sidebar_item.dartindex 28871c3a8..33dd38b28 100644--- a/desktop/lib/shared/layouts/widgets/sidebar_item.dart+++ b/desktop/lib/shared/layouts/widgets/sidebar_item.dart@@ -17,10 +17,6 @@ const Duration _selectDuration = AppMotion.swap;/// still catching up.const Duration _hoverDuration = AppMotion.hover;-/// The accent rail's width, and how far left of its resting place it starts.-const double _railWidth = 3;-const double _railTravel = _railWidth * 0.6;-/// How far the icon drifts right under the pointer.const double _iconDrift = 2;@@ -228,7 +224,7 @@ class _SidebarRow extends StatelessWidget {@overrideWidget build(BuildContext context) {AppTheme.watch(context);- const radius = BorderRadius.all(Radius.circular(8));+ const radius = BorderRadius.all(Radius.circular(AppDesktop.rowRadius));// Weight tracks the selection itself, not the transition: it changes the// label's metrics, so it wants to happen once, at the start, rather than// reflowing the text somewhere in the middle of the fade.@@ -367,10 +363,6 @@ class _SidebarRow extends StatelessWidget {),),),- // Nothing to draw on the rows that aren't selected, which is all but one- // of them — and a rail at zero opacity is still a render object to lay- // out and a layer to composite.- if (select > 0) _SelectionRail(select: select),],);}@@ -479,55 +471,13 @@ class _RowIcon extends StatelessWidget {AppPalette.textPrimary,t,)!;- final ink = item.enabled- ? Color.lerp(plain, AppPalette.accentOnSurface, t)!- : plain;+ final ink = plain;return Transform.translate(// A whisper of drift on hover, so the icon feels alive as the pointer// lands — nudged right, never resized.offset: Offset(hover * _iconDrift, 0),- child: Icon(item.icon, size: 18, color: ink),- );- }-}--/// The accent rail: a slim bar hugging the selected row's left edge.-///-/// It slides in from the left and fades up, so moving the selection glides-/// rather than blinks. Drawn outside the fill so it never shifts the label, and-/// pinned inside the row's 1px vertical margin so it lines up with the rounded-/// fill. The fade rides the colour's alpha rather than an [Opacity] — wrapping-/// it in one meant an offscreen buffer every frame of the transition.-class _SelectionRail extends StatelessWidget {- const _SelectionRail({required this.select});-- final double select;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return Positioned(- left: 0,- top: 1,- bottom: 1,- child: Center(- child: Transform.translate(- offset: Offset(-_railTravel * (1 - select), 0),- child: Container(- width: _railWidth,- height: 18,- decoration: BoxDecoration(- // Same reason as the icon — a mark on the row, so it takes the- // on-surface accent.- color: AppPalette.accentOnSurface.withValues(alpha: select),- borderRadius: const BorderRadius.horizontal(- right: Radius.circular(3),- ),- ),- ),- ),- ),+ child: Icon(item.icon, size: 16, color: ink),);}}diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dartindex b43e0fc4d..056db9e15 100644--- a/desktop/lib/shared/theme/app_icons.dart+++ b/desktop/lib/shared/theme/app_icons.dart@@ -134,6 +134,10 @@ abstract final class AppIcons {static const logOut = LucideIcons.logOut400;static const maximize = LucideIcons.maximize400;static const menu = LucideIcons.menu400;++ /// The Windows workspace's app-menu button: one vertical frame line with its+ /// shortcut notch, the drawing the owner picked for the tab strip.+ static const galleryVerticalEnd = LucideIcons.galleryVerticalEnd400;static const messageCircleQuestionMark =LucideIcons.messageCircleQuestionMark400;static const messagesSquare = LucideIcons.messagesSquare400;diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dartindex 974087ae5..81eaae0c5 100644--- a/desktop/lib/shared/theme/app_theme.dart+++ b/desktop/lib/shared/theme/app_theme.dart@@ -394,8 +394,12 @@ abstract final class AppPalette {/// (#E2E2DF) and 2.60 on Mist's (#DCE4EE). This holds 3.36 / 3.40 there and/// 3.49 / 3.51 on the two workspaces, and stays 1.42:1 apart from/// [textSecondary] so the three steps still read as three.- static Color get textFaint =>- AppTheme.pick(const Color(0xFF7A7973), const Color(0xFF6E6E68));+ static Color get textFaint => textFaintFor(isDark: AppTheme.isDark);++ /// [textFaint] for a theme being built, whose brightness need not be the+ /// current one. Every field's placeholder is this color.+ static Color textFaintFor({required bool isDark}) =>+ isDark ? const Color(0xFF6E6E68) : const Color(0xFF7A7973);/// The page a document is drawn on, and the ink on it.///@@ -465,10 +469,13 @@ abstract final class AppPalette {/// [buildAppTheme] needs the values *before* the global brightness is the one/// being built for — see the note at its `scrollbarTheme`. The getters below read/// these same four, so there is one set of numbers rather than two that can drift.-const Color _scrollThumbLight = Color(0xFF787878);-const Color _scrollThumbDark = Color(0xFF686868);-const Color _scrollThumbHoverLight = Color(0xFF5E5E5E);-const Color _scrollThumbHoverDark = Color(0xFF8A8A8A);+///+/// Translucent, so one thumb takes the tone of whatever it runs over, a menu or+/// a page, rather than sitting on it as a foreign gray.+const Color _scrollThumbLight = Color(0x59000000);+const Color _scrollThumbDark = Color(0x47FFFFFF);+const Color _scrollThumbHoverLight = Color(0x80000000);+const Color _scrollThumbHoverDark = Color(0x70FFFFFF);/// Surface tokens for the app's chrome — the sidebar's rows, the composer card,/// a recessed list column. Depth comes from a hairline rim and a soft shadow; the@@ -766,7 +773,9 @@ abstract final class AppGlass {/// use [styleFor] and the consts; everywhere else use [style] and the getters.abstract final class AppMenu {static const Color fillLight = Color(0xFFFFFFFF);- static const Color fillDark = Color(0xFF262626);++ /// One step above the page (#282828), so a panel lifts off what it opens over.+ static const Color fillDark = Color(0xFF2E2E2E);static Color get fill => AppTheme.pick(fillLight, fillDark);/// The panel's rim — the same hairline [AppGlass.hair] resolves to, stated as@@ -845,7 +854,7 @@ abstract final class AppCard {// card surfacestatic Color get base =>- AppTheme.pick(const Color(0xFFFFFFFF), const Color(0xFF1E1E1E));+ AppTheme.pick(const Color(0xFFFFFFFF), const Color(0xFF2E2E2E));// recessed inner box / list tilestatic Color get inset =>@@ -1040,10 +1049,12 @@ ThemeData buildAppTheme({// another name, and §2 allows exactly one of those.trackColor: WidgetStateProperty.all(Colors.transparent),trackBorderColor: WidgetStateProperty.all(Colors.transparent),- // 6px, radius 3 — a thin capsule rather than the 8px slab, which at this- // contrast would read as a chrome element competing with the rows.- thickness: WidgetStateProperty.all(6),- radius: const Radius.circular(3),+ // 3px, one clear of the edge: it runs inside the 6px gutter every menu row+ // and list keeps, so it never covers a row's fill or text.+ thickness: WidgetStateProperty.all(3),+ crossAxisMargin: 1,+ mainAxisMargin: 4,+ radius: const Radius.circular(1.5),// The thumb is only meaningful while there is more list than pane, and// fading it in on scroll keeps a short list from wearing furniture.thumbVisibility: WidgetStateProperty.all(false),@@ -1121,15 +1132,8 @@ ThemeData buildAppTheme({iconTheme: IconThemeData(color: scheme.onSurfaceVariant, size: 18),iconButtonTheme: IconButtonThemeData(style: ButtonStyle(- side: WidgetStateProperty.resolveWith(- (states) => BorderSide(- width: highContrast ? 2 : 1.5,- color:- !states.contains(WidgetState.disabled) &&- states.contains(WidgetState.focused)- ? (isDark ? AppDesktop.focusDark : scheme.primary)- : Colors.transparent,- ),+ side: WidgetStatePropertyAll(+ BorderSide(width: highContrast ? 2 : 1.5, color: Colors.transparent),),shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),@@ -1171,11 +1175,7 @@ ThemeData buildAppTheme({// (The typed text is set on the field via// [kFieldTextStyle]; `InputDecorationTheme` has no `style` of its own, so// a field's own text can't be themed globally here.)- // 75% in light: at 70% the hint sat at 2.999:1 on Mist's panel-toned- // fill; this is 3.29 (Mist) / 3.29 (Paper). Dark keeps 70% (3.99:1).- hintStyle: _fieldTextStyle(- scheme.onSurfaceVariant.withValues(alpha: isDark ? 0.7 : 0.75),- ),+ hintStyle: _fieldTextStyle(AppPalette.textFaintFor(isDark: isDark)),// Material builds a field for a phone: its default padding, plus the 48px// touch target it gives a prefixIcon, rendered this 48 tall next to a 32px// button. That's what these constraints exist to hold back.@@ -1204,10 +1204,8 @@ ThemeData buildAppTheme({),border: _fieldBorder(scheme.outline),enabledBorder: _fieldBorder(scheme.outline),- focusedBorder: _fieldBorder(- isDark ? AppDesktop.focusDark : scheme.primary,- width: highContrast ? 2 : 1.5,- ),+ // No colored focus line: a focused field has its caret.+ focusedBorder: _fieldBorder(scheme.outline),errorBorder: _fieldBorder(scheme.error),focusedErrorBorder: _fieldBorder(scheme.error,@@ -1381,12 +1379,15 @@ abstract final class AppControl {/// The minimum height keeps normal-size controls compact. Vertical padding/// lets enlarged system text grow the capsule without touching its rim.+ ///+ /// One side padding for every button kind: at 14 and 10 a primary, a capsule+ /// and a dialog button of the same height each held their text differently.static const EdgeInsets padding = EdgeInsets.symmetric(- horizontal: 14,+ horizontal: 12,vertical: 6,);static const EdgeInsets paddingSmall = EdgeInsets.symmetric(- horizontal: 10,+ horizontal: 12,vertical: 6,);@@ -1401,8 +1402,8 @@ abstract final class AppControl {////// Only for `.icon` constructors; a text-only button stays on [paddingSmall].static const EdgeInsets paddingSmallIcon = EdgeInsets.only(- left: 12,- right: 10,+ left: 14,+ right: 12,);// — the same numbers, grown with the user's UI size —@@ -1438,44 +1439,19 @@ abstract final class AppDesktop {static const double dialogElevation = 16;static const Color shadow = Color(0x3D000000);- /// The soft shade a right-side pane (a thread, a task, Members) lays over- /// the chat along its left edge, as in Slack (Huy, 11-03): a strip- /// [paneEdgeShadeWidth] wide, darkest at the pane, fading to nothing over- /// the chat. A gradient rather than a blurred shadow: a straight edge needs- /// no blur, and a blur is paid on every repaint of the window. Darker in- /// dark mode, where a light shade would not show on charcoal.- static const double paneEdgeShadeWidth = 12;- static LinearGradient get paneEdgeShade {- final edge = AppTheme.pick(- const Color(0x17000000),- const Color(0x66000000),- );- return LinearGradient(- begin: Alignment.centerRight,- end: Alignment.centerLeft,- colors: [- edge,- edge.withValues(alpha: edge.a * 0.55),- edge.withValues(alpha: edge.a * 0.2),- edge.withValues(alpha: 0),- ],- stops: const [0, 0.3, 0.65, 1],- );- }-static const double menuRadius = 16;static const double rowRadius = 10;static const double fieldRadius = 10;static const double paneRadius = 10;static const double tabRadius = 10;static const double tabShoulder = 8;- static const double tabTopInset = 6;+ static const double tabTopInset = 0;/// A tab's ×: the pane close button's 28pt square target, centred on the- /// tab's body (the 40pt row less [tabTopInset]) with one 3pt gap above,+ /// tab's body (the 40pt row less [tabTopInset]) with one 6pt gap above,/// below, and to the body's straight right side, [tabShoulder] in.static const double tabCloseSize = 28;- static const double tabCloseInset = tabShoulder + 3;+ static const double tabCloseInset = tabShoulder + 6;static const double tabMinWidth = 128;static const double tabMaxWidth = 256;static const double tabBarTrailingInset = 12;@@ -1737,16 +1713,9 @@ WidgetStateProperty<BorderSide> _controlRim(bool highContrast = false,}) => WidgetStateProperty.resolveWith((states) {final disabled = states.contains(WidgetState.disabled);- final focused = states.contains(WidgetState.focused) && !disabled;return BorderSide(width: highContrast ? 2 : 1.5,- color: focused- ? filled- ? scheme.onPrimary- : scheme.brightness == Brightness.dark- ? AppDesktop.focusDark- : scheme.primary- : filled+ color: filled? Colors.transparent: scheme.onSurface.withValues(alpha: disableddiff --git a/desktop/lib/shared/theme/app_type.dart b/desktop/lib/shared/theme/app_type.dartindex cd9232f44..cf03b8789 100644--- a/desktop/lib/shared/theme/app_type.dart+++ b/desktop/lib/shared/theme/app_type.dart@@ -48,6 +48,18 @@ abstract final class AppType {? const ['SF Pro Text', 'Helvetica Neue', 'Arial']: const ['Ubuntu', 'Noto Sans', 'DejaVu Sans', 'sans-serif'];+ /// Pins a control's line, so its text keeps one baseline whatever font falls+ /// out of the fallback chain: without it, labels side by side sat a pixel or+ /// two apart.+ static StrutStyle controlStrut({double? size, double height = 1.25}) =>+ StrutStyle(+ fontSize: size ?? bodySize,+ fontFamily: sansFamily,+ fontFamilyFallback: sansFallback,+ height: height,+ forceStrutHeight: true,+ );+/// The terminal's face, so mono chrome changes with the terminal font.static String get monoFamily => terminalFontStore.value.fontFamily;static List<String> get monoFallback =>diff --git a/desktop/lib/shared/theme/appearance_prefs_store.dart b/desktop/lib/shared/theme/appearance_prefs_store.dartindex f9e0faf1b..aa1a8b19b 100644--- a/desktop/lib/shared/theme/appearance_prefs_store.dart+++ b/desktop/lib/shared/theme/appearance_prefs_store.dart@@ -11,6 +11,126 @@ import 'custom_background.dart';import 'harness_background.dart';import 'prompt_style.dart';+/// How panes sit together: apart as rounded cards, or square and touching.+enum PaneStyle {+ comfortable('Comfortable'),+ compact('Compact');++ const PaneStyle(this.label);+ final String label;+}++/// What fades in a pane that isn't active.+enum PaneFade {+ off('Off'),+ surface('Surface'),+ content('Content'),+ surfaceAndContent('Surface & Content');++ const PaneFade(this.label);+ final String label;++ bool get fadesSurface => this == surface || this == surfaceAndContent;+ bool get fadesContent => this == content || this == surfaceAndContent;+}++/// How panes look and behave on this computer.+@immutable+class PanePrefs {+ const PanePrefs({+ this.style = PaneStyle.comfortable,+ this.fade = PaneFade.surfaceAndContent,+ this.highlightActive = true,+ this.autobalanceSplits = true,+ this.focusFollowsMouse = false,+ });++ final PaneStyle style;+ final PaneFade fade;+ final bool highlightActive;+ final bool autobalanceSplits;+ final bool focusFollowsMouse;++ PanePrefs copyWith({+ PaneStyle? style,+ PaneFade? fade,+ bool? highlightActive,+ bool? autobalanceSplits,+ bool? focusFollowsMouse,+ }) => PanePrefs(+ style: style ?? this.style,+ fade: fade ?? this.fade,+ highlightActive: highlightActive ?? this.highlightActive,+ autobalanceSplits: autobalanceSplits ?? this.autobalanceSplits,+ focusFollowsMouse: focusFollowsMouse ?? this.focusFollowsMouse,+ );++ Map<String, Object> toJson() => {+ 'style': style.name,+ 'fade': fade.name,+ 'highlightActive': highlightActive,+ 'autobalanceSplits': autobalanceSplits,+ 'focusFollowsMouse': focusFollowsMouse,+ };++ /// Read tolerantly, each field alone: a value this build doesn't know is that+ /// field's default. Before this was saved there was only the shade switch, so+ /// with nothing saved, a [legacyShade] someone set keeps what it drew: the+ /// Surface fade, or none. Null means they never touched it: the defaults.+ static PanePrefs read(String? raw, {required bool? legacyShade}) {+ final legacy = switch (legacyShade) {+ null => const PanePrefs(),+ true => const PanePrefs(fade: PaneFade.surface),+ false => const PanePrefs(fade: PaneFade.off),+ };+ if (raw == null) return legacy;+ try {+ if (jsonDecode(raw) case final Map<String, dynamic> json) {+ T named<T extends Enum>(List<T> values, Object? name, T fallback) =>+ values.where((value) => value.name == name).firstOrNull ?? fallback;+ bool flag(String key, bool fallback) => switch (json[key]) {+ final bool saved => saved,+ _ => fallback,+ };+ return PanePrefs(+ style: named(PaneStyle.values, json['style'], legacy.style),+ fade: named(PaneFade.values, json['fade'], legacy.fade),+ highlightActive: flag('highlightActive', legacy.highlightActive),+ autobalanceSplits: flag(+ 'autobalanceSplits',+ legacy.autobalanceSplits,+ ),+ focusFollowsMouse: flag(+ 'focusFollowsMouse',+ legacy.focusFollowsMouse,+ ),+ );+ }+ } on FormatException {+ // A hand-edited file lands on the defaults, as everything here does.+ }+ return legacy;+ }++ @override+ bool operator ==(Object other) =>+ other is PanePrefs &&+ other.style == style &&+ other.fade == fade &&+ other.highlightActive == highlightActive &&+ other.autobalanceSplits == autobalanceSplits &&+ other.focusFollowsMouse == focusFollowsMouse;++ @override+ int get hashCode => Object.hash(+ style,+ fade,+ highlightActive,+ autobalanceSplits,+ focusFollowsMouse,+ );+}+/// Palette, background, and prompt preferences on this computer./// Legacy UI font fields remain readable for older builds; current typography/// is controlled only by TerminalFontStore.@@ -23,7 +143,7 @@ class AppearancePrefs {this.background = HarnessBackground.plain,this.custom = const CustomBackground(),this.paneOpacity = paneOpacityDefault,- this.shadeInactivePanes = false,+ this.panes = const PanePrefs(),this.autoRenameTabs = false,this.prompt = const PromptPrefs(),});@@ -41,8 +161,10 @@ class AppearancePrefs {static const double paneOpacityDefault = 0.5;static const double paneOpacityMin = 0;- /// Whether panes outside the current focus receive a neutral-gray veil.- final bool shadeInactivePanes;+ final PanePrefs panes;++ /// Whether panes outside the current focus fade at all.+ bool get shadeInactivePanes => panes.fade != PaneFade.off;/// Whether a tab without a custom name asks its machine's daemon for one/// (`window_name`) and shows it instead of the voted label. Off, no request@@ -76,6 +198,7 @@ class AppearancePrefs {CustomBackground? custom,double? paneOpacity,bool? shadeInactivePanes,+ PanePrefs? panes,bool? autoRenameTabs,PromptPrefs? prompt,bool clearUiFamily = false,@@ -86,7 +209,11 @@ class AppearancePrefs {background: background ?? this.background,custom: custom ?? this.custom,paneOpacity: paneOpacity ?? this.paneOpacity,- shadeInactivePanes: shadeInactivePanes ?? this.shadeInactivePanes,+ panes: switch (shadeInactivePanes) {+ null => panes ?? this.panes,+ true => (panes ?? this.panes).copyWith(fade: PaneFade.surface),+ false => (panes ?? this.panes).copyWith(fade: PaneFade.off),+ },autoRenameTabs: autoRenameTabs ?? this.autoRenameTabs,prompt: prompt ?? this.prompt,);@@ -100,7 +227,7 @@ class AppearancePrefs {other.background == background &&other.custom == custom &&other.paneOpacity == paneOpacity &&- other.shadeInactivePanes == shadeInactivePanes &&+ other.panes == panes &&other.autoRenameTabs == autoRenameTabs &&other.prompt == prompt;@@ -112,7 +239,7 @@ class AppearancePrefs {background,custom,paneOpacity,- shadeInactivePanes,+ panes,autoRenameTabs,prompt,);@@ -139,7 +266,9 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {static const _customKey = 'harness_custom_background';// Named for the retired on/off choice; it now holds only pane opacity.static const _paneOpacityKey = 'harness_background_behind_harnesses';+ // Still written: an older build reads it for its one shade switch.static const _shadeInactivePanesKey = 'harness_shade_inactive_panes';+ static const _panesKey = 'harness_panes_v1';static const _autoRenameTabsKey = 'harness_auto_rename_tabs';static const _promptKey = 'workspace_prompt_v1';Future<void>? _promptSave;@@ -147,7 +276,7 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {Future<void>? _backgroundSave;Future<void>? _customSave;Future<void>? _paneOpacitySave;- Future<void>? _shadeInactivePanesSave;+ Future<void>? _panesSave;Future<void>? _autoRenameTabsSave;final LocalKeyValueStore _storage;@@ -180,6 +309,7 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {_customKey,_paneOpacityKey,_shadeInactivePanesKey,+ _panesKey,_autoRenameTabsKey,_promptKey,]);@@ -196,7 +326,14 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {: background,custom: custom,paneOpacity: _paneOpacityFrom(saved[_paneOpacityKey]),- shadeInactivePanes: saved[_shadeInactivePanesKey] == 'true',+ panes: PanePrefs.read(+ saved[_panesKey],+ legacyShade: switch (saved[_shadeInactivePanesKey]) {+ 'true' => true,+ 'false' => false,+ _ => null,+ },+ ),autoRenameTabs: saved[_autoRenameTabsKey] == 'true',prompt: _promptFrom(saved[_promptKey]),);@@ -331,23 +468,37 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {/// Apply immediately and serialize writes so the final choice survives.Future<void> setShadeInactivePanes(bool enabled) {if (value.shadeInactivePanes == enabled) {- return _shadeInactivePanesSave ?? Future.value();+ return _panesSave ?? Future.value();}- value = value.copyWith(shadeInactivePanes: enabled);- return _shadeInactivePanesSave ??= _saveShadeInactivePanes();+ return setPanes(+ value.panes.copyWith(+ fade: enabled ? const PanePrefs().fade : PaneFade.off,+ ),+ );+ }++ /// Same ordering as [setShadeInactivePanes].+ Future<void> setPanes(PanePrefs panes) {+ if (value.panes == panes) return _panesSave ?? Future.value();+ value = value.copyWith(panes: panes);+ return _panesSave ??= _savePanes();}- Future<void> _saveShadeInactivePanes() async {+ Future<void> _savePanes() async {try {while (true) {- final enabled = value.shadeInactivePanes;- await _storage.write(_shadeInactivePanesKey, enabled.toString());- if (value.shadeInactivePanes == enabled) break;+ final panes = value.panes;+ await _storage.write(_panesKey, jsonEncode(panes.toJson()));+ await _storage.write(+ _shadeInactivePanesKey,+ (panes.fade != PaneFade.off).toString(),+ );+ if (value.panes == panes) break;}} catch (_) {// Keep the choice for this run if storage is unavailable.} finally {- _shadeInactivePanesSave = null;+ _panesSave = null;}}@@ -466,7 +617,7 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {await _backgroundSave;await _customSave;await _paneOpacitySave;- await _shadeInactivePanesSave;+ await _panesSave;await _autoRenameTabsSave;await _promptSave;try {@@ -477,6 +628,7 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {await _storage.delete(_customKey);await _storage.delete(_paneOpacityKey);await _storage.delete(_shadeInactivePanesKey);+ await _storage.delete(_panesKey);await _storage.delete(_autoRenameTabsKey);await _storage.delete(_promptKey);} catch (_) {diff --git a/desktop/lib/shared/widgets/app_choice_picker.dart b/desktop/lib/shared/widgets/app_choice_picker.dartindex 3d278c6d3..46d53712b 100644--- a/desktop/lib/shared/widgets/app_choice_picker.dart+++ b/desktop/lib/shared/widgets/app_choice_picker.dart@@ -361,9 +361,7 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {).copyWith(side: WidgetStateProperty.resolveWith((states) => BorderSide(- color: states.contains(WidgetState.focused)- ? AppPalette.accentOnSurface- : widget.compact+ color: widget.compact? (selected? AppPalette.accentOnSurface.withValues(alpha: .6): AppGlass.hair)diff --git a/desktop/lib/shared/widgets/app_icon_button.dart b/desktop/lib/shared/widgets/app_icon_button.dartindex a7a6d7350..3991a7912 100644--- a/desktop/lib/shared/widgets/app_icon_button.dart+++ b/desktop/lib/shared/widgets/app_icon_button.dart@@ -195,9 +195,7 @@ class _AppIconButtonState extends State<AppIconButton>side: WidgetStateProperty.resolveWith((states) => BorderSide(width: highContrast ? 2 : 1.5,- color: enabled && states.contains(WidgetState.focused)- ? AppPalette.accentOnSurface- : highContrast && enabled+ color: highContrast && enabled? AppPalette.textSecondary: Colors.transparent,),diff --git a/desktop/lib/shared/widgets/app_menu.dart b/desktop/lib/shared/widgets/app_menu.dartindex 823b34e83..ace114cad 100644--- a/desktop/lib/shared/widgets/app_menu.dart+++ b/desktop/lib/shared/widgets/app_menu.dart@@ -2,6 +2,7 @@ import 'dart:math' as math;import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';+import 'package:flutter/services.dart';import '../theme/app_theme.dart';@@ -39,12 +40,17 @@ class AppMenuRowMetrics {padding.vertical +2;- /// A context menu's row: the macOS control scale.+ /// A context menu's row: the macOS control scale, with the New Harness+ /// agent chooser's 10-point sides — the one row recipe every dropdown in the+ /// app now shares (owner, 2026-11-03).static const compact = AppMenuRowMetrics(iconSize: 16,- padding: EdgeInsets.symmetric(horizontal: 9, vertical: 8),+ padding: EdgeInsets.symmetric(horizontal: 10, vertical: 6),);+ /// Between the leading glyph's slot and the label: the agent chooser's 10.+ static const double leadingGap = 10;+/// A picker's row has more padding, with the same font as a context menu.static const roomy = AppMenuRowMetrics(iconSize: 18,@@ -81,9 +87,31 @@ class AppMenuItem extends StatefulWidget {this.focusNode,this.metrics = AppMenuRowMetrics.compact,this.textStyle,- this.expandLabel = false,+ this.leadingSlot,+ this.autofocus = false,+ this.closesMenu = true,+ this.highlighted = false,});+ /// Inside an [AppDropdown], close the whole dropdown — through any+ /// [AppSubmenuItem] above it — before [onPressed] runs. Off for the row that+ /// opens a submenu, which stays open.+ final bool closesMenu;++ /// Draw the row as if the pointer were on it: a submenu row while its submenu+ /// is open and the pointer has moved into it.+ final bool highlighted;++ /// Take focus as the panel opens — the current choice in a picker, so the+ /// arrow keys start from it.+ final bool autofocus;++ /// Keep the fixed leading column even with no [icon] or [leading], so labels+ /// line up with rows that carry a glyph. Null asks the [AppDropdown]: kept+ /// when any row in the list has a glyph, dropped when none does, where the+ /// empty column would only push every label off to the right.+ final bool? leadingSlot;+/// The leading glyph. Null for a row in a list that PICKS one of several — the/// slot is still reserved, so labels line up whether a row is ticked or not.final IconData? icon;@@ -127,9 +155,6 @@ class AppMenuItem extends StatefulWidget {final AppMenuRowMetrics metrics;final TextStyle? textStyle;- /// Fill a bounded row so its selection check sits at the trailing edge.- final bool expandLabel;-/// This row is the current choice.////// Marked THREE ways, never by one: an accent wash, a heavier label, and a@@ -137,12 +162,63 @@ class AppMenuItem extends StatefulWidget {/// these two greys, and a tick alone is easy to miss in a long list.final bool selected;- final VoidCallback onPressed;+ /// Null draws the row disabled: muted ink, no hover fill, no hand cursor,+ /// and it cannot take focus — an offline machine in a machine picker.+ final VoidCallback? onPressed;/// Red at rest for a destructive action. Active rows retain the common/// white-on-blue selection so pointer and keyboard feedback remain legible.final bool danger;+ /// The width [rows] need to show all they say on one line, so a panel of+ /// short rows has no empty side. Null when that can't be known: no rows, or a+ /// [trailing] widget, whose width only its own layout decides.+ static double? fitWidth(BuildContext context, Iterable<AppMenuItem> rows) {+ final list = rows.toList();+ if (list.isEmpty || list.any((row) => row.trailing != null)) return null;+ final scaler = MediaQuery.textScalerOf(context);+ final direction = Directionality.of(context);+ double line(String text, TextStyle style) {+ final painter = TextPainter(+ text: TextSpan(text: text, style: style),+ textDirection: direction,+ textScaler: scaler,+ maxLines: 1,+ )..layout();+ final width = painter.width;+ painter.dispose();+ return width;+ }++ var widest = 0.0;+ for (final row in list) {+ // At the chosen row's heavier weight, so choosing one never clips it.+ var text = line(+ row.label,+ (row.textStyle ?? AppType.body()).copyWith(fontWeight: AppFont.medium),+ );+ if (row.detail case final detail?) {+ text = math.max(text, line(detail, AppType.caption()));+ }+ if (row.note case final note?) {+ text += 8 + line(note, AppType.body());+ }+ widest = math.max(widest, text);+ }+ final metrics = list.first.metrics;+ final glyphs = list.any(+ (row) =>+ row.icon != null || row.leading != null || row.leadingSlot == true,+ );+ final tick = list.any((row) => row.selected);+ return (widest ++ 12 + // The row's own 6 either side.+ metrics.padding.horizontal ++ (glyphs ? metrics.iconSize + AppMenuRowMetrics.leadingGap : 0) ++ (tick ? 12 + metrics.iconSize : 0))+ .ceilToDouble();+ }+@overrideState<AppMenuItem> createState() => _AppMenuItemState();}@@ -151,14 +227,34 @@ class _AppMenuItemState extends State<AppMenuItem> {bool _hovered = false;bool _focused = false;+ VoidCallback? get _onTap {+ final action = widget.onPressed;+ if (action == null || !widget.closesMenu) return action;+ final root = _AppMenuRoot.maybeOf(context);+ if (root == null) return action;+ return () {+ root.close();+ // After the frame, as MenuItemButton does: the menu has handed focus+ // back to what held it before, so an action that opens a dialog or+ // moves focus starts from there.+ WidgetsBinding.instance.addPostFrameCallback((_) {+ FocusManager.instance.applyFocusChangesIfNeeded();+ action();+ });+ };+ }+@overrideWidget build(BuildContext context) {// Lives in the MenuAnchor's overlay, so it watches for itself.AppTheme.watch(context);final error = Theme.of(context).colorScheme.error;- final active = _hovered || _focused;+ final enabled = widget.onPressed != null;+ final active = enabled && (_hovered || _focused || widget.highlighted);final tint = active? AppDesktop.onSelection+ : !enabled+ ? AppPalette.textSecondary.withValues(alpha: .6): widget.danger? error: AppPalette.textSecondary;@@ -172,10 +268,13 @@ class _AppMenuItemState extends State<AppMenuItem> {borderRadius: BorderRadius.circular(AppDesktop.rowRadius),child: InkWell(focusNode: widget.focusNode,- onTap: widget.onPressed,+ autofocus: widget.autofocus && enabled,+ onTap: _onTap,onHover: (hovered) => setState(() => _hovered = hovered),onFocusChange: (focused) => setState(() => _focused = focused),- mouseCursor: SystemMouseCursors.click,+ mouseCursor: enabled+ ? SystemMouseCursors.click+ : SystemMouseCursors.basic,borderRadius: BorderRadius.circular(AppDesktop.rowRadius),hoverColor: Colors.transparent,focusColor: Colors.transparent,@@ -195,80 +294,100 @@ class _AppMenuItemState extends State<AppMenuItem> {// Fixed slot: these glyphs differ in width, and without it every// label would start at a slightly different column — and a// ticked row would sit a few pixels off an unticked one.- SizedBox(- width: widget.metrics.iconSize,- child: widget.leading != null- ? IconTheme.merge(- data: IconThemeData(- color: tint,- size: widget.metrics.iconSize,- ),- child: widget.leading!,- )- : (glyph == null- ? null- : Icon(- glyph,- size: widget.metrics.iconSize,- color: tint,- )),- ),- const SizedBox(width: 9),- Flexible(- fit: widget.expandLabel ? FlexFit.tight : FlexFit.loose,- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisSize: MainAxisSize.min,+ if ((widget.leadingSlot ??+ _AppMenuRoot.glyphsOf(context) ??+ true) ||+ widget.leading != null ||+ glyph != null) ...[+ SizedBox(+ width: widget.metrics.iconSize,+ child: widget.leading != null+ ? IconTheme.merge(+ data: IconThemeData(+ color: tint,+ size: widget.metrics.iconSize,+ ),+ child: widget.leading!,+ )+ : (glyph == null+ ? null+ : Icon(+ glyph,+ size: widget.metrics.iconSize,+ color: tint,+ )),+ ),+ const SizedBox(width: AppMenuRowMetrics.leadingGap),+ ],+ // The label and its note take the row's slack, so a trailing+ // mark or a check always lands on the end edge, whatever the+ // label's length: the one column a reader's eye can run down.+ Expanded(+ child: Row(children: [- Text(- widget.label,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: (widget.textStyle ?? AppType.body()).copyWith(- color: active- ? AppDesktop.onSelection- : widget.danger- ? error- : AppPalette.textPrimary,- height: 1.2,- fontWeight: widget.selected- ? AppFont.medium- : AppFont.regular,+ Flexible(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ widget.label,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ strutStyle: widget.textStyle == null+ ? AppType.controlStrut(height: 1.2)+ : null,+ style: (widget.textStyle ?? AppType.body())+ .copyWith(+ color: active+ ? AppDesktop.onSelection+ : !enabled+ ? AppPalette.textSecondary+ : widget.danger+ ? error+ : AppPalette.textPrimary,+ height: 1.2,+ fontWeight: widget.selected+ ? AppFont.medium+ : AppFont.regular,+ ),+ ),+ if (widget.detail case final detail?) ...[+ const SizedBox(height: 2),+ Text(+ detail,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: AppType.caption(+ color: active+ ? AppDesktop.selectionDetail+ : AppPalette.textSecondary,+ height: 1.25,+ ),+ ),+ ],+ ],),),- if (widget.detail case final detail?) ...[- const SizedBox(height: 2),- Text(- detail,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: AppType.caption(- color: active- ? AppDesktop.selectionDetail- : AppPalette.textSecondary,- height: 1.25,+ if (widget.note != null) ...[+ const SizedBox(width: 8),+ Flexible(+ child: Text(+ widget.note!,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: AppType.body(+ color: active+ ? AppDesktop.selectionDetail+ : AppPalette.textSecondary,+ height: 1.2,+ ),),),],],),),- if (widget.note != null) ...[- const SizedBox(width: 8),- Flexible(- child: Text(- widget.note!,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: AppType.body(- color: active- ? AppDesktop.selectionDetail- : AppPalette.textSecondary,- height: 1.2,- ),- ),- ),- ],if (widget.trailing != null) ...[const SizedBox(width: 8),widget.trailing!,@@ -290,6 +409,512 @@ class _AppMenuItemState extends State<AppMenuItem> {}}+/// The search at the head of a long menu: one look wherever a list grows past+/// what can be read at a glance ([AppDropdown], [AppSelectField]), and the New+/// Harness agent picker's: a glyph and a line of text over a rule, no box.+class AppMenuSearchField extends StatelessWidget {+ const AppMenuSearchField({+ super.key,+ required this.controller,+ required this.focusNode,+ required this.onChanged,+ required this.onKeyEvent,+ this.fieldKey = const Key('app-menu-search'),+ this.textStyle,+ });++ final TextEditingController controller;+ final FocusNode focusNode;+ final ValueChanged<String> onChanged;+ final FocusOnKeyEventCallback onKeyEvent;+ final Key fieldKey;+ final TextStyle? textStyle;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ return Focus(+ canRequestFocus: false,+ skipTraversal: true,+ onKeyEvent: onKeyEvent,+ child: Container(+ margin: const EdgeInsets.only(bottom: 5),+ // With the panel's top padding, one row's height.+ padding: const EdgeInsets.fromLTRB(16, 1, 16, 5),+ decoration: BoxDecoration(+ border: Border(bottom: BorderSide(color: AppDesktop.rim)),+ ),+ child: Row(+ children: [+ Icon(AppIcons.search, size: 16, color: AppPalette.textFaint),+ const SizedBox(width: AppMenuRowMetrics.leadingGap),+ Expanded(+ child: TextField(+ key: fieldKey,+ controller: controller,+ focusNode: focusNode,+ style: textStyle ?? AppType.body(color: AppPalette.textPrimary),+ autocorrect: false,+ enableSuggestions: false,+ decoration: InputDecoration(+ hintText: 'Search',+ hintStyle: AppType.body(color: AppPalette.textFaint),+ isDense: true,+ isCollapsed: true,+ constraints: const BoxConstraints(),+ contentPadding: EdgeInsets.zero,+ border: InputBorder.none,+ enabledBorder: InputBorder.none,+ focusedBorder: InputBorder.none,+ filled: false,+ ),+ onChanged: onChanged,+ ),+ ),+ ],+ ),+ ),+ );+ }+}++/// The app's one dropdown: the panel, its rows, their width, the search head+/// and what happens on a pick. Every menu states its rows and nothing else.+///+/// The width is set on each ROW, never with `MenuStyle.minimumSize`: rows laid+/// out loose keep their own width, so a panel asked for 220 drew 129 and its+/// marks missed each other.+///+/// Past [searchAfter] rows the panel opens on a search field, matching a row's+/// label, detail and note. Headings and dividers step aside during a search.+///+/// [AppMenuItem] rows close the whole dropdown before they act. Anything else+/// among [children] (a heading, an [AppMenuDivider]) is drawn as it is.+class AppDropdown extends StatefulWidget {+ const AppDropdown({+ super.key,+ required this.children,+ this.controller,+ this.width = defaultWidth,+ this.maxHeight = 480,+ this.style,+ this.alignment,+ this.alignmentOffset = const Offset(0, AppControl.menuGap),+ this.childFocusNode,+ this.consumeOutsideTap = true,+ this.searchAfter = defaultSearchAfter,+ this.header,+ this.searchScope,+ this.onOpen,+ this.onClose,+ this.builder,+ this.child,+ });++ static const double defaultWidth = 240;++ /// The narrowest a panel of short rows gets.+ static const double minFitWidth = 140;++ /// A list longer than this is hunted through, not read.+ static const int defaultSearchAfter = 8;++ final List<Widget> children;+ final MenuController? controller;++ /// The panel's widest. Short rows ask for less ([AppMenuItem.fitWidth]); a+ /// panel with a [header], a search, or anything but rows and dividers among+ /// [children] is this wide.+ final double width;+ final double maxHeight;++ /// The panel's style before placement; [AppMenu.style] at [maxHeight] when+ /// null.+ final MenuStyle? style;+ final AlignmentGeometry? alignment;+ final Offset alignmentOffset;+ final FocusNode? childFocusNode;+ final bool consumeOutsideTap;+ final int searchAfter;++ /// Fixed above the search field and the rows, whatever a search leaves: a+ /// tab row, for a panel that swaps its rows ([AppTabPill]).+ final Widget? header;++ /// What the rows are of. A change clears the search: the query was for other+ /// rows.+ final Object? searchScope;+ final VoidCallback? onOpen;+ final VoidCallback? onClose;+ final MenuAnchorChildBuilder? builder;+ final Widget? child;++ @override+ State<AppDropdown> createState() => _AppDropdownState();+}++/// One tab in a row of tabs: its name in a pill, filled while selected. Always+/// as wide as its selected weight, so choosing a tab does not move the others.+class AppTabPill extends StatelessWidget {+ const AppTabPill({+ super.key,+ this.tapKey,+ required this.label,+ required this.selected,+ required this.onTap,+ });++ /// The clickable part's key, for a caller that finds or taps the tab itself.+ final Key? tapKey;+ final String label;+ final bool selected;+ final VoidCallback onTap;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ TextStyle style(bool medium, Color color) => AppType.body(+ color: color,+ height: 1.25,+ fontWeight: medium ? AppFont.medium : AppFont.regular,+ );+ final widest = TextPainter(+ text: TextSpan(text: label, style: style(true, AppPalette.textPrimary)),+ textDirection: Directionality.of(context),+ textScaler: MediaQuery.textScalerOf(context),+ maxLines: 1,+ )..layout();+ final width = widest.width.ceilToDouble();+ widest.dispose();+ return Material(+ color: selected ? AppSurface.selectedFill : Colors.transparent,+ borderRadius: BorderRadius.circular(AppDesktop.rowRadius),+ clipBehavior: Clip.antiAlias,+ child: InkWell(+ key: tapKey,+ onTap: onTap,+ hoverColor: AppSurface.hoverFill,+ child: Semantics(+ selected: selected,+ button: true,+ child: Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: AppDesktop.controlGap,+ vertical: AppDesktop.menuInset,+ ),+ child: SizedBox(+ width: width,+ child: Text(+ label,+ textAlign: TextAlign.center,+ maxLines: 1,+ strutStyle: AppType.controlStrut(),+ style: style(+ selected,+ selected ? AppPalette.textPrimary : AppPalette.textSecondary,+ ),+ ),+ ),+ ),+ ),+ ),+ );+ }+}++class _AppDropdownState extends State<AppDropdown> {+ MenuController? _own;+ final _searchFocus = FocusNode(debugLabel: 'Dropdown search');+ final _searchText = TextEditingController();+ String _query = '';++ MenuController get _controller =>+ widget.controller ?? (_own ??= MenuController());++ @override+ void dispose() {+ _searchFocus.dispose();+ _searchText.dispose();+ super.dispose();+ }++ @override+ void didUpdateWidget(AppDropdown oldWidget) {+ super.didUpdateWidget(oldWidget);+ // The rows changed under the query (another tab): it no longer applies.+ if (oldWidget.searchScope != widget.searchScope) {+ _searchText.clear();+ _query = '';+ }+ }++ /// The menu row inside [widget], through the wrappers a menu puts around one:+ /// a key, a tooltip, a size, a semantics node.+ static AppMenuItem? _rowIn(Widget widget) => switch (widget) {+ AppMenuItem() => widget,+ KeyedSubtree(:final child) => _rowIn(child),+ Tooltip(:final child?) => _rowIn(child),+ ProxyWidget(:final child) => _rowIn(child),+ SingleChildRenderObjectWidget(:final child?) => _rowIn(child),+ _ => null,+ };++ bool _matches(AppMenuItem row, String needle) =>+ row.label.toLowerCase().contains(needle) ||+ (row.detail?.toLowerCase().contains(needle) ?? false) ||+ (row.note?.toLowerCase().contains(needle) ?? false);++ List<AppMenuItem> get _rows => [+ for (final child in widget.children) ?_rowIn(child),+ ];++ bool get _searching => _rows.length > widget.searchAfter;++ /// As wide as the rows ask, from all of them rather than a search's few, so+ /// the panel holds still while its list changes.+ double _panelWidth(BuildContext context) {+ final onlyRows = widget.children.every(+ (child) => child is AppMenuDivider || _rowIn(child) != null,+ );+ if (widget.header != null || _searching || !onlyRows) return widget.width;+ final fit = AppMenuItem.fitWidth(context, _rows);+ if (fit == null) return widget.width;+ return math.min(widget.width, math.max(fit, AppDropdown.minFitWidth));+ }++ KeyEventResult _searchKeys(FocusNode node, KeyEvent event) {+ if (event is KeyUpEvent || !_controller.isOpen) {+ return KeyEventResult.ignored;+ }+ final key = event.logicalKey;+ if (key == LogicalKeyboardKey.escape) {+ _controller.close();+ return KeyEventResult.handled;+ }+ if (key == LogicalKeyboardKey.enter ||+ key == LogicalKeyboardKey.numpadEnter) {+ final needle = _query.toLowerCase();+ final first = _rows+ .where((row) => row.onPressed != null && _matches(row, needle))+ .firstOrNull;+ if (first != null) {+ _rootOf(context).close();+ first.onPressed!();+ }+ return KeyEventResult.handled;+ }+ if (key == LogicalKeyboardKey.arrowDown) {+ node.nextFocus();+ return KeyEventResult.handled;+ }+ return KeyEventResult.ignored;+ }++ MenuController _rootOf(BuildContext context) =>+ _AppMenuRoot.maybeOf(context) ?? _controller;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ final root = _rootOf(context);+ final needle = _query.toLowerCase();+ final searching = _searching;+ final glyphs = _rows.any((row) => row.icon != null || row.leading != null);+ final shown = needle.isEmpty+ ? widget.children+ : [+ for (final child in widget.children)+ if (_rowIn(child) case final row? when _matches(row, needle))+ child,+ ];+ final base = widget.style ?? AppMenu.style(maxHeight: widget.maxHeight);+ final width = _panelWidth(context);+ return MenuAnchor(+ controller: _controller,+ childFocusNode: widget.childFocusNode,+ consumeOutsideTap: widget.consumeOutsideTap,+ alignmentOffset: widget.alignmentOffset,+ style: widget.alignment == null+ ? base+ : base.copyWith(alignment: widget.alignment),+ onOpen: () {+ if (_searching) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted && _controller.isOpen) _searchFocus.requestFocus();+ });+ }+ widget.onOpen?.call();+ },+ onClose: () {+ if (_query.isNotEmpty) {+ _searchText.clear();+ if (mounted) setState(() => _query = '');+ }+ widget.onClose?.call();+ },+ menuChildren: [+ if (widget.header case final header?)+ SizedBox(width: width, child: header),+ if (searching)+ SizedBox(+ width: width,+ child: AppMenuSearchField(+ controller: _searchText,+ focusNode: _searchFocus,+ onKeyEvent: _searchKeys,+ onChanged: (value) => setState(() => _query = value.trim()),+ ),+ ),+ if (needle.isNotEmpty && shown.isEmpty)+ SizedBox(+ width: width,+ height: kMenuRowExtent,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: Align(+ alignment: AlignmentDirectional.centerStart,+ child: Text(+ 'No matches',+ style: AppType.body(color: AppPalette.textSecondary),+ ),+ ),+ ),+ ),+ for (final child in shown)+ SizedBox(+ width: width,+ child: _AppMenuRoot(controller: root, glyphs: glyphs, child: child),+ ),+ ],+ builder: widget.builder,+ child: widget.child,+ );+ }+}++/// An [AppMenuItem] that opens its own [AppDropdown] beside its panel.+///+/// The app's one submenu. Pointing at the row opens it, a click toggles it. It+/// is placed from the row's measured edge, [gap] clear of the panel, with its+/// first row level with this one; [MenuAnchor] flips it when the window has no+/// room.+class AppSubmenuItem extends StatefulWidget {+ const AppSubmenuItem({+ super.key,+ this.itemKey,+ required this.label,+ required this.menuChildren,+ this.controller,+ this.icon,+ this.trailing,+ this.leadingSlot,+ this.focusNode,+ this.style,+ this.width = AppDropdown.defaultWidth,+ this.onOpen,+ this.onClose,+ });++ /// The row's own key, for a caller that finds or taps the row itself.+ final Key? itemKey;+ final String label;+ final List<Widget> menuChildren;++ /// The row's focus, for a caller that moves the keys to it.+ final FocusNode? focusNode;++ /// Supplied when the caller coordinates several submenus (closes the others+ /// in [onOpen]); otherwise the item keeps its own.+ final MenuController? controller;+ final IconData? icon;+ final Widget? trailing;+ final bool? leadingSlot;++ /// The submenu panel's style before placement; [AppMenu.style] by default.+ final MenuStyle? style;+ final double width;+ final VoidCallback? onOpen;+ final VoidCallback? onClose;++ /// The air between the two panels' rims.+ static const double gap = 2;++ @override+ State<AppSubmenuItem> createState() => _AppSubmenuItemState();+}++class _AppSubmenuItemState extends State<AppSubmenuItem> {+ MenuController? _own;+ bool _open = false;++ MenuController get _controller =>+ widget.controller ?? (_own ??= MenuController());++ void _openMenu() {+ if (!_controller.isOpen) _controller.open();+ }++ @override+ Widget build(BuildContext context) {+ return AppDropdown(+ controller: _controller,+ style: widget.style,+ width: widget.width,+ consumeOutsideTap: false,+ alignment: AlignmentDirectional.topEnd,+ alignmentOffset: Offset(AppSubmenuItem.gap, -AppMenu.panelPadding.top),+ onOpen: () {+ setState(() => _open = true);+ widget.onOpen?.call();+ },+ onClose: () {+ if (mounted) setState(() => _open = false);+ widget.onClose?.call();+ },+ children: widget.menuChildren,+ child: MouseRegion(+ onHover: (_) => _openMenu(),+ child: AppMenuItem(+ key: widget.itemKey,+ focusNode: widget.focusNode,+ icon: widget.icon,+ label: widget.label,+ trailing: widget.trailing,+ leadingSlot: widget.leadingSlot,+ highlighted: _open,+ closesMenu: false,+ onPressed: () =>+ _controller.isOpen ? _controller.close() : _controller.open(),+ ),+ ),+ );+ }+}++/// The top menu of an [AppDropdown] chain, handed down to its rows.+class _AppMenuRoot extends InheritedWidget {+ const _AppMenuRoot({+ required this.controller,+ required this.glyphs,+ required super.child,+ });++ final MenuController controller;++ /// Whether any row in this list carries a glyph ([AppMenuItem.leadingSlot]).+ final bool glyphs;++ static MenuController? maybeOf(BuildContext context) =>+ context.dependOnInheritedWidgetOfExactType<_AppMenuRoot>()?.controller;++ static bool? glyphsOf(BuildContext context) =>+ context.dependOnInheritedWidgetOfExactType<_AppMenuRoot>()?.glyphs;++ @override+ bool updateShouldNotify(_AppMenuRoot old) =>+ controller != old.controller || glyphs != old.glyphs;+}+/// The rule that sets a destructive row apart from the ordinary ones.class AppMenuDivider extends StatelessWidget {const AppMenuDivider({super.key});diff --git a/desktop/lib/shared/widgets/app_select_field.dart b/desktop/lib/shared/widgets/app_select_field.dartindex 666f27e92..046bc5df7 100644--- a/desktop/lib/shared/widgets/app_select_field.dart+++ b/desktop/lib/shared/widgets/app_select_field.dart@@ -17,11 +17,15 @@ class SelectOption<T> {this.detail,this.leading,this.trailing,+ this.enabled = true,});final T value;final String label;+ /// False shows the row but it can't be chosen, as with an offline machine.+ final bool enabled;+/// A sentence UNDER the label, for a list whose labels alone do not say what/// picking one does.///@@ -82,8 +86,8 @@ class AppSelectField<T> extends StatefulWidget {this.fillColor,this.selected,this.emptyLabel,- this.filterable = false,- this.filterThreshold = 8,+ this.filterable = true,+ this.filterThreshold = AppDropdown.defaultSearchAfter,this.textStyle,this.radius,this.semanticLabel,@@ -455,48 +459,75 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {/// lists scroll, and MenuAnchor also constrains them to the available window.static const double _maxPanelHeight = 380;- /// A floor under the panel's width, on top of the field's own.+ /// The panel when its rows' width can't be known ([AppMenuItem.fitWidth]).+ static const double _unknownPanelWidth = 240;++ /// The widest a long name widens the panel past its field.+ static const double _maxFitWidth = 360;++ /// As wide as the field or the widest name, whichever is more.////// A field can be narrow — the font picker's is 188 — while its list holds/// names that are not. The panel is where the choosing happens, so it is/// allowed to be wider than the box it drops out of; the reverse, a panel- /// narrower than its control, is what reads as an unrelated box.- static const double _minPanelWidth = 240;-+ /// narrower than its control, is what reads as an unrelated box. Neither gets+ /// a fixed floor: a list of short names would keep an empty side.double _rowWidth(double? panelWidth) => math.max(math.max(panelWidth ?? 0, widget.menuWidth ?? 0),- _minPanelWidth,+ math.min(_fitWidth ?? _unknownPanelWidth, _maxFitWidth),);+ int? _fitKey;+ double? _fit;++ /// The widest row, measured only when what it says changes: a field rebuilds+ /// often, closed too, and a list of models can run to hundreds of names. Null+ /// when a row has a trailing mark, whose width only its own layout decides.+ double? get _fitWidth {+ final options = widget.options;+ if (options.any((option) => option.trailing != null)) return null;+ final key = Object.hash(+ Object.hashAll([+ for (final option in options)+ Object.hash(option.label, option.note, option.detail),+ ]),+ _hasMarks,+ widget.textStyle,+ MediaQuery.textScalerOf(context),+ );+ if (key == _fitKey) return _fit;+ _fitKey = key;+ return _fit = AppMenuItem.fitWidth(context, [+ for (final option in options)+ AppMenuItem(+ label: option.label,+ note: option.note,+ detail: option.detail,+ textStyle: widget.textStyle,+ leadingSlot: _hasMarks ? true : null,+ // Its tick: any row in a picker can become the chosen one.+ selected: true,+ onPressed: null,+ ),+ ]);+ }++ bool get _hasMarks => widget.options.any((option) => option.leading != null);+/// The search box at the head of a long menu.////// Inside the panel rather than over the closed control: the control is the/// answer, this is the question, and a field that replaced the chosen row/// would leave the menu saying nothing while it was open.- Widget _filterField(double width) => Focus(- canRequestFocus: false,- skipTraversal: true,- onKeyEvent: _filterKeys,- child: SizedBox(- width: width,- child: Padding(- padding: const EdgeInsets.fromLTRB(11, 3, 11, 7),- child: TextField(- key: const Key('app-select-filter'),- controller: _filterController,- focusNode: _filterFocus,- style: widget.textStyle ?? kFieldTextStyle,- decoration: InputDecoration(- hintText: 'Search',- prefixIcon: Icon(- AppIcons.search,- size: kFieldIconSize,- color: AppPalette.textFaint,- ),- ),- onChanged: (value) => setState(() => _filter = value.trim()),- ),- ),+ Widget _filterField(double width) => SizedBox(+ width: width,+ child: AppMenuSearchField(+ fieldKey: const Key('app-select-filter'),+ controller: _filterController,+ focusNode: _filterFocus,+ textStyle: widget.textStyle,+ onKeyEvent: _filterKeys,+ onChanged: (value) => setState(() => _filter = value.trim()),),);@@ -521,6 +552,7 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {}Widget _anchor(SelectOption<T>? current, double? panelWidth) {+ final rowWidth = _rowWidth(panelWidth);return MenuAnchor(controller: _controller,childFocusNode: _fieldFocus,@@ -534,9 +566,7 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {// Below the control, by the app's one menu gap — and the panel takes its// fill, rim and radius from [AppMenu], the app's single panel recipe.alignmentOffset: Offset(- widget.menuAlignedToEnd- ? math.min(0, (panelWidth ?? 0) - _rowWidth(panelWidth))- : 0,+ widget.menuAlignedToEnd ? math.min(0, (panelWidth ?? 0) - rowWidth) : 0,AppControl.menuGap,),// ⚠️ The width is set on the ROWS, not with `MenuStyle.minimumSize`.@@ -549,11 +579,11 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {// at.style: AppMenu.style(maxHeight: _maxPanelHeight),menuChildren: [- if (_filtering) _filterField(_rowWidth(panelWidth)),+ if (_filtering) _filterField(rowWidth),if (widget.options.isEmpty && widget.emptyLabel != null)SizedBox(- width: _rowWidth(panelWidth),- height: AppMenuRowMetrics.roomy.extent,+ width: rowWidth,+ height: kMenuRowExtent,child: Padding(padding: const EdgeInsets.symmetric(horizontal: 16),child: Align(@@ -567,8 +597,8 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {),if (_noMatches)SizedBox(- width: _rowWidth(panelWidth),- height: AppMenuRowMetrics.roomy.extent,+ width: rowWidth,+ height: kMenuRowExtent,child: Padding(padding: const EdgeInsets.symmetric(horizontal: 16),child: Align(@@ -583,17 +613,14 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {for (final option in _shownOptions)_typingRegion(SizedBox(- width: _rowWidth(panelWidth),+ width: rowWidth,child: AppMenuItem(textStyle: widget.textStyle,- // No glyph of its own: the leading slot belongs to the tick,- // and stays empty (not a blank checkbox) on rows without it.+ // The leading column only when some option has a mark to put+ // there: empty, it just pushes every label to the right.// `selected` also carries the wash and the heavier label, so the// choice is marked three ways rather than by a tick alone.- // A picker's list, not a context menu's: this menu IS the- // control, it is read down rather than glanced at, and it is the- // only place these choices are ever shown.- metrics: AppMenuRowMetrics.roomy,+ leadingSlot: _hasMarks,focusNode: _controller.isOpen ? _focusFor(option.value) : null,selected: option.value == widget.value,label: option.label,@@ -601,7 +628,7 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {detail: option.detail,leading: option.leading?.call(),trailing: option.trailing?.call(),- onPressed: () => _choose(option),+ onPressed: option.enabled ? () => _choose(option) : null,),),key: ValueKey(option.value),@@ -678,9 +705,8 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {),border: Border.all(width: MediaQuery.highContrastOf(context) ? 2 : 1.5,- color: _focused- ? AppDesktop.focus- : widget.selected == true+ // No focus line: focus shows in the fill above.+ color: widget.selected == true? AppPalette.accentOnSurface: MediaQuery.highContrastOf(context)? AppPalette.textSecondarydiff --git a/desktop/lib/shared/widgets/labeled_field.dart b/desktop/lib/shared/widgets/labeled_field.dartindex 57ae9d051..4df058069 100644--- a/desktop/lib/shared/widgets/labeled_field.dart+++ b/desktop/lib/shared/widgets/labeled_field.dart@@ -61,12 +61,10 @@ InputDecoration labeledFieldDecoration(String hint, {Color? fill}) {borderRadius: radius,borderSide: BorderSide.none,),+ // No focus line: a focused field has its caret.focusedBorder: OutlineInputBorder(borderRadius: radius,- // The one rim a field earns: macOS rings the focused control in the- // accent, and without it a focused field is indistinguishable from an- // idle one.- borderSide: BorderSide(color: AppPalette.accent, width: 1.5),+ borderSide: BorderSide.none,),);}diff --git a/desktop/lib/sharing/harness_comments.dart b/desktop/lib/sharing/harness_comments.dartindex 9b87d1c35..ce7f4cba5 100644--- a/desktop/lib/sharing/harness_comments.dart+++ b/desktop/lib/sharing/harness_comments.dart@@ -349,7 +349,7 @@ class _HarnessCommentsState extends State<HarnessComments> {hintText: 'Leave a comment…',hintStyle: DesktopChrome.text(size: 13,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),border: border,enabledBorder: border,diff --git a/desktop/lib/sharing/share_harness_dialog.dart b/desktop/lib/sharing/share_harness_dialog.dartindex f7c8a6acd..518bb5174 100644--- a/desktop/lib/sharing/share_harness_dialog.dart+++ b/desktop/lib/sharing/share_harness_dialog.dart@@ -140,7 +140,9 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {void _accept(Map<String, dynamic> response) {final removable = _removable;final recipientId =- _row == _ShareRow.people && _choice >= 2 && _choice - 2 < removable.length+ _row == _ShareRow.people &&+ _choice >= 2 &&+ _choice - 2 < removable.length? removable[_choice - 2]['id']: null;_collaboration = !widget.tabMode && response['collaboration'] == true;@@ -152,7 +154,9 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {Map<String, dynamic>.from(row as Map),];if (recipientId != null) {- final index = _removable.indexWhere((share) => share['id'] == recipientId);+ final index = _removable.indexWhere(+ (share) => share['id'] == recipientId,+ );_choice = index < 0 ? 0 : index + 2;if (_picking && index < 0) _focusPane();}@@ -196,7 +200,8 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {emails.length > most ||emails.any((e) => !RegExp(r'^[^@\s]+@[^@\s]+\.[^@\s]+$').hasMatch(e))) {setState(() {- _error = 'Enter up to $most valid email addresses, separated by commas.';+ _error =+ 'Enter up to $most valid email addresses, separated by commas.';_notice = null;});return;@@ -888,7 +893,9 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {children: [Expanded(child: Text(- widget.tabMode ? 'People you invite see a notice in Harness.' : 'Keep your machine online.',+ widget.tabMode+ ? 'People you invite see a notice in Harness.'+ : 'Keep your machine online.',style: DesktopChrome.metadata(),),),@@ -1064,13 +1071,13 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {focusNode: _emailFocus,enabled: !_disabled,keyboardType: TextInputType.emailAddress,- style: DesktopChrome.text(size: 14),+ style: DesktopChrome.text(size: 13),cursorColor: DesktopChrome.accent,decoration: InputDecoration(hintText: 'Add emails',hintStyle: DesktopChrome.text(- size: 14,- color: DesktopChrome.muted,+ size: 13,+ color: DesktopChrome.hint,),isDense: true,filled: true,diff --git a/desktop/lib/shortcuts/keyboard_practice.dart b/desktop/lib/shortcuts/keyboard_practice.dartindex b1946fbac..a1b292bd0 100644--- a/desktop/lib/shortcuts/keyboard_practice.dart+++ b/desktop/lib/shortcuts/keyboard_practice.dart@@ -532,9 +532,9 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {InputDecoration _fieldDecoration(String hint, {bool search = false}) =>InputDecoration(hintText: hint,- hintStyle: DesktopChrome.control(color: DesktopChrome.muted),+ hintStyle: DesktopChrome.control(color: DesktopChrome.hint),prefixIcon: search- ? Icon(AppIcons.search, size: 18, color: DesktopChrome.muted)+ ? Icon(AppIcons.search, size: 18, color: DesktopChrome.hint): null,filled: true,fillColor: DesktopChrome.field,@@ -554,7 +554,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {),focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(DesktopChrome.controlRadius),- borderSide: BorderSide(color: DesktopChrome.accent, width: 1.5),+ borderSide: BorderSide(color: DesktopChrome.rim),),);diff --git a/desktop/lib/shortcuts/shortcuts_browser.dart b/desktop/lib/shortcuts/shortcuts_browser.dartindex ce0a76b12..61826d9af 100644--- a/desktop/lib/shortcuts/shortcuts_browser.dart+++ b/desktop/lib/shortcuts/shortcuts_browser.dart@@ -271,12 +271,12 @@ class _ShortcutsBrowserState extends State<ShortcutsBrowser> {decoration: InputDecoration(hintText: 'Search actions or keys',hintStyle: DesktopChrome.control(- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),prefixIcon: Icon(AppIcons.search,size: 18 * scale,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),suffixIcon: _query.text.isEmpty? null@@ -304,10 +304,7 @@ class _ShortcutsBrowserState extends State<ShortcutsBrowser> {borderRadius: BorderRadius.circular(DesktopChrome.controlRadius,),- borderSide: BorderSide(- color: DesktopChrome.accent,- width: 1.5,- ),+ borderSide: BorderSide(color: DesktopChrome.rim),),fillColor: DesktopChrome.field,filled: true,@@ -523,12 +520,7 @@ class _ShortcutBrowserRow extends StatelessWidget {splashFactory: NoSplash.splashFactory,).copyWith(side: WidgetStateProperty.resolveWith(- (states) => BorderSide(- width: 1.5,- color: states.contains(WidgetState.focused)- ? DesktopChrome.accent- : Colors.transparent,- ),+ (states) => BorderSide(width: 1.5, color: Colors.transparent),),overlayColor: WidgetStateProperty.resolveWith((states) => DesktopChrome.foreground.withValues(diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex 3700560dc..18a2b95f2 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -24,7 +24,8 @@ import 'package:dio/dio.dart';import 'dart:ui'showColor,- Rect; // Rect: activeTileShape, the same one pane_preset.dart returns+ Rect, // Rect: activeTileShape, the same one pane_preset.dart returns+ Size;import 'package:flutter/foundation.dart';import 'package:flutter/widgets.dart'@@ -20150,8 +20151,9 @@ class AppNotifier extends ChangeNotifier {(_, slot) => slot >= insertion ? slot + 1 : slot,);final key = '${targetPanes.length}:manual';- target.savePaneSizes(key, split.after);- target.arranged = split.after;+ final after = _balancedIfAsked(split.after, target.arrangedMinimum);+ target.savePaneSizes(key, after);+ target.arranged = after;target.arrangedKey = key;}if (firstAgent &&@@ -20448,6 +20450,81 @@ class AppNotifier extends ChangeNotifier {/// Focus follows the PANE, not the slot: `focusedPaneId` is an id, so a tile/// that was focused stays focused after it moves, which is what the hand that/// dragged it expects.+ /// The arrangement after [paneId] lands on [side] of [targetPaneId]; null+ /// when it can't, or when it is already there.+ PaneArrangement? _moveBesideShape(+ int paneId,+ int targetPaneId,+ PaneSide side,+ ) {+ if (paneId == targetPaneId || zoomedPaneId != null) return null;+ if (activeSwarm.isUtility || activeSwarm.isOrchestrator) return null;+ final shape = activeTileShape;+ final from = panes.indexWhere((pane) => pane.id == paneId);+ final to = panes.indexWhere((pane) => pane.id == targetPaneId);+ if (shape == null || from == -1 || to == -1) return null;+ final current = PaneArrangement(shape);+ if (current.isBeside(from, to, side)) return null;+ final minimum = activeSwarm.arrangedMinimum ?? Size.zero;+ final moved = current.moveBeside(from, to, side, minimum: minimum);+ if (moved != null) return moved;+ // A layout whose hole no neighbour can fill: the rest fall back to their+ // count's shape, as closing a pane there does, so an edge always moves it.+ final rest = panes.length - 1;+ final tiles = (presetFor(rest) ?? PanePreset.defaultFor(rest))?.tilesFor(+ rest,+ );+ if (tiles == null || tiles.length != rest) return null;+ return PaneArrangement(tiles)+ .fillRowEnds()+ .split(to > from ? to - 1 : to, side.axis, minimum: minimum);+ }++ /// Whether [paneId] is already on [side] of [targetPaneId], so a drop there+ /// changes nothing.+ bool isPaneBeside(int paneId, int targetPaneId, PaneSide side) {+ final shape = activeTileShape;+ final from = panes.indexWhere((pane) => pane.id == paneId);+ final to = panes.indexWhere((pane) => pane.id == targetPaneId);+ if (shape == null || from == -1 || to == -1 || from == to) return false;+ return PaneArrangement(shape).isBeside(from, to, side);+ }++ /// Whether a drop on [side] of [targetPaneId] can land [paneId] there.+ bool canMovePaneBeside(int paneId, int targetPaneId, PaneSide side) =>+ _moveBesideShape(paneId, targetPaneId, side) != null;++ /// Dragging a pane to another's edge: it takes half of that pane's room, as+ /// the TUI's join-pane does, and its sessions stay untouched.+ bool movePaneBeside(int paneId, int targetPaneId, PaneSide side) {+ final next = _moveBesideShape(paneId, targetPaneId, side);+ if (next == null) return false;+ final moved = panes.removeAt(panes.indexWhere((p) => p.id == paneId));+ final target = panes.indexWhere((p) => p.id == targetPaneId);+ panes.insert(side.before ? target : target + 1, moved);+ // Pins stay with their panes, wherever the list moved them.+ for (final (slot, pane) in panes.indexed) {+ if (isPanePinned(pane)) _setPin(pane, slot);+ }+ final key = '${panes.length}:manual';+ final after = _balancedIfAsked(next, activeSwarm.arrangedMinimum);+ activeSwarm.savePaneSizes(key, after);+ activeSwarm.arranged = after;+ activeSwarm.arrangedKey = key;+ _paneLayoutRequest++;+ _persistLayout();+ notifyListeners();+ return true;+ }++ /// [arrangement] evened out when Autobalance splits is on.+ PaneArrangement _balancedIfAsked(+ PaneArrangement arrangement,+ Size? minimum,+ ) => appearancePrefsStore.value.panes.autobalanceSplits+ ? arrangement.balanced(minimum: minimum ?? Size.zero)+ : arrangement;+void reorderPane(int paneId, int targetPaneId, {bool reveal = false}) {if (paneId == targetPaneId) return;final from = panes.indexWhere((pane) => pane.id == paneId);diff --git a/desktop/lib/state/pane_arrangement.dart b/desktop/lib/state/pane_arrangement.dartindex 008b1582f..49edc2964 100644--- a/desktop/lib/state/pane_arrangement.dart+++ b/desktop/lib/state/pane_arrangement.dart@@ -3,6 +3,44 @@ import 'dart:ui';enum PaneResizeAxis { x, y }+/// Which edge of a pane another pane lands on.+enum PaneSide {+ left,+ right,+ top,+ bottom;++ PaneResizeAxis get axis =>+ this == left || this == right ? PaneResizeAxis.x : PaneResizeAxis.y;++ /// Whether the pane landing here comes before the pane it lands on.+ bool get before => this == left || this == top;+}++/// The edge a pointer at [local] in a pane of [size] means: within a quarter of+/// an edge, the nearest one, measured as a share of its band so a wide pane's+/// bands read alike. Null in the middle, which means trade places.+PaneSide? paneSideAt(Offset local, Size size) {+ if (size.isEmpty) return null;+ final x = (local.dx / size.width).clamp(0.0, 1.0);+ final y = (local.dy / size.height).clamp(0.0, 1.0);+ const band = 0.25;+ PaneSide? nearest;+ var closest = band;+ for (final (distance, side) in [+ (x, PaneSide.left),+ (1 - x, PaneSide.right),+ (y, PaneSide.top),+ (1 - y, PaneSide.bottom),+ ]) {+ if (distance < closest) {+ closest = distance;+ nearest = side;+ }+ }+ return nearest;+}+/// Normalized rectangles preserve the preset's topology while its dividers/// move. They describe slots, not sessions, so moving agents keeps their sizes.class PaneArrangement {@@ -44,6 +82,62 @@ class PaneArrangement {return changed ? PaneArrangement(filled) : this;}+ /// Whether tile [from] already sits on [side] of tile [to], the whole edge+ /// shared: landing there would only halve [to].+ bool isBeside(int from, int to, PaneSide side) {+ final a = tiles[from], b = tiles[to];+ bool same(double one, double other) => (one - other).abs() < _epsilon;+ return switch (side) {+ PaneSide.left =>+ same(a.right, b.left) && same(a.top, b.top) && same(a.bottom, b.bottom),+ PaneSide.right =>+ same(a.left, b.right) && same(a.top, b.top) && same(a.bottom, b.bottom),+ PaneSide.top =>+ same(a.bottom, b.top) && same(a.left, b.left) && same(a.right, b.right),+ PaneSide.bottom =>+ same(a.top, b.bottom) && same(a.left, b.left) && same(a.right, b.right),+ };+ }++ /// Tile [from] taken out and landed on [side] of tile [to], which gives up+ /// half its room. In the list, it sits just before or after [to]; the caller+ /// moves its pane to match. Null when the hole it leaves can't be filled.+ PaneArrangement? moveBeside(+ int from,+ int to,+ PaneSide side, {+ required Size minimum,+ }) {+ if (from == to || to < 0 || to >= tiles.length) return null;+ final rest = remove(from);+ if (rest == null) return null;+ return rest.split(to > from ? to - 1 : to, side.axis, minimum: minimum);+ }++ /// Every divider midway between its neighbours, as far as [minimum] allows.+ /// One pass only halves the difference along a run of tiles, so it repeats+ /// until nothing moves.+ PaneArrangement balanced({required Size minimum}) {+ var current = this;+ for (var pass = 0; pass < 32; pass++) {+ var moved = false;+ for (var i = 0; i < current.dividers.length; i++) {+ final divider = current.dividers[i];+ final next = current.resize(+ divider,+ current.balancedPosition(divider),+ minimum: minimum,+ );+ if (!identical(next, current)) {+ current = next;+ moved = true;+ }+ }+ if (!moved) break;+ }+ return current;+ }+PaneArrangement? split(int index,PaneResizeAxis axis, {diff --git a/desktop/lib/store/store_harness_actions.dart b/desktop/lib/store/store_harness_actions.dartindex 65e31ca98..d9e91f809 100644--- a/desktop/lib/store/store_harness_actions.dart+++ b/desktop/lib/store/store_harness_actions.dart@@ -227,51 +227,43 @@ class _StoreHarnessActionsState extends State<StoreHarnessActions> {crossAxisAlignment: WrapCrossAlignment.center,children: [if (targets.isNotEmpty)- MenuAnchor(+ AppDropdown(controller: _menu,childFocusNode: _buttonFocus,- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(maxHeight: 360),- menuChildren: [- SizedBox(- width: menuWidth,- child: Padding(- padding: const EdgeInsets.fromLTRB(18, 12, 18, 8),- child: Text(- 'Recent harnesses',- style: grid.AppType.label(- color: grid.AppPalette.textSecondary,- ),+ width: menuWidth,+ maxHeight: 360,+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 6),+ child: Text(+ 'Recent harnesses',+ style: grid.AppType.label(+ color: grid.AppPalette.textSecondary,),),),for (var i = 0; i < targets.length; i++)- SizedBox(- width: menuWidth,- child: Tooltip(- message: targets[i].tooltip,- child: AppMenuItem(- key: ValueKey(- 'store-resume-choice:${targets[i].destinationId}',- ),- focusNode: i == 0 ? _firstChoiceFocus : null,- metrics: AppMenuRowMetrics.roomy,- icon: AppIcons.history,- label: targets[i].title,- detail: targets[i].detail,- trailing: targets[i].machine.nodeOnline == false- ? Tooltip(- message: 'Machine offline',- child: Icon(- AppIcons.cloudOff,- size: 14,- color: grid.AppPalette.textFaint,- ),- )- : null,- onPressed: () => _resume(targets[i]),+ Tooltip(+ message: targets[i].tooltip,+ child: AppMenuItem(+ key: ValueKey(+ 'store-resume-choice:${targets[i].destinationId}',),+ focusNode: i == 0 ? _firstChoiceFocus : null,+ icon: AppIcons.history,+ label: targets[i].title,+ detail: targets[i].detail,+ trailing: targets[i].machine.nodeOnline == false+ ? Tooltip(+ message: 'Machine offline',+ child: Icon(+ AppIcons.cloudOff,+ size: 14,+ color: grid.AppPalette.textFaint,+ ),+ )+ : null,+ onPressed: () => _resume(targets[i]),),),],diff --git a/desktop/lib/store/store_search.dart b/desktop/lib/store/store_search.dartindex 1cc0522f2..027d6bf48 100644--- a/desktop/lib/store/store_search.dart+++ b/desktop/lib/store/store_search.dart@@ -324,7 +324,7 @@ class _Field extends StatelessWidget {decoration: InputDecoration(hintText: 'Search harnesses',hintStyle: grid.AppType.body(- color: grid.AppPalette.textSecondary,+ color: grid.AppPalette.textFaint,),isCollapsed: true,constraints: const BoxConstraints(),diff --git a/desktop/lib/super_tabs/activity_view.dart b/desktop/lib/super_tabs/activity_view.dartindex 51f1e4077..b20774f5f 100644--- a/desktop/lib/super_tabs/activity_view.dart+++ b/desktop/lib/super_tabs/activity_view.dart@@ -103,10 +103,11 @@ class _SuperTabActivityViewState extends State<SuperTabActivityView> {);Widget _empty(String text) => Padding(+ // Under the page title's edge.padding: const EdgeInsets.fromLTRB(+ grid.AppDesktop.panelPadding,grid.AppDesktop.groupGap,- grid.AppDesktop.groupGap,- grid.AppDesktop.groupGap,+ grid.AppDesktop.panelPadding,grid.AppDesktop.controlGap,),child: Text(text, style: DesktopChrome.metadata()),diff --git a/desktop/lib/super_tabs/buddy_machines.dart b/desktop/lib/super_tabs/buddy_machines.dartindex 4b28a2e91..928a39901 100644--- a/desktop/lib/super_tabs/buddy_machines.dart+++ b/desktop/lib/super_tabs/buddy_machines.dart@@ -141,57 +141,48 @@ class _BuddyMachineFieldState extends State<BuddyMachineField> {if (!widget.busy) _menu.open();}- Widget _heading(double width) => SizedBox(- width: width,- child: Padding(- padding: EdgeInsets.fromLTRB(- AppMenuRowMetrics.roomy.padding.left + grid.AppDesktop.menuInset,- grid.AppDesktop.menuInset,- AppMenuRowMetrics.roomy.padding.right + grid.AppDesktop.menuInset,- grid.AppDesktop.listRowGap,- ),- child: Semantics(- header: true,- child: Text(- kBuddyOwnMachines,- style: DesktopChrome.control(medium: true),- ),+ Widget _heading() => Padding(+ padding: EdgeInsets.fromLTRB(+ AppMenuRowMetrics.compact.padding.left + grid.AppDesktop.menuInset,+ grid.AppDesktop.menuInset,+ AppMenuRowMetrics.compact.padding.right + grid.AppDesktop.menuInset,+ grid.AppDesktop.listRowGap,+ ),+ child: Semantics(+ header: true,+ child: Text(+ kBuddyOwnMachines,+ style: DesktopChrome.control(medium: true),),),);- Widget _row(BuddyMachine m, double width, String? focusId) {+ Widget _row(BuddyMachine m, String? focusId) {final block = buddyMachineBlock(m);- return Padding(- padding: const EdgeInsets.symmetric(- horizontal: grid.AppDesktop.menuInset,- vertical: grid.AppDesktop.listRowGap / 2,- ),- child: SizedBox(- width: width - 2 * grid.AppDesktop.menuInset,- child: MenuItemButton(- key: ValueKey('super-buddy-machine-option-${m.id}'),- autofocus: m.id == focusId,- overflowAxis: Axis.vertical,- semanticsLabel: [m.name, ?block].join(', '),- style: ButtonStyle(- side: const WidgetStatePropertyAll(BorderSide.none),- padding: WidgetStatePropertyAll(AppMenuRowMetrics.roomy.padding),- ),- onPressed: widget.busy || block != null- ? null- : () => widget.onChanged(m.id),- // In words, never by its grey alone (design system, Color and state).- trailingIcon: block != null- ? Text(- block,- style: DesktopChrome.metadata(color: DesktopChrome.muted),- )- : m.id == widget.value- ? const Icon(AppIcons.check, size: grid.AppControl.iconSize)- : null,- child: Text(m.name, maxLines: 1, overflow: TextOverflow.ellipsis),- ),+ final choose = widget.busy || block != null+ ? null+ : () => widget.onChanged(m.id);+ return Semantics(+ button: true,+ enabled: choose != null,+ selected: m.id == widget.value,+ onTap: choose,+ label: [m.name, ?block].join(', '),+ excludeSemantics: true,+ child: AppMenuItem(+ key: ValueKey('super-buddy-machine-option-${m.id}'),+ autofocus: m.id == focusId,+ leadingSlot: false,+ label: m.name,+ selected: block == null && m.id == widget.value,+ // In words, never by its grey alone (design system, Color and state).+ trailing: block == null+ ? null+ : Text(+ block,+ style: DesktopChrome.metadata(color: DesktopChrome.muted),+ ),+ onPressed: choose,),);}@@ -224,17 +215,15 @@ class _BuddyMachineFieldState extends State<BuddyMachineField> {final menuWidth = width < BuddyMachineField.menuMinWidth? BuddyMachineField.menuMinWidth: width;- return MenuAnchor(+ return AppDropdown(controller: _menu,childFocusNode: _focus,- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(minWidth: menuWidth, maxWidth: menuWidth),+ width: menuWidth,onOpen: () => setState(() {}),onClose: () => setState(() {}),- menuChildren: [- _heading(menuWidth),- for (final m in widget.machines) _row(m, menuWidth, focusId),+ children: [+ _heading(),+ for (final m in widget.machines) _row(m, focusId),],builder: (context, menu, _) => CallbackShortcuts(bindings: {diff --git a/desktop/lib/super_tabs/buddy_model.dart b/desktop/lib/super_tabs/buddy_model.dartindex 0cec9837e..52a5304d3 100644--- a/desktop/lib/super_tabs/buddy_model.dart+++ b/desktop/lib/super_tabs/buddy_model.dart@@ -169,20 +169,17 @@ class _BuddyModelLineState extends State<BuddyModelLine> {),child: Text(text, style: DesktopChrome.metadata()),);- return MenuAnchor(+ return AppDropdown(controller: _menu,- consumeOutsideTap: true,- // Held to the style's width, so the longer lines wrap.- crossAxisUnconstrained: false,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(minWidth: 220, maxWidth: 440, maxHeight: 520),- menuChildren: [+ // Wide enough for a model and its servers; the longer lines wrap.+ width: 320,+ maxHeight: 520,+ children: [row(AppMenuItem(icon: current == null ? AppIcons.check : null,label: 'Your subscription',note: 'Claude Code',- expandLabel: true,onPressed: () => _pick(null),),),diff --git a/desktop/lib/super_tabs/day_pill.dart b/desktop/lib/super_tabs/day_pill.dartindex 5ba70eff8..c18fc11be 100644--- a/desktop/lib/super_tabs/day_pill.dart+++ b/desktop/lib/super_tabs/day_pill.dart@@ -374,9 +374,10 @@ class _SuperTabDayJumpState extends State<_SuperTabDayJump> {grid.AppTheme.watch(context);final today = DateUtils.dateOnly(DateTime.now());final day = widget.day.isAfter(today) ? today : widget.day;- return MenuAnchor(+ return AppDropdown(controller: _menu,childFocusNode: _focus,+ width: _picking ? _calendar.width : 220,// Opened from the keyboard, the first choice is the next key's target;// a click leaves none lit, with the keys on the pill, so Esc still// closes it.@@ -389,15 +390,12 @@ class _SuperTabDayJumpState extends State<_SuperTabDayJump> {onClose: () {if (mounted) setState(() => _picking = false);},- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),style: grid.AppMenu.style(- minWidth: 220,maxHeight: _picking? _calendar.height + grid.AppMenu.panelPadding.vertical: null,),- menuChildren: _picking+ children: _picking? [SizedBox.fromSize(size: _calendar,@@ -428,14 +426,14 @@ class _SuperTabDayJumpState extends State<_SuperTabDayJump> {AppMenuItem(focusNode: index == 0 ? _first : null,label: choice.label,- expandLabel: true,onPressed: () =>_jump(superTabJumpStart(choice, DateTime.now())),),const AppMenuDivider(),AppMenuItem(label: 'Jump to a specific date',- expandLabel: true,+ // Stays open: the panel turns into the calendar.+ closesMenu: false,onPressed: () => setState(() => _picking = true),),],diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dartindex 62975346f..a8b739e90 100644--- a/desktop/lib/super_tabs/machines.dart+++ b/desktop/lib/super_tabs/machines.dart@@ -15,6 +15,7 @@ import '../shared/theme/appearance_prefs_store.dart';import '../shared/theme/status_line_style.dart';import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_icon_button.dart';+import '../shared/widgets/app_menu.dart';import '../state/app_state.dart';import '../state/harness_activity.dart';import '../terminal/terminal_theme.dart';@@ -25,6 +26,7 @@ import '../widgets/finger_target.dart';import '../widgets/desktop_chrome.dart';import '../widgets/engine_identity.dart';import '../widgets/harness_activity_mark.dart';+import '../widgets/pane_menu.dart' show showContextMenuAt;import '../widgets/workspace_subscription_usage.dart';import 'add_computers.dart';import 'agent_details.dart';@@ -1807,23 +1809,24 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {BrowserMenuGuard.hold(hold);final String? choice;try {- choice = await showMenu<String>(+ choice = await showContextMenuAt<String>(context: context,- position: RelativeRect.fromLTRB(at.dx, at.dy, at.dx, at.dy),- items: [- const PopupMenuItem(value: 'details', child: Text('Details')),+ at: at,+ children: (close) => [+ AppMenuItem(+ label: 'Details',+ leadingSlot: false,+ onPressed: () => close('details'),+ ),if (_canRemove(view.id))- PopupMenuItem(- key: ValueKey('super-machine-menu-remove'),- value: 'remove',- enabled: _removeReason(view.id) == null,- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const Text('Remove from Swarm'),- if (_removeReason(view.id) case final reason?) Text(reason),- ],- ),+ AppMenuItem(+ key: const ValueKey('super-machine-menu-remove'),+ label: 'Remove from Swarm',+ detail: _removeReason(view.id),+ leadingSlot: false,+ onPressed: _removeReason(view.id) == null+ ? () => close('remove')+ : null,),],);diff --git a/desktop/lib/super_tabs/manage_page.dart b/desktop/lib/super_tabs/manage_page.dartindex 536e4b282..27757785a 100644--- a/desktop/lib/super_tabs/manage_page.dart+++ b/desktop/lib/super_tabs/manage_page.dart@@ -6,6 +6,7 @@ import '../core/machine_resources.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/theme/appearance_prefs_store.dart';import '../shared/widgets/app_dialog.dart';+import '../shared/widgets/app_menu.dart';import '../state/app_state.dart';import '../terminal/terminal_theme_store.dart';import '../widgets/desktop_chrome.dart';@@ -46,39 +47,15 @@ class SuperTabManageTabs extends StatelessWidget {@overrideWidget build(BuildContext context) {- Widget tab(SuperTabManageTab value, String label) {- final on = selected == value;- return Padding(- padding: const EdgeInsets.only(right: grid.AppDesktop.menuInset),- child: Material(- color: on ? grid.AppSurface.selectedFill : Colors.transparent,- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),- clipBehavior: Clip.antiAlias,- child: InkWell(- key: ValueKey('super-manage-tab-${value.name}'),- onTap: () => onChoose(value),- hoverColor: grid.AppSurface.hoverFill,- child: Semantics(- selected: on,- button: true,- child: Padding(- padding: const EdgeInsets.symmetric(- horizontal: grid.AppDesktop.controlGap,- vertical: grid.AppDesktop.menuInset,- ),- child: Text(- label,- style: DesktopChrome.control(- medium: on,- color: on ? null : DesktopChrome.muted,- ),- ),- ),- ),- ),- ),- );- }+ Widget tab(SuperTabManageTab value, String label) => Padding(+ padding: const EdgeInsets.only(right: grid.AppDesktop.menuInset),+ child: AppTabPill(+ tapKey: ValueKey('super-manage-tab-${value.name}'),+ label: label,+ selected: selected == value,+ onTap: () => onChoose(value),+ ),+ );return Padding(padding: const EdgeInsets.symmetric(diff --git a/desktop/lib/super_tabs/message_more_menu.dart b/desktop/lib/super_tabs/message_more_menu.dartindex 7393e9baa..f9af34a64 100644--- a/desktop/lib/super_tabs/message_more_menu.dart+++ b/desktop/lib/super_tabs/message_more_menu.dart@@ -50,9 +50,10 @@ class _SuperTabMessageMoreMenuState extends State<SuperTabMessageMoreMenu> {@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);- return MenuAnchor(+ return AppDropdown(controller: _menu,childFocusNode: _focus,+ width: 200,// Opened from the keyboard (More had the focus), the first choice is// the next key's target; a pointer opens it with none focused.onOpen: () {@@ -61,43 +62,29 @@ class _SuperTabMessageMoreMenuState extends State<SuperTabMessageMoreMenu> {(_) => _first.requestFocus(),);},- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(minWidth: 200),- menuChildren: [+ children: [for (final (index, action) in widget.actions.indexed)if (action.choices.isEmpty)AppMenuItem(focusNode: index == 0 ? _first : null,label: action.label,icon: action.icon,- expandLabel: true,- onPressed: () {- _menu.close();- action.onPressed?.call();- },+ onPressed: action.onPressed,)else- SubmenuButton(- key: ValueKey('super-message-more-${action.label}'),+ AppSubmenuItem(+ itemKey: ValueKey('super-message-more-${action.label}'),focusNode: index == 0 ? _first : null,- leadingIcon: Icon(action.icon, size: AppIcons.inlineSize),- submenuIcon: const WidgetStatePropertyAll(- Icon(AppIcons.chevronRight, size: AppIcons.inlineSize),+ icon: action.icon,+ label: action.label,+ trailing: const Icon(+ AppIcons.chevronRight,+ size: AppIcons.inlineSize,),- menuStyle: grid.AppMenu.style(minWidth: 180),menuChildren: [for (final choice in action.choices)- AppMenuItem(- label: choice.label,- expandLabel: true,- onPressed: () {- _menu.close();- choice.onPressed();- },- ),+ AppMenuItem(label: choice.label, onPressed: choice.onPressed),],- child: Text(action.label),),],builder: (context, menu, _) => AppIconButton(diff --git a/desktop/lib/super_tabs/pane_layout.dart b/desktop/lib/super_tabs/pane_layout.dartindex f17a70fb7..a241ee13b 100644--- a/desktop/lib/super_tabs/pane_layout.dart+++ b/desktop/lib/super_tabs/pane_layout.dart@@ -171,7 +171,7 @@ class _SuperTabPaneLayoutState extends State<SuperTabPaneLayout> {SizedBox(key: const ValueKey('super-right-pane'),width: right,- child: SuperTabRightPane(child: widget.right!),+ child: widget.right,),],),@@ -243,39 +243,3 @@ class _SuperTabPaneLayoutState extends State<SuperTabPaneLayout> {},);}--/// A pane on the right of a Swarm chat (a thread, a task, Members), beside it-/// or over it as a drawer. Along its left edge it lays the design system's-/// pane shade over the chat, so the two read as separate surfaces, as in-/// Slack (Huy, 11-03). The pane is drawn after the chat, so the shade lies on-/// the chat; it takes no pointer, so the chat beneath it still gets clicks.-class SuperTabRightPane extends StatelessWidget {- const SuperTabRightPane({super.key, required this.child});-- final Widget child;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Stack(- fit: StackFit.passthrough,- clipBehavior: Clip.none,- children: [- child,- Positioned(- top: 0,- bottom: 0,- left: -grid.AppDesktop.paneEdgeShadeWidth,- width: grid.AppDesktop.paneEdgeShadeWidth,- child: IgnorePointer(- child: DecoratedBox(- decoration: BoxDecoration(- gradient: grid.AppDesktop.paneEdgeShade,- ),- ),- ),- ),- ],- );- }-}diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dartindex 64d5b9682..009ef97b1 100644--- a/desktop/lib/super_tabs/project_sidebar.dart+++ b/desktop/lib/super_tabs/project_sidebar.dart@@ -111,6 +111,9 @@ class ProjectSidebar extends StatelessWidget {static const _iconColumn = SuperTabSectionHeading.actionWidth;static const _rowEnd = 10.0;+ /// Under the chat box and under Manage beside it, so the two end on one line.+ static const double footGap = 16;+/// A sidebar section's heading, as Slack's "Channels": the row's size, medium and muted. A phone keeps the/// heading's own.TextStyle? get _headingStyle => compact@@ -630,7 +633,8 @@ class ProjectSidebar extends StatelessWidget {final projects = snapshot?.projects ?? const <SuperTabProject>[];final reading = _SidebarReading(controller, needsHuman, attention);return Material(- color: DesktopChrome.surface,+ // The page's color: the rule at its edge is what separates them.+ color: grid.AppPalette.swarmWelcome,child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [@@ -731,8 +735,13 @@ class ProjectSidebar extends StatelessWidget {// At the foot, however long the list (Quiet Swarm, screen 1).if (onManage != null)Padding(- padding: const EdgeInsets.symmetric(- horizontal: grid.AppDesktop.controlGap,+ // On the chat box's bottom line, less the row's own 2 under it. A+ // phone's has no box beside it, and keeps the list's 8.+ padding: EdgeInsets.fromLTRB(+ grid.AppDesktop.controlGap,+ 0,+ grid.AppDesktop.controlGap,+ (compact ? grid.AppDesktop.controlGap : footGap) - 2,),child: _navigationRow(key: 'super-manage',diff --git a/desktop/lib/super_tabs/project_visibility.dart b/desktop/lib/super_tabs/project_visibility.dartindex 430b4f848..07b2ba907 100644--- a/desktop/lib/super_tabs/project_visibility.dart+++ b/desktop/lib/super_tabs/project_visibility.dart@@ -38,35 +38,25 @@ class _ProjectVisibilityState extends State<ProjectVisibility> {@overrideWidget build(BuildContext context) {final width = (MediaQuery.sizeOf(context).width - 32).clamp(0.0, 360.0);- return MenuAnchor(+ return AppDropdown(controller: _menu,childFocusNode: _focus,- consumeOutsideTap: true,+ width: width,alignmentOffset: Offset(-width, grid.AppControl.menuGap),- style: grid.AppMenu.style(- minWidth: width,- maxWidth: width,- ).copyWith(alignment: AlignmentDirectional.bottomEnd),- menuChildren: [+ alignment: AlignmentDirectional.bottomEnd,+ children: [for (final (id, title, detail) in const [('public', 'Public', 'Everyone in this swarm'),('private', 'Private', 'Only people you invite to this project'),])- SizedBox(- width: width,- child: Tooltip(- message: detail,- child: AppMenuItem(- label: title,- detail: detail,- icon: id == 'private' ? AppIcons.lock : AppIcons.users,- selected: id == widget.value,- expandLabel: true,- onPressed: () {- _menu.close();- widget.onChanged?.call(id);- },- ),+ Tooltip(+ message: detail,+ child: AppMenuItem(+ label: title,+ detail: detail,+ icon: id == 'private' ? AppIcons.lock : AppIcons.users,+ selected: id == widget.value,+ onPressed: () => widget.onChanged?.call(id),),),],diff --git a/desktop/lib/super_tabs/pull_requests.dart b/desktop/lib/super_tabs/pull_requests.dartindex a4023f663..25b85aee5 100644--- a/desktop/lib/super_tabs/pull_requests.dart+++ b/desktop/lib/super_tabs/pull_requests.dart@@ -10,6 +10,7 @@ import '../shared/theme/pull_request_icon.dart';import '../shared/theme/app_theme.dart' as grid;import 'pull_request_entry.dart';import '../shared/theme/app_icons.dart';+import '../shared/widgets/app_select_field.dart';import '../state/app_state.dart';import '../widgets/desktop_chrome.dart';import 'controller.dart';@@ -536,18 +537,20 @@ class _SuperTabPullRequestsState extends State<SuperTabPullRequests> {if (c.snapshot?.isProjectLead(c.selectedId) == true)Text('This project', style: DesktopChrome.metadata())else- DropdownButton<bool>(+ AppSelectField<bool>(value: _all,- underline: const SizedBox.shrink(),- items: const [- DropdownMenuItem(value: false, child: Text('This group')),- DropdownMenuItem(value: true, child: Text('This project')),+ width: AppSelectField.fitWidth(+ context,+ labels: const ['This group', 'This project'],+ ),+ semanticLabel: 'Show',+ options: const [+ SelectOption(value: false, label: 'This group'),+ SelectOption(value: true, label: 'This project'),],onChanged: (value) {- if (value != null) {- setState(() => _all = value);- _changed();- }+ setState(() => _all = value);+ _changed();},),],diff --git a/desktop/lib/super_tabs/reply_box.dart b/desktop/lib/super_tabs/reply_box.dartindex 0571a6d54..6c3509acd 100644--- a/desktop/lib/super_tabs/reply_box.dart+++ b/desktop/lib/super_tabs/reply_box.dart@@ -143,7 +143,7 @@ class SuperTabReplyBox extends StatelessWidget {hintText: hint,hintStyle: SwarmType.composer(context,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),contentPadding: EdgeInsets.zero,border: InputBorder.none,diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dartindex b03d9d9e2..6e9b2ed94 100644--- a/desktop/lib/super_tabs/roster.dart+++ b/desktop/lib/super_tabs/roster.dart@@ -13,6 +13,7 @@ import '../shared/widgets/app_icon_button.dart';import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_menu.dart';import '../shared/widgets/app_select_field.dart';+import '../widgets/pane_menu.dart' show showContextMenuAt;import '../state/app_state.dart';import '../state/harness_activity.dart';import '../terminal/terminal_theme.dart';@@ -413,28 +414,23 @@ class _SuperTabRosterState extends State<SuperTabRoster>BrowserMenuGuard.hold(hold);final String? choice;try {- choice = await showMenu<String>(+ choice = await showContextMenuAt<String>(context: context,- position: RelativeRect.fromLTRB(- event.globalPosition.dx,- event.globalPosition.dy,- event.globalPosition.dx,- event.globalPosition.dy,- ),- items: [- const PopupMenuItem(value: 'details', child: Text('Details')),+ at: event.globalPosition,+ children: (close) => [+ AppMenuItem(+ label: 'Details',+ leadingSlot: false,+ onPressed: () => close('details'),+ ),if (_canRemove(c.snapshot?.agent(agent.id) ?? agent))- PopupMenuItem(- value: 'remove',- enabled: _removeReason(agent) == null,- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const Text('Remove from Swarm'),- if (_removeReason(agent) case final reason?)- Text(reason),- ],- ),+ AppMenuItem(+ label: 'Remove from Swarm',+ detail: _removeReason(agent),+ leadingSlot: false,+ onPressed: _removeReason(agent) == null+ ? () => close('remove')+ : null,),],);@@ -708,13 +704,20 @@ class _SuperTabRosterState extends State<SuperTabRoster>/// and its close at the right as a thread's has.Widget _heading(bool? narrowed) {final style = DesktopChrome.heading();- return Padding(+ // The conversation header's height with its rule, so the pill and the close+ // sit on the same line as the title beside them.+ return Container(key: const ValueKey('super-members-heading'),+ constraints: const BoxConstraints(minHeight: 52),+ margin: const EdgeInsets.only(bottom: DesktopChrome.controlGap),padding: const EdgeInsets.fromLTRB(DesktopChrome.groupGap,0,DesktopChrome.controlGap,- DesktopChrome.controlGap,+ 0,+ ),+ decoration: BoxDecoration(+ border: Border(bottom: BorderSide(color: grid.AppPalette.divider)),),child: Row(children: [@@ -769,7 +772,7 @@ class _SuperTabRosterState extends State<SuperTabRoster>Widget build(BuildContext context) {grid.AppTheme.watch(context);return Material(- color: DesktopChrome.surface,+ color: grid.AppPalette.swarmWelcome,child: ListenableBuilder(listenable: Listenable.merge([c,@@ -781,7 +784,7 @@ class _SuperTabRosterState extends State<SuperTabRoster>]),builder: (context, _) => LaidOutListView(key: PageStorageKey('super-tab-resources-${c.tabId}'),- padding: const EdgeInsets.symmetric(vertical: 12),+ padding: const EdgeInsets.only(bottom: 12),children: _members(),),),@@ -826,12 +829,11 @@ class _AddAgentMenuState extends State<_AddAgentMenu> {@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);- return MenuAnchor(+ return AppDropdown(controller: _menu,- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(minWidth: 240),- menuChildren: [+ // Fits the longer label on one line.+ width: 300,+ children: [for (final (label, icon, run) in [('Import an agent running on this Mac',@@ -843,7 +845,6 @@ class _AddAgentMenuState extends State<_AddAgentMenu> {AppMenuItem(label: label,icon: icon,- expandLabel: true,onPressed: () {_menu.close();run();diff --git a/desktop/lib/super_tabs/swarm_switcher.dart b/desktop/lib/super_tabs/swarm_switcher.dartindex 961ed869b..b8fe5a6c6 100644--- a/desktop/lib/super_tabs/swarm_switcher.dart+++ b/desktop/lib/super_tabs/swarm_switcher.dart@@ -453,62 +453,48 @@ class _SwarmSwitcherState extends State<SwarmSwitcher> {crossAxisAlignment: CrossAxisAlignment.stretch,mainAxisSize: MainAxisSize.min,children: [- MenuAnchor(+ AppDropdown(controller: _menu,- consumeOutsideTap: true,- alignmentOffset: const Offset(0, grid.AppControl.menuGap),- style: grid.AppMenu.style(- minWidth: width,- maxWidth: width,- maxHeight: 480,- ),+ // The size of every other dropdown, not the sidebar's full+ // width.+ width: width > AppDropdown.defaultWidth+ ? AppDropdown.defaultWidth+ : width,onOpen: () {if (_tab case final tab?) personal.clearError(tab);},- // As wide as the row it opens from.- menuChildren: [- for (final item in <Widget>[- AppMenuItem(- key: const ValueKey('swarm-switch-personal'),- label: kPersonalSwarmName,- icon: AppIcons.user,- selected: isPersonal,- expandLabel: true,- trailing: personal.busy- ? const SizedBox.square(- dimension: 12,- child: CircularProgressIndicator(- strokeWidth: 1.5,- ),- )- : badge(personalWaiting),- onPressed: _pickPersonal,- ),- for (final choice in choices)- AppMenuItem(- key: ValueKey('swarm-switch-${choice.id}'),- label: choice.name,- icon: AppIcons.users,- selected: choice.id == current,- expandLabel: true,- trailing: choice.id == current- ? null- : badge(choice.waiting),- onPressed: () => _pick(choice.id),- ),- const AppMenuDivider(),+ children: [+ AppMenuItem(+ key: const ValueKey('swarm-switch-personal'),+ label: kPersonalSwarmName,+ icon: AppIcons.user,+ selected: isPersonal,+ trailing: personal.busy+ ? const SizedBox.square(+ dimension: 12,+ child: CircularProgressIndicator(strokeWidth: 1.5),+ )+ : badge(personalWaiting),+ onPressed: _pickPersonal,+ ),+ for (final choice in choices)AppMenuItem(- key: const ValueKey('swarm-switch-new'),- label: 'New Swarm',- icon: AppIcons.plus,- expandLabel: true,- onPressed: () {- _menu.close();- widget.onNewSwarm();- },+ key: ValueKey('swarm-switch-${choice.id}'),+ label: choice.name,+ icon: AppIcons.users,+ selected: choice.id == current,+ trailing: choice.id == current+ ? null+ : badge(choice.waiting),+ onPressed: () => _pick(choice.id),),- ])- SizedBox(width: width, child: item),+ const AppMenuDivider(),+ AppMenuItem(+ key: const ValueKey('swarm-switch-new'),+ label: 'New Swarm',+ icon: AppIcons.plus,+ onPressed: widget.onNewSwarm,+ ),],builder: (context, menu, _) => Semantics(label: 'Swarm: $label',diff --git a/desktop/lib/super_tabs/switch_pm.dart b/desktop/lib/super_tabs/switch_pm.dartindex ff012023f..5027084e2 100644--- a/desktop/lib/super_tabs/switch_pm.dart+++ b/desktop/lib/super_tabs/switch_pm.dart@@ -3,6 +3,7 @@ import 'dart:async';import 'package:flutter/material.dart';import '../shared/widgets/app_dialog.dart';+import '../shared/widgets/app_select_field.dart';import '../state/lead_placement.dart';import '../usage/usage_account_key.dart';import '../widgets/desktop_chrome.dart';@@ -260,21 +261,16 @@ Future<void> showSwitchPm(children: [const SizedBox(width: 74, child: Text('Machine')),Expanded(- child: DropdownButtonFormField<String>(+ child: AppSelectField<String?>(key: const ValueKey('switch-pm-machine'),- initialValue: machineId,- isExpanded: true,- decoration: const InputDecoration(isDense: true),- items: [+ value: machineId,+ options: [for (final pool in machineRows)- DropdownMenuItem<String>(+ SelectOption<String?>(value: pool['machineId'] as String,enabled: unavailable(pool) == null,- child: Text(- '${superTabMachineName(pool['name'] as String? ?? 'Mac')}${pool['machineId'] == currentLead?.machineId ? ' · Current' : ''}${unavailable(pool) == null ? '' : ' · ${unavailable(pool)}'}',- maxLines: 1,- overflow: TextOverflow.ellipsis,- ),+ label:+ '${superTabMachineName(pool['name'] as String? ?? 'Mac')}${pool['machineId'] == currentLead?.machineId ? ' · Current' : ''}${unavailable(pool) == null ? '' : ' · ${unavailable(pool)}'}',),],onChanged: (value) => update(() {@@ -335,20 +331,18 @@ Future<void> showSwitchPm(children: [const SizedBox(width: 74, child: Text('Model')),Expanded(- child: DropdownButtonFormField<String?>(+ child: AppSelectField<String?>(key: const ValueKey('switch-pm-model'),- initialValue: model,- isExpanded: true,- decoration: const InputDecoration(isDense: true),- items: [- const DropdownMenuItem<String?>(+ value: model,+ options: [+ const SelectOption<String?>(value: null,- child: Text('Default'),+ label: 'Default',),for (final value in offeredModels.toSet())- DropdownMenuItem<String?>(+ SelectOption<String?>(value: value,- child: Text(value),+ label: value,),],onChanged: (value) => update(() => model = value),diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex bf918496f..f0fa21af0 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -13,6 +13,7 @@ import '../shared/theme/app_icons.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_icon_button.dart';+import '../shared/widgets/app_menu.dart';import '../shared/widgets/empty_state.dart';import '../widgets/desktop_chrome.dart';import '../widgets/finger_target.dart';@@ -1008,52 +1009,57 @@ class _SuperTabViewState extends State<SuperTabView>final chosen = projects.where((p) => p.id == _chosenSessionProject()).firstOrNull;- return PopupMenuButton<String>(- key: const ValueKey('super-chat-session-project'),- enabled: writable,- tooltip: 'Where this session works',- initialValue: chosen?.id ?? '',- onSelected: c.chooseSessionProject,- itemBuilder: (_) => [- PopupMenuItem(- key: const ValueKey('super-chat-session-any'),- value: '',- child: Tooltip(- message: 'Reads every project you read. Sends no work to a PM.',- child: Text(- 'All projects · ask anything',- style: DesktopChrome.control(),- ),+ return AppDropdown(+ width: 300,+ children: [+ Tooltip(+ message: 'Reads every project you read. Sends no work to a PM.',+ child: AppMenuItem(+ key: const ValueKey('super-chat-session-any'),+ label: 'All projects · ask anything',+ selected: chosen == null,+ onPressed: () => c.chooseSessionProject(''),),),for (final project in projects)- PopupMenuItem(- key: ValueKey('super-chat-session-in-${project.id}'),- value: project.id,- child: Tooltip(- message:- 'Reads only ${project.name}, and can hand work to its PM.',- child: Text(- '${project.name} · ask and hand off work',- style: DesktopChrome.control(),- ),+ Tooltip(+ message: 'Reads only ${project.name}, and can hand work to its PM.',+ child: AppMenuItem(+ key: ValueKey('super-chat-session-in-${project.id}'),+ label: '${project.name} · ask and hand off work',+ selected: chosen?.id == project.id,+ onPressed: () => c.chooseSessionProject(project.id),),),],- child: Padding(- padding: const EdgeInsets.symmetric(- horizontal: grid.AppDesktop.badgeInset,- vertical: grid.AppDesktop.listRowGap,- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- Text(- chosen?.name ?? 'All projects',- style: DesktopChrome.metadata(),+ builder: (context, menu, _) => Tooltip(+ message: 'Where this session works',+ child: InkWell(+ key: const ValueKey('super-chat-session-project'),+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),+ onTap: writable+ ? () => menu.isOpen ? menu.close() : menu.open()+ : null,+ child: Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: grid.AppDesktop.badgeInset,+ vertical: grid.AppDesktop.listRowGap,),- Icon(AppIcons.chevronDown, size: 12, color: DesktopChrome.muted),- ],+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ chosen?.name ?? 'All projects',+ style: DesktopChrome.metadata(),+ ),+ Icon(+ AppIcons.chevronDown,+ size: 12,+ color: DesktopChrome.muted,+ ),+ ],+ ),+ ),),),);@@ -1706,6 +1712,10 @@ class _SuperTabViewState extends State<SuperTabView>needsHuman: (group) => _needsHuman(group).length,onSelect: (id) {setState(() => _showNotifications = _showManage = _showTasks = false);+ // Choosing a conversation leaves the Manage pane: its Devices page left+ // the controller's flag set, so the sidebar's Manage row stayed lit while+ // a conversation was open.+ c.leaveDevices();c.select(id);_closeSidebar();},@@ -1717,6 +1727,7 @@ class _SuperTabViewState extends State<SuperTabView>/// none yet: the sidebar's way in and ⇧⌘K's/// ([SuperTabController.buddyChatOpener]).Future<bool> _openBuddyChat(String projectId) {+ c.leaveDevices();setState(() {_showNotifications = _showManage = false;_showPullRequests = _showTasks = false;@@ -1751,6 +1762,7 @@ class _SuperTabViewState extends State<SuperTabView>void _openActivity({SuperTabController? from}) {if (!mounted || (from != null && from != c)) return;_closeSidebar();+ c.leaveDevices();setState(() {_showNotifications = true;_showManage = false;@@ -3110,63 +3122,55 @@ class _SuperTabViewState extends State<SuperTabView>);}- static const _menuStyle = MenuStyle(- minimumSize: WidgetStatePropertyAll(Size(220, 0)),- padding: WidgetStatePropertyAll(EdgeInsets.all(grid.AppDesktop.menuInset)),- );-- ButtonStyle _menuRowStyle({bool finger = false}) => ButtonStyle(- minimumSize: WidgetStatePropertyAll(Size(208, finger ? kFingerTarget : 32)),- side: WidgetStatePropertyAll(BorderSide.none),- padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 12)),- alignment: Alignment.centerLeft,- tapTargetSize: MaterialTapTargetSize.shrinkWrap,- );+ /// These menus' width.+ static const double _menuWidth = 220;- /// A menu's row, a finger's height on a phone.+ /// A menu's row: the app's one menu row ([AppMenuItem]), a finger's height+ /// on a phone.Widget _menuItem(String label,VoidCallback? action, {+ Key? key,bool finger = false,Widget? trailing,- }) => MenuItemButton(- style: _menuRowStyle(finger: finger),- trailingIcon: trailing,- onPressed: action,- child: Text(label),+ bool selected = false,+ }) => fingerTarget(+ enabled: finger,+ AppMenuItem(+ key: key,+ label: label,+ trailing: trailing,+ selected: selected,+ onPressed: action,+ ),);/// The reader's own setting for a chat, kept on every device (Slack's channel- /// notifications); a viewer has one too. A row like its menu's others, as- /// tall as their [finger] rows (Huy, #2342: the chat menu's had a border).- Widget _notifyMenu(SuperTabConversation group, {required bool finger}) =>- SubmenuButton(- key: const ValueKey('super-notify-menu'),- style: _menuRowStyle(finger: finger),- submenuIcon: const WidgetStatePropertyAll(- Icon(AppIcons.chevronRight, size: 14),- ),- menuChildren: [- for (final (level, label) in const [- (SuperTabNotify.all, 'All new messages'),- (SuperTabNotify.mentions, 'Mentions only'),- (SuperTabNotify.muted, 'Muted'),- ])- MenuItemButton(- key: ValueKey('super-notify-${level.name}'),- style: _menuRowStyle(finger: finger),- leadingIcon: SizedBox(- width: 16,- child: c.notifyOf(group.id) == level- ? const Icon(AppIcons.check, size: 14)- : null,- ),- onPressed: () => unawaited(_setNotify(group.id, level)),- child: Text(label),- ),- ],- child: const Text('Notifications'),- );+ /// notifications); a viewer has one too. The app's one submenu row, so it+ /// opens beside the panel exactly as the Windows ☰'s sections do.+ Widget _notifyMenu(SuperTabConversation group) => fingerTarget(+ enabled: _phone,+ AppSubmenuItem(+ itemKey: const ValueKey('super-notify-menu'),+ label: 'Notifications',+ trailing: const Icon(AppIcons.chevronRight, size: 14),+ width: _menuWidth,+ menuChildren: [+ for (final (level, label) in const [+ (SuperTabNotify.all, 'All new messages'),+ (SuperTabNotify.mentions, 'Mentions only'),+ (SuperTabNotify.muted, 'Muted'),+ ])+ _menuItem(+ label,+ () => unawaited(_setNotify(group.id, level)),+ key: ValueKey('super-notify-${level.name}'),+ finger: _phone,+ selected: c.notifyOf(group.id) == level,+ ),+ ],+ ),+ );/// Until all of the project's closed groups are read, it may have archived/// ones: the list reads them when it opens.@@ -3190,9 +3194,11 @@ class _SuperTabViewState extends State<SuperTabView>final owner = project.ownerId == c.accountId;Widget item(String label, VoidCallback? action, {Widget? trailing}) =>_menuItem(label, action, finger: _phone, trailing: trailing);- return MenuAnchor(- style: _menuStyle,- menuChildren: [+ return AppDropdown(+ width: _menuWidth,+ consumeOutsideTap: false,+ alignmentOffset: Offset.zero,+ children: [item('Status',project.status == null@@ -3209,8 +3215,8 @@ class _SuperTabViewState extends State<SuperTabView>item('Instructions', () => _groupAction('instructions', group)),if (editable && owner)item('Sharing', () => _groupAction('sharing', group)),- _notifyMenu(group, finger: _phone),- const Divider(height: 9),+ _notifyMenu(group),+ const AppMenuDivider(),item('Project settings…',() => unawaited(_projectSettings(group, project)),@@ -3280,16 +3286,18 @@ class _SuperTabViewState extends State<SuperTabView>final editable = c.canWrite && !c.saving && !c.hasPendingAction;Widget item(String label, VoidCallback? action) =>_menuItem(label, action, finger: views);- return MenuAnchor(- style: _menuStyle,- menuChildren: [+ return AppDropdown(+ width: _menuWidth,+ consumeOutsideTap: false,+ alignmentOffset: Offset.zero,+ children: [if (views) ...[item('Group terminals (${_terminalCount(group)})',_openTerminals(group),),item('Pull requests', _openPullRequests),- const Divider(height: 9),+ const AppMenuDivider(),],if (_isBuddyChat(group)) ...[// A Buddy chat is the reader's own: the Buddy itself to name, any@@ -3337,7 +3345,7 @@ class _SuperTabViewState extends State<SuperTabView>),],],- _notifyMenu(group, finger: views),+ _notifyMenu(group),if (_mayHaveArchived(group.projectId))item('Archived conversations', () => _groupAction('archived', group)),],@@ -4574,7 +4582,7 @@ class _SuperTabViewState extends State<SuperTabView>24,12,24,- pastedFolders().isEmpty ? 16 : 6,+ pastedFolders().isEmpty ? ProjectSidebar.footGap : 6,),child: _phone? Column(@@ -4663,7 +4671,7 @@ class _SuperTabViewState extends State<SuperTabView>behavior: HitTestBehavior.translucent,onTap: writable ? _focus.requestFocus : null,child: Padding(- padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),+ padding: const EdgeInsets.fromLTRB(12, 3, 4, 3),child: Column(mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.stretch,@@ -4705,7 +4713,7 @@ class _SuperTabViewState extends State<SuperTabView>visualDensity: VisualDensity.standard,hintStyle: SwarmType.composer(context,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),contentPadding: EdgeInsets.zero,hintMaxLines: _phone ? 1 : null,@@ -5032,7 +5040,7 @@ class _SuperTabViewState extends State<SuperTabView>constraints.maxWidth,max: SuperTabPaneLayout.threadWidth,),- child: SuperTabRightPane(child: thread),+ child: thread,),),),@@ -5065,7 +5073,7 @@ class _SuperTabViewState extends State<SuperTabView>width: SuperTabPaneLayout.drawerWidth(constraints.maxWidth,),- child: SuperTabRightPane(child: roster),+ child: roster,),),),@@ -5097,7 +5105,7 @@ class _SuperTabViewState extends State<SuperTabView>child: SizedBox(width: 240,child: Material(- color: DesktopChrome.surface,+ color: grid.AppPalette.swarmWelcome,elevation: 8,child: _sidebar(),),diff --git a/desktop/lib/widgets/agent_drag.dart b/desktop/lib/widgets/agent_drag.dartindex 1c2f4cc71..2e493b372 100644--- a/desktop/lib/widgets/agent_drag.dart+++ b/desktop/lib/widgets/agent_drag.dart@@ -79,6 +79,11 @@ final agentDrag = ValueNotifier<AgentDragRef?>(null);/// a pane drag offers the other tiles to trade places with.final paneDragging = ValueNotifier<PaneDragRef?>(null);+/// Where the pointer is while a pane is carried, in global coordinates. A drop+/// target's own offset is the ghost's corner, not the hand, and which edge of a+/// pane is meant depends on the hand.+final paneDragPointer = ValueNotifier<Offset?>(null);+/// Small, quiet glyphs with a stable mouse and keyboard target. Pane controls/// share the close button's emphasis without adding a row of button chrome.class PaneHeaderButton extends StatelessWidget {diff --git a/desktop/lib/widgets/api_picker_form.dart b/desktop/lib/widgets/api_picker_form.dartindex a1a26b7b2..8db59537e 100644--- a/desktop/lib/widgets/api_picker_form.dart+++ b/desktop/lib/widgets/api_picker_form.dart@@ -759,7 +759,7 @@ class ApiPickerFormState extends State<ApiPickerForm> {hintText: _example(id),hintStyle: DesktopChrome.text(size: 13,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),helperText: id == 'key'? 'Stored only on ${controller.hostLabel}.'diff --git a/desktop/lib/widgets/box_chrome.dart b/desktop/lib/widgets/box_chrome.dartindex ca3a59c27..cfa94dd16 100644--- a/desktop/lib/widgets/box_chrome.dart+++ b/desktop/lib/widgets/box_chrome.dart@@ -4,24 +4,27 @@ import 'package:flutter/semantics.dart';import 'package:flutter/services.dart';import '../shared/theme/app_theme.dart' as grid;+import '../shared/theme/appearance_prefs_store.dart';import '../terminal/terminal_text.dart';const double kTerminalCornerRadius = 3;/// A stable rim for the terminal pane, independent of the desktop dialog frame.+///+/// The same line focused or not: no colored focus lines (owner, 2026-11-04).+/// An unfocused pane among others is told apart by its dimming.BorderSide terminalPaneBorder({bool focused = false, bool remote = false}) =>- BorderSide(- color: !focused- ? grid.AppPalette.divider- : remote- ? grid.AppPalette.remotePaneFocus- : grid.AppPalette.accentOnSurface,- width: 1,- );+ BorderSide(color: grid.AppPalette.divider, width: 1);/// One gutter around the workspace, between panes, and beside command docks.const double kWorkspaceInset = 9.5;+/// The gutter around and between panes: none in the Compact pane style.+double get kPaneInset =>+ appearancePrefsStore.value.panes.style == PaneStyle.compact+ ? 0+ : kWorkspaceInset;+/// How solid the workspace's panes paint their own fill: below 1 while the/// background shows through them (any Background but Blank). Only fills turn/// translucent — text, colored cells, banners and the composer stay solid.@@ -170,6 +173,9 @@ double boxRowHeight(TextScaler scale) =>Color get kBoxFaint => boxText(.54);TextStyle get kBoxFaintStyle => grid.AppType.monoMeta(color: kBoxFaint);+/// A box field's placeholder: the color every other field's placeholder uses.+Color get kBoxHint => grid.AppPalette.textFaint;+/// Linux spells its chords out (`spellsModifierKeys`); the box prints them in/// its own lower-case, dash-joined form, as it does a Mac's glyphs.String _unspelled(String hint) =>diff --git a/desktop/lib/widgets/cloud_chat_pane.dart b/desktop/lib/widgets/cloud_chat_pane.dartindex 5225828b9..212766fad 100644--- a/desktop/lib/widgets/cloud_chat_pane.dart+++ b/desktop/lib/widgets/cloud_chat_pane.dart@@ -451,9 +451,7 @@ class _CloudChatPaneState extends State<CloudChatPane> {focusedBorder: InputBorder.none,disabledBorder: InputBorder.none,hintText: stopped ? 'Write to wake it' : 'Write to $_speaker',- hintStyle: workspaceBarTextStyle(- color: AppColors.mutedStrong,- ),+ hintStyle: workspaceBarTextStyle(color: AppColors.muted),),),),diff --git a/desktop/lib/widgets/daemon_panel.dart b/desktop/lib/widgets/daemon_panel.dartindex 39e22a25d..1de926b34 100644--- a/desktop/lib/widgets/daemon_panel.dart+++ b/desktop/lib/widgets/daemon_panel.dart@@ -317,12 +317,7 @@ class _DaemonPanelState extends State<DaemonPanel> with _PairSections {alignment: Alignment.centerLeft,).copyWith(side: WidgetStateProperty.resolveWith(- (states) => BorderSide(- width: 1.5,- color: states.contains(WidgetState.focused)- ? DesktopChrome.accent- : Colors.transparent,- ),+ (states) => BorderSide(width: 1.5, color: Colors.transparent),),overlayColor: WidgetStateProperty.resolveWith((states) => DesktopChrome.foreground.withValues(diff --git a/desktop/lib/widgets/daemon_panel_pair.dart b/desktop/lib/widgets/daemon_panel_pair.dartindex 8651e322a..8da4baec0 100644--- a/desktop/lib/widgets/daemon_panel_pair.dart+++ b/desktop/lib/widgets/daemon_panel_pair.dart@@ -238,10 +238,7 @@ mixin _PairSections on State<DaemonPanel> {decoration: BoxDecoration(color: focused ? DesktopChrome.selection : DesktopChrome.field,borderRadius: BorderRadius.circular(DesktopChrome.controlRadius),- border: Border.all(- width: 1.5,- color: focused ? DesktopChrome.accent : Colors.transparent,- ),+ border: Border.all(width: 1.5, color: Colors.transparent),),child: Column(crossAxisAlignment: CrossAxisAlignment.start,@@ -665,7 +662,7 @@ mixin _PairSections on State<DaemonPanel> {hintText: wait == null? 'ask $name something': 'wait ${(wait.inMilliseconds / 1000).ceil()}s',- hintStyle: _ink(_muted.withValues(alpha: .4)),+ hintStyle: _ink(DesktopChrome.hint),counterText: '',),onSubmitted: (_) {diff --git a/desktop/lib/widgets/desktop_chrome.dart b/desktop/lib/widgets/desktop_chrome.dartindex 44e0d1827..06b1f8985 100644--- a/desktop/lib/widgets/desktop_chrome.dart+++ b/desktop/lib/widgets/desktop_chrome.dart@@ -13,6 +13,9 @@ class DesktopChrome extends InheritedWidget {static Color get foreground => grid.AppPalette.textPrimary;static Color get muted => grid.AppPalette.textSecondary;++ /// Every field's placeholder, as the dropdowns' search line draws it.+ static Color get hint => grid.AppPalette.textFaint;static Color get surface => grid.AppDesktop.surface;static Color get rim => grid.AppDesktop.rim;static Color get field => grid.AppDesktop.field;@@ -21,7 +24,11 @@ class DesktopChrome extends InheritedWidget {static Color get activeSelection => grid.AppDesktop.selection;static Color get onSelection => grid.AppDesktop.onSelection;static Color get selectionDetail => grid.AppDesktop.selectionDetail;- static Color get focusRing => grid.AppDesktop.focus;++ /// A focused control's rim: the ordinary hairline. The app draws no colored+ /// focus lines (owner, 2026-11-04); focus shows as the control's fill and a+ /// text field's caret.+ static Color get focusRing => grid.AppDesktop.rim;static const dialogRadius = grid.AppDesktop.dialogRadius;static const menuRadius = grid.AppDesktop.menuRadius;static const rowRadius = grid.AppDesktop.rowRadius;@@ -280,6 +287,9 @@ class DesktopPill extends StatelessWidget {label,maxLines: 1,overflow: TextOverflow.ellipsis,+ strutStyle: monospace+ ? null+ : grid.AppType.controlStrut(size: textSize),style: monospace ? grid.AppType.mono() : null,semanticsLabel: semanticLabel,),diff --git a/desktop/lib/widgets/desktop_workspace_tab.dart b/desktop/lib/widgets/desktop_workspace_tab.dartindex ade3c2ff0..26b3aa489 100644--- a/desktop/lib/widgets/desktop_workspace_tab.dart+++ b/desktop/lib/widgets/desktop_workspace_tab.dart@@ -474,6 +474,7 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {textAlign: TextAlign.center,maxLines: 1,overflow: TextOverflow.ellipsis,+ strutStyle: grid.AppType.controlStrut(),style: DesktopChrome.control(color: ink).copyWith(fontWeight: widget.attention@@ -608,7 +609,13 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {);// Always the anchor, menu or not: a tab whose share arrives keeps its// subtree (and keyboard focus); [_openMenu] opens nothing without rows.- return MenuAnchor(controller: _menu, menuChildren: _menuRows(), child: tab);+ return AppDropdown(+ controller: _menu,+ consumeOutsideTap: false,+ alignmentOffset: Offset.zero,+ children: _menuRows(),+ child: tab,+ );}}diff --git a/desktop/lib/widgets/fork_agent_dialog.dart b/desktop/lib/widgets/fork_agent_dialog.dartindex 4fa107346..88414efdb 100644--- a/desktop/lib/widgets/fork_agent_dialog.dart+++ b/desktop/lib/widgets/fork_agent_dialog.dart@@ -284,7 +284,7 @@ class _ForkAgentPromptState extends State<_ForkAgentPrompt> {controller: controller,focusNode: focus,readOnly: _locked,- style: DesktopChrome.text(size: 14),+ style: DesktopChrome.text(size: 13),cursorColor: DesktopChrome.accent,textAlignVertical: TextAlignVertical.center,minLines: task ? 3 : 1,@@ -297,8 +297,8 @@ class _ForkAgentPromptState extends State<_ForkAgentPrompt> {? 'What should the fork work on?': 'Harness name',hintStyle: DesktopChrome.text(- size: 14,- color: DesktopChrome.muted,+ size: 13,+ color: DesktopChrome.hint,),isDense: true,filled: true,diff --git a/desktop/lib/widgets/harness_agent_picker.dart b/desktop/lib/widgets/harness_agent_picker.dartindex d531fe941..50c7a31f7 100644--- a/desktop/lib/widgets/harness_agent_picker.dart+++ b/desktop/lib/widgets/harness_agent_picker.dart@@ -62,9 +62,10 @@ class _HarnessAgentPickerState extends State<HarnessAgentPicker> {?.copyWith(color: AppColors.textSoft),),if (widget.showPrefix) const SizedBox(width: 4),- MenuAnchor(+ AppDropdown(controller: _menu,childFocusNode: _trigger,+ consumeOutsideTap: false,onOpen: () {_unregister = registerTransientMenu(_menu.close);WidgetsBinding.instance.addPostFrameCallback((_) {@@ -81,17 +82,14 @@ class _HarnessAgentPickerState extends State<HarnessAgentPicker> {_unregister?.call();_unregister = null;},- menuChildren: [+ children: [for (final choice in widget.engines)AppMenuItem(label: HarnessAgentPicker.label(choice),leading: EngineMark(engine: choice),selected: widget.engine == choice,focusNode: _choice(choice),- onPressed: () {- _menu.close();- widget.onSelected?.call(choice);- },+ onPressed: () => widget.onSelected?.call(choice),),],builder: (context, controller, child) => TextButton(diff --git a/desktop/lib/widgets/harness_customize_pane.dart b/desktop/lib/widgets/harness_customize_pane.dartindex 101743f36..addcf095e 100644--- a/desktop/lib/widgets/harness_customize_pane.dart+++ b/desktop/lib/widgets/harness_customize_pane.dart@@ -93,9 +93,7 @@ class HarnessCustomizePane extends StatelessWidget {side: WidgetStateProperty.resolveWith((states) => BorderSide(width: 1.5,- color: states.contains(WidgetState.focused)- ? DesktopChrome.accent- : Colors.transparent,+ color: Colors.transparent,),),),@@ -179,12 +177,7 @@ class _CustomizeTabLabel extends StatelessWidget {Widget build(BuildContext context) => DecoratedBox(decoration: BoxDecoration(borderRadius: BorderRadius.circular(DesktopChrome.controlRadius),- border: Border.all(- width: 1.5,- color: Focus.of(context).hasFocus- ? DesktopChrome.accent- : Colors.transparent,- ),+ border: Border.all(width: 1.5, color: Colors.transparent),),child: Padding(padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),diff --git a/desktop/lib/widgets/in_window_menu_bar.dart b/desktop/lib/widgets/in_window_menu_bar.dartindex 793592e36..fdaf10d0c 100644--- a/desktop/lib/widgets/in_window_menu_bar.dart+++ b/desktop/lib/widgets/in_window_menu_bar.dart@@ -1,3 +1,5 @@+import 'dart:math' as math;+import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';import 'package:flutter/foundation.dart';@@ -13,6 +15,7 @@ import '../screens/swarm_menu_bus.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_menu.dart';import 'engine_identity.dart';+import '../shared/widgets/app_icon_button.dart';import 'terminal_edit_actions.dart';/// Runs one app-menu action — the same strings the macOS application menu@@ -20,17 +23,46 @@ import 'terminal_edit_actions.dart';/// `_RootShellState.runAppMenuAction`.typedef AppMenuActionHandler = Future<void> Function(String action);+/// Where the app-menu actions go when the widget drawing them has no shell in+/// reach. The shell installs its switch here at startup; the compact bar in the+/// workspace tab strip (a child of the workspace screen, not of the shell's own+/// Column) dispatches through it, so one switch still serves every surface —+/// AppKit's menu bar, the Linux strip and the Windows button. Cleared when the+/// shell goes away; null in a test that never mounted one.+AppMenuActionHandler? appMenuActionSink;++/// The compact button's natural width: 8px of padding on each side plus its+/// 16px glyph. The tab strip reserves at least this much, because two cells of+/// the 13px bar font are narrower than it on Windows — and a narrower slot does+/// not overflow, it squashes the glyph silently (10px at a 26px slot, nothing+/// at 16).+const double appMenuButtonWidth = 32;+/// The app's commands as an in-window menu bar.////// On macOS the commands live in the native menu bar: the application menu's/// own rows and View's font rows are installed in MainFlutterWindow.swift,/// and File, Edit's Find rows, View's workspace rows and History are built by-/// SwarmTitlebar.swift from the `harness/swarm_tabs` payloads. Linux and Windows have no native menu bar to hand any of-/// that to, so this draws the same menus in the window instead: the state-/// comes off [SwarmMenuBus] (what Swift would have received), the rows-/// dispatch back through the same handler the macOS channel delivers to, and-/// the application-menu commands fire the same action strings through-/// [onAction].+/// SwarmTitlebar.swift from the `harness/swarm_tabs` payloads.+///+/// Linux and Windows have no native menu bar to hand any of that to, so this+/// widget draws the same menus itself. Two shapes, one set of rows:+///+/// - **Linux: the strip** ([compact] false). On GNOME it IS the title bar, so it+/// carries the menus, the drag area and the window buttons; under a window+/// manager's own caption it is a 30px strip of menus. [LinuxTitleBar] says+/// which. Windows used to draw this strip too, under its OS caption; it no+/// longer does (desktop/design/windows-app-menu.md). The shell still mounts+/// it on Windows for the screens that have no tab strip — sign-in, setup, the+/// tour — and the workspace's tab strip draws the compact bar instead.+/// - **Windows: [compact]**, one ☰ whose panel groups the same seven menus. The+/// button lives at the left of the workspace tab strip, the row the window's+/// own controls sit in, because two stacked bars was the legacy shape.+///+/// Either way the state comes off [SwarmMenuBus] (what Swift would have+/// received), the rows dispatch back through the same handler the macOS channel+/// delivers to, and the application-menu commands fire the same action strings+/// through [onAction] or [appMenuActionSink].////// The tab strip and the title-bar buttons are not here: on Linux and Windows Flutter/// draws those itself, as it does anywhere AppKit is not drawing them. Two@@ -42,8 +74,9 @@ typedef AppMenuActionHandler = Future<void> Function(String action);/// test can force the bar on without caring which OS the host is. Widget/// tests at large keep the bar off by default: it is window chrome — on macOS/// it costs the layout nothing at all — and pane-geometry assertions should-/// not depend on whether a Linux or Windows build is drawing it. Windows keeps-/// its native caption (spec §2.9), so there the bar is a strip under it.+/// not depend on whether a Linux build is drawing it. Windows keeps its native+/// caption (spec §2.9): the compact button is drawn by the workspace's tab+/// strip there, not by this widget's default visibility./// Who draws the Linux window's title bar — decided by the runner/// (`my_application.cc`) and handed over as `HARNESS_LINUX_TITLE_BAR`.enum LinuxTitleBar {@@ -97,13 +130,21 @@ enum EditMenuTarget { textField, terminal, none }class InWindowMenuBar extends StatefulWidget {const InWindowMenuBar({super.key,- required this.onAction,+ this.onAction,this.state,this.visible,this.onQuit,+ this.compact = false,});- final AppMenuActionHandler onAction;+ /// Where a row's app-menu action goes. Omitted by the compact bar: it is+ /// built by the workspace's tab strip, which has no handle on the shell, so+ /// it falls back to [appMenuActionSink].+ final AppMenuActionHandler? onAction;++ /// One ☰ and a sectioned panel instead of the strip. Windows uses this now+ /// that its menu row is gone (desktop/design/windows-app-menu.md).+ final bool compact;/// How Quit Harness quits: the platform's own path unless a test passes/// its own.@@ -191,15 +232,52 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {/// and a margin for the screen edge; past that a menu really does scroll.MenuStyle get _panelStyle {final height = MediaQuery.sizeOf(context).height;- return grid.AppMenu.style(maxHeight: height - 36 - 24);+ // The compact panel hangs off a button inside the 40px tab strip, so that+ // is the air it must keep above itself; 36 is the strip it replaced, which+ // is not the row it opens from.+ return grid.AppMenu.style(+ maxHeight: height - (widget.compact ? 40 : 36) - 24,+ );+ }++ /// The compact panel's open tab.+ String _compactTab = 'Harness';++ /// What a compact row is when it has nothing to offer: no disabled rows and+ /// no "nothing here" lines in a menu someone opens to act.+ static const Widget _absent = SizedBox.shrink();++ /// [rows] as a compact panel draws them: rows that aren't offered gone, a+ /// heading gone with its rows, and a divider only between two groups.+ List<Widget> _tidy(List<Widget> rows) {+ final groups = <List<Widget>>[[]];+ for (final row in rows) {+ if (row is AppMenuDivider) {+ groups.add([]);+ } else if (!identical(row, _absent)) {+ groups.last.add(row);+ }+ }+ final kept = groups+ .where((group) => group.any((row) => row is! _MenuLabelRow))+ .toList();+ return [+ for (final (index, group) in kept.indexed) ...[+ if (index > 0) const AppMenuDivider(),+ ...group,+ ],+ ];}@overrideWidget build(BuildContext context) {+ if (widget.compact) return _buildCompact(context);// RuntimePlatform: false in a browser, where `dart:io` Platform throws.- final visible =- widget.visible ??- ((RuntimePlatform.isLinux || RuntimePlatform.isWindows) && !kUnderTest);+ //+ // Linux only. On GNOME this strip IS the title bar. On Windows it was a+ // second bar under the OS caption, and those commands moved into the tab+ // strip's ☰ (desktop/design/windows-app-menu.md).+ final visible = widget.visible ?? (RuntimePlatform.isLinux && !kUnderTest);if (!visible) return const SizedBox.shrink();grid.AppTheme.watch(context);// The full set of menus outgrows a narrow window; a menubar that scrolls@@ -282,6 +360,109 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {);}+ /// The compact bar: one menu button that opens one panel, the sections as+ /// tabs across its top and the open tab's rows under them. A click changes+ /// the tab. Window has no tab here: the caption's own buttons are its rows.+ Widget _buildCompact(BuildContext context) {+ // Somebody must own the app actions: the host's handler, or the shell's+ // sink. Without either the panel would open onto rows that do nothing.+ assert(+ widget.onAction != null || appMenuActionSink != null,+ 'InWindowMenuBar(compact: true) needs onAction or appMenuActionSink',+ );+ grid.AppTheme.watch(context);+ final controller = _controllers.putIfAbsent('app-menu', MenuController.new);+ final isOpen = identical(_openMenu, controller);+ final sections = <(String, List<Widget>)>[+ ('Harness', _buildHarnessMenu()),+ ('File', _buildFileMenu()),+ ('Edit', _buildEditMenu()),+ // View reads the window's full-screen state as it opens, as the strip does.+ ('View', _buildViewMenu()),+ ('History', _buildHistoryMenu()),+ ('Help', _buildHelpMenu()),+ ];+ final tabs = [+ for (final (label, rows) in sections)+ if (_tidy(rows) case final shown when shown.isNotEmpty) (label, shown),+ ];+ final open =+ tabs.where((tab) => tab.$1 == _compactTab).firstOrNull ?? tabs.first;+ return _menuFocusRegion(+ AppDropdown(+ controller: controller,+ // The tabs' row and the longest rows' labels and hints, both whole.+ width: math.min(420, MediaQuery.sizeOf(context).width - 24),+ // The window less the tab strip it hangs from and a margin.+ maxHeight: MediaQuery.sizeOf(context).height - 40 - 24,+ consumeOutsideTap: false,+ searchScope: open.$1,+ onOpen: () {+ setState(() => _openMenu = controller);+ _readFullScreen();+ },+ onClose: () {+ if (identical(_openMenu, controller)) {+ setState(() => _openMenu = null);+ }+ },+ // The panel takes focus as it opens, so Escape and the menu keys+ // reach MenuAnchor's own bindings with the pointer never having left+ // the button. Without this the panel opened with focus on the button+ // and Escape did nothing.+ header: _menuFocusRegion(+ Focus(+ autofocus: true,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(6, 1, 6, 1),+ child: Wrap(+ spacing: 2,+ runSpacing: 2,+ children: [+ for (final (label, _) in tabs)+ AppTabPill(+ tapKey: Key(+ 'app-menu-section-${label.toLowerCase()}',+ ),+ label: label,+ selected: label == open.$1,+ onTap: () => setState(() => _compactTab = label),+ ),+ ],+ ),+ ),+ const AppMenuDivider(),+ ],+ ),+ ),+ ),+ children: [for (final row in open.$2) _menuFocusRegion(row)],+ // A plain glyph with no rim and no capsule: the same quiet icon the+ // opposite end of this row uses, on the 32-point target the icon+ // system gives an independently clickable control. The TextButton this+ // replaced inherited the app's capsule button style, so the button read+ // as a bordered pill sitting in the tab strip.+ child: AppIconButton(+ key: const Key('app-menu-button'),+ icon: AppIcons.galleryVerticalEnd,+ tooltip: 'Menu',+ selected: isOpen,+ onPressed: () {+ // Read at press time: the button does not rebuild between a panel+ // closing and the click that reopens it.+ final wasOpen = controller.isOpen;+ _closeAll();+ if (!wasOpen) controller.open();+ },+ ),+ ),+ );+ }+// ---------------------------------------------------------------------------// The menus. Row for row the macOS bar: the application menu's additions// (MainFlutterWindow.swift), File and History (SwarmTitlebar.swift), and the@@ -374,6 +555,7 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {icon: AppIcons.copyPlus,label: 'Clone Harness',action: 'cloneAgent',+ enabled: widget.compact ? _state.enabled && _state.canFind : null,),_swarmRow(key: 'menu-bar-restart-agent',@@ -656,31 +838,35 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {);},),- const AppMenuDivider(),- _swarmRow(- key: 'menu-bar-notifications',- icon: AppIcons.bell,- label: 'Harnesses Needing Input…',- action: 'notifications',- ),- _swarmRow(- key: 'menu-bar-machines',- icon: AppIcons.server,- label: 'Machines',- action: 'machineList',- ),- _swarmRow(- key: 'menu-bar-models',- icon: AppIcons.cpu,- label: 'Models',- action: 'models',- ),- _swarmRow(- key: 'menu-bar-machine-monitor',- icon: AppIcons.activity,- label: 'Machine Monitor',- action: 'manageMachines',- ),+ // Places the compact menu leaves out: the status bar, the sidebar's+ // Activity and Manage are each already one click away.+ if (!widget.compact) ...[+ const AppMenuDivider(),+ _swarmRow(+ key: 'menu-bar-notifications',+ icon: AppIcons.bell,+ label: 'Harnesses Needing Input…',+ action: 'notifications',+ ),+ _swarmRow(+ key: 'menu-bar-machines',+ icon: AppIcons.server,+ label: 'Machines',+ action: 'machineList',+ ),+ _swarmRow(+ key: 'menu-bar-models',+ icon: AppIcons.cpu,+ label: 'Models',+ action: 'models',+ ),+ _swarmRow(+ key: 'menu-bar-machine-monitor',+ icon: AppIcons.activity,+ label: 'Machine Monitor',+ action: 'manageMachines',+ ),+ ],const AppMenuDivider(),_swarmRow(key: 'menu-bar-toggle-viewer',@@ -716,7 +902,8 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {bool _fullScreen = false;Future<void> _readFullScreen() async {- if (kUnderTest && widget.visible != null) return;+ // No test host has a window to ask; a real one always does.+ if (kUnderTest) return;final full = await windowManager.isFullScreen();if (mounted && full != _fullScreen) setState(() => _fullScreen = full);}@@ -865,7 +1052,9 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {// Every action row takes `actionsEnabled` from the state, the way the// native menu's validateMenuItem does; a row that passes its own flag// means BOTH must hold.- if (!(enabled ?? _state.enabled)) return _label(label, note: note);+ if (!(enabled ?? _state.enabled)) {+ return widget.compact ? _absent : _label(label, note: note);+ }return AppMenuItem(key: Key(key),icon: icon,@@ -880,7 +1069,7 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {if (swarm) {swarmMenuBus.receive(MethodCall(action, args));} else {- widget.onAction(action);+ (widget.onAction ?? appMenuActionSink)?.call(action);}},);@@ -901,7 +1090,7 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {trailing: _hint(action),onPressed: () {_closeAll();- widget.onAction(action);+ (widget.onAction ?? appMenuActionSink)?.call(action);},);}@@ -1013,7 +1202,7 @@ class _InWindowMenuBarState extends State<InWindowMenuBar> {// A disabled row: an empty state, a provider with no reading behind it, a// command the current pane cannot take.Widget _label(String text, {String? note, bool faint = false}) =>- _MenuLabelRow(text, note: note, faint: faint);+ widget.compact ? _absent : _MenuLabelRow(text, note: note, faint: faint);}/// Marks both the strip and its overlay, which is outside the strip's tree.diff --git a/desktop/lib/widgets/link_another_machine_dialog.dart b/desktop/lib/widgets/link_another_machine_dialog.dartindex 56c0faff5..d56f465ec 100644--- a/desktop/lib/widgets/link_another_machine_dialog.dart+++ b/desktop/lib/widgets/link_another_machine_dialog.dart@@ -711,7 +711,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {textAlignVertical: TextAlignVertical.center,decoration: InputDecoration(hintText: 'find a machine / desktop / SSH',- hintStyle: boxMonoStyle(color: kBoxFaint),+ hintStyle: boxMonoStyle(color: kBoxHint),border: InputBorder.none,enabledBorder: InputBorder.none,focusedBorder: InputBorder.none,diff --git a/desktop/lib/widgets/link_machine_dialog.dart b/desktop/lib/widgets/link_machine_dialog.dartindex ca96920c1..10b34ab68 100644--- a/desktop/lib/widgets/link_machine_dialog.dart+++ b/desktop/lib/widgets/link_machine_dialog.dart@@ -509,14 +509,17 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {obscureText: _obscure,enableSuggestions: false,autocorrect: false,- style: DesktopChrome.text(),+ style: DesktopChrome.text(size: 13),textAlignVertical: TextAlignVertical.center,textInputAction: confirm? TextInputAction.done: TextInputAction.next,decoration: InputDecoration(hintText: confirm ? 'Repeat password' : 'New remote password',- hintStyle: DesktopChrome.text(color: DesktopChrome.muted),+ hintStyle: DesktopChrome.text(+ size: 13,+ color: DesktopChrome.hint,+ ),suffixIconConstraints: const BoxConstraints(minWidth: 40,minHeight: 36,@@ -542,9 +545,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {side: WidgetStateProperty.resolveWith((states) => BorderSide(width: 1.5,- color: states.contains(WidgetState.focused)- ? DesktopChrome.accent- : Colors.transparent,+ color: Colors.transparent,),),),diff --git a/desktop/lib/widgets/link_machine_screen.dart b/desktop/lib/widgets/link_machine_screen.dartindex 626e15335..729fdc1b0 100644--- a/desktop/lib/widgets/link_machine_screen.dart+++ b/desktop/lib/widgets/link_machine_screen.dart@@ -273,12 +273,13 @@ class _LinkMachineScreenState extends State<LinkMachineScreen> {autocorrect: false,textInputAction: TextInputAction.done,textAlignVertical: TextAlignVertical.center,- style: DesktopChrome.text(),+ style: DesktopChrome.text(size: 13),decoration: InputDecoration(hintText:'Remote password for $machineName',hintStyle: DesktopChrome.text(- color: DesktopChrome.muted,+ size: 13,+ color: DesktopChrome.hint,),suffixIconConstraints: const BoxConstraints(minWidth: 40,diff --git a/desktop/lib/widgets/machine_sharing_form.dart b/desktop/lib/widgets/machine_sharing_form.dartindex 8c0d745b5..ff05c574d 100644--- a/desktop/lib/widgets/machine_sharing_form.dart+++ b/desktop/lib/widgets/machine_sharing_form.dart@@ -927,7 +927,7 @@ class MachineSharingFormState extends State<MachineSharingForm> {cursorColor: DesktopChrome.accent,decoration: InputDecoration(hintText: 'Email address',- hintStyle: muted13,+ hintStyle: DesktopChrome.text(size: 13, color: DesktopChrome.hint),prefixIcon: Icon(AppIcons.user,size: AppIcons.inlineSize,diff --git a/desktop/lib/widgets/machines_manager.dart b/desktop/lib/widgets/machines_manager.dartindex 159c6abc2..3bd1c58a1 100644--- a/desktop/lib/widgets/machines_manager.dart+++ b/desktop/lib/widgets/machines_manager.dart@@ -391,9 +391,7 @@ class _MachinesManagerState extends State<_MachinesManager> {Text(entry.title,style: boxMonoStyle(- color: entry.danger- ? boxErrorText- : boxText(1),+ color: entry.danger ? boxErrorText : boxText(1),weight: selected ? FontWeight.w600 : null,),),@@ -487,7 +485,7 @@ class _MachinesManagerState extends State<_MachinesManager> {hintText: _machineId == null? 'find a machine / link another': 'find an action',- hintStyle: boxMonoStyle(color: kBoxFaint),+ hintStyle: boxMonoStyle(color: kBoxHint),isDense: true,filled: false,border: InputBorder.none,diff --git a/desktop/lib/widgets/machines_panel.dart b/desktop/lib/widgets/machines_panel.dartindex d44da7c48..9b72d0294 100644--- a/desktop/lib/widgets/machines_panel.dart+++ b/desktop/lib/widgets/machines_panel.dart@@ -539,8 +539,9 @@ class _MachinesPanelState extends State<_MachinesPanel>}// Anchor the context menu inside this overlay so it stays above the list.- return MenuAnchor(+ return AppDropdown(controller: controller,+ consumeOutsideTap: false,onOpen: () {if (!identical(_openRowMenu, controller)) _openRowMenu?.close();_openRowMenu = controller;@@ -553,15 +554,9 @@ class _MachinesPanelState extends State<_MachinesPanel>}_restoreFocus();},- menuChildren: [+ children: [if (onEditPassword != null)- AppMenuItem(- label: 'Change password',- onPressed: () {- controller.close();- onEditPassword();- },- ),+ AppMenuItem(label: 'Change password', onPressed: onEditPassword),AppMenuItem(label: 'Rename', onPressed: () => choose('rename')),if (!machine.isLocalMachine)AppMenuItem(diff --git a/desktop/lib/widgets/model_picker_chrome.dart b/desktop/lib/widgets/model_picker_chrome.dartindex 1840ae398..e99d89297 100644--- a/desktop/lib/widgets/model_picker_chrome.dart+++ b/desktop/lib/widgets/model_picker_chrome.dart@@ -21,7 +21,7 @@ import 'resting_section.dart' show kUnavailableOpacity;/// The panel's own width. Narrower than a row list, because every row here is two lines and the/// eye reads a column better than a stripe.-const double kModelPickerWidth = 376;+const double kModelPickerWidth = 340;/// The avatar's side, and the gutter its column occupies on every row.const double kModelAvatarSize = 34;@@ -98,11 +98,11 @@ class ModelPickerSearch extends StatelessWidget {cursorColor: DesktopChrome.accent,decoration: InputDecoration(hintText: 'Search models or machines',- hintStyle: DesktopChrome.control(color: DesktopChrome.muted),+ hintStyle: DesktopChrome.control(color: DesktopChrome.hint),prefixIcon: Icon(AppIcons.search,size: 16,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,),prefixIconConstraints: const BoxConstraints(minWidth: 36,diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dartindex 42598cafe..703536f46 100644--- a/desktop/lib/widgets/new_agent_dialog.dart+++ b/desktop/lib/widgets/new_agent_dialog.dart@@ -1643,7 +1643,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {decoration: InputDecoration(hintText: 'Tell your agent what to do first.',// Readable, not faint: the hint says what the field is for.- hintStyle: boxMonoStyle(color: kBoxFaint),+ hintStyle: boxMonoStyle(color: kBoxHint),// One line, so an empty box is exactly a tile tall at any width.hintMaxLines: 1,errorText: tooLongdiff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dartindex e276b3ffa..d3599834b 100644--- a/desktop/lib/widgets/new_harness_form.dart+++ b/desktop/lib/widgets/new_harness_form.dart@@ -12,6 +12,7 @@ import 'package:xterm/xterm.dart' show TerminalTheme;import '../shortcuts/app_keymap.dart';import '../shortcuts/keymap.dart';import '../core/dsh_catalog.dart';+import '../core/runtime_platform.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_menu.dart';import '../terminal/terminal_text.dart';@@ -88,6 +89,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {final _taskFocus = FocusNode(debugLabel: 'New harness task');final _headerMachineMenu = MenuController();final _headerMachineFocus = FocusNode(debugLabel: 'New harness computer');+ final _leadRowFocus = <String, FocusNode>{};final _headerMachineAnchor = GlobalKey();bool get _desktopStartEnabled =>!box.busy &&@@ -214,6 +216,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {_taskText.dispose();_taskFocus.dispose();_headerMachineFocus.dispose();+ for (final node in _leadRowFocus.values) {+ node.dispose();+ }_dialogScope.dispose();for (final node in _desktopFocus.values) {node.dispose();@@ -1370,6 +1375,11 @@ class NewHarnessFormState extends State<NewHarnessForm> {): terminalContentStyle(color: color ?? _theme.foreground);+ /// The search line, at the size of every other field on desktop.+ TextStyle _queryInk(Color color) => widget.desktop+ ? _ink(color).copyWith(fontSize: grid.AppType.bodySize)+ : _ink(color);+/// THE GRID. A terminal has two units and positions nothing in pixels:////// * [_cell] — one character wide, in the terminal's own face and size.@@ -1639,7 +1649,11 @@ class NewHarnessFormState extends State<NewHarnessForm> {key: _desktopCanvasKey,children: [Align(- alignment: const Alignment(0, -.12),+ // A Windows new tab starts at one fixed line under the tabs:+ // centred, its top moved with the length of the list below it.+ alignment: widget.embedded && RuntimePlatform.isWindows+ ? Alignment.topCenter+ : const Alignment(0, -.12),child: SizedBox(width: (constraints.maxWidth - (widget.embedded ? 48 : 0)).clamp(0.0, 680.0),@@ -1661,7 +1675,16 @@ class NewHarnessFormState extends State<NewHarnessForm> {policy: OrderedTraversalPolicy(),child: SingleChildScrollView(controller: _fieldsScroll,- padding: const EdgeInsets.symmetric(vertical: 12),+ // On a Windows new tab the form is the page+ // under the caption row, and 12 put its pickers+ // right against the tabs (owner, 2026-11-03).+ padding: EdgeInsets.only(+ top:+ widget.embedded && RuntimePlatform.isWindows+ ? 32+ : 12,+ bottom: 12,+ ),child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [@@ -2115,7 +2138,8 @@ class NewHarnessFormState extends State<NewHarnessForm> {if (!m.own) m,];Widget heading(String text) => Padding(- padding: const EdgeInsets.fromLTRB(10, 6, 10, 4),+ // At the rows' label column: AppMenuItem's 6 gutter + 10 padding.+ padding: const EdgeInsets.fromLTRB(16, 6, 16, 4),child: Semantics(header: true,child: Text(@@ -2128,29 +2152,17 @@ class NewHarnessFormState extends State<NewHarnessForm> {),),);- return MenuAnchor(+ return AppDropdown(controller: _headerMachineMenu,childFocusNode: _headerMachineFocus,- consumeOutsideTap: true,- alignmentOffset: const Offset(8, 0),+ width: _machineMenuWidth,onOpen: () => setState(() {}),onClose: () {if (!mounted) return;setState(() {});_focusEditor();},- style: MenuStyle(- alignment: Alignment.bottomLeft,- backgroundColor: WidgetStatePropertyAll(DesktopChrome.surface),- surfaceTintColor: const WidgetStatePropertyAll(Colors.transparent),- elevation: const WidgetStatePropertyAll(grid.AppMenu.elevation),- maximumSize: const WidgetStatePropertyAll(Size(264, 460)),- padding: const WidgetStatePropertyAll(EdgeInsets.all(6)),- shape: WidgetStatePropertyAll(- DesktopChrome.shape(radius: DesktopChrome.menuRadius),- ),- ),- menuChildren: [+ children: [if (yours.isNotEmpty) heading('Your machines'),for (final machine in yours) _desktopLeadMachineRow(machine),if (team.isNotEmpty) heading('Team machines'),@@ -2164,114 +2176,62 @@ class NewHarnessFormState extends State<NewHarnessForm> {final chosen = machine.id == box.leadMachine?.id;final enabled = machine.startable && !box.locked;final status = _leadStatusWord(machine);+ final choose = enabled ? () => box.chooseLeadMachine(machine.id) : null;+ final focus = _leadRowFocus.putIfAbsent(+ machine.id,+ () => FocusNode(debugLabel: 'New harness computer row'),+ );return KeyedSubtree(key: ValueKey('new-harness-lead-machine-${machine.id}'),- child: MenuItemButton(- autofocus: chosen && enabled,- onPressed: enabled ? () => box.chooseLeadMachine(machine.id) : null,- style:- MenuItemButton.styleFrom(- foregroundColor: DesktopChrome.foreground,- disabledForegroundColor: DesktopChrome.muted,- enabledMouseCursor: SystemMouseCursors.click,- disabledMouseCursor: SystemMouseCursors.basic,- side: BorderSide.none,- padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),- textStyle: DesktopChrome.text(size: 13),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),- ),- ).copyWith(- foregroundColor: WidgetStateProperty.resolveWith(- (states) => states.contains(WidgetState.disabled)- ? DesktopChrome.muted- : states.contains(WidgetState.focused) ||- states.contains(WidgetState.hovered)- ? DesktopChrome.onSelection- : DesktopChrome.foreground,- ),- iconColor: WidgetStateProperty.resolveWith(- (states) => states.contains(WidgetState.disabled)- ? DesktopChrome.muted- : states.contains(WidgetState.focused) ||- states.contains(WidgetState.hovered)- ? DesktopChrome.onSelection- : DesktopChrome.muted,- ),- backgroundColor: WidgetStateProperty.resolveWith(- (states) => states.contains(WidgetState.disabled)- ? Colors.transparent- : states.contains(WidgetState.focused) ||- states.contains(WidgetState.hovered)- ? DesktopChrome.activeSelection- : chosen- ? DesktopChrome.selection- : Colors.transparent,- ),- ),- // Inside the button, so it keeps its press action and enabled state- // (review of #2237); assistive technology hears the full reason where- // the row shows one word.- child: Semantics(+ // The press and focus actions stay on the semantics node (review of+ // #2237), and assistive technology hears the full reason where the row+ // shows one word.+ child: Semantics(+ enabled: enabled,+ selected: chosen,+ focusable: enabled,+ onFocus: enabled ? focus.requestFocus : null,+ onTap: choose,+ label: machine.startable+ ? machine.name+ : '${machine.name}, ${leadMachineDetail(machine, box.cloudRepository)}',+ excludeSemantics: true,+ child: AppMenuItem(+ focusNode: focus,+ autofocus: chosen,selected: chosen,- label: machine.startable- ? machine.name- : '${machine.name}, ${leadMachineDetail(machine, box.cloudRepository)}',- excludeSemantics: true,- child: SizedBox(- width: 232,- child: Row(- children: [- if (machine.owner case final owner?)- Opacity(- opacity: enabled ? 1 : .55,- child: SuperTabAvatar.person(owner, size: 16),- )- else- Icon(- box.app.stateOf(machine.id)?.isLocalMachine == true- ? AppIcons.laptop- : AppIcons.monitor,- size: 16,- ),- const SizedBox(width: 10),- Expanded(- flex: 3,+ leading: machine.owner == null+ ? null+ : Opacity(+ opacity: enabled ? 1 : .55,+ child: SuperTabAvatar.person(machine.owner!, size: 16),+ ),+ icon: box.app.stateOf(machine.id)?.isLocalMachine == true+ ? AppIcons.laptop+ : AppIcons.monitor,+ label: machine.name,+ // Enlarged text shortens the word rather than the row overflowing.+ trailing: status == null+ ? null+ : ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 90),child: Text(- machine.name,+ status,maxLines: 1,+ softWrap: false,overflow: TextOverflow.ellipsis,+ style: grid.AppType.caption(height: 1.35),),),- // Enlarged text shortens the word rather than the row overflowing.- if (status != null) ...[- const SizedBox(width: 8),- Flexible(- flex: 2,- fit: FlexFit.tight,- child: Text(- status,- maxLines: 1,- softWrap: false,- overflow: TextOverflow.ellipsis,- textAlign: TextAlign.end,- style: grid.AppType.caption(height: 1.35),- ),- ),- ],- const SizedBox(width: 8),- SizedBox(- width: 16,- child: chosen ? Icon(AppIcons.check, size: 16) : null,- ),- ],- ),- ),+ onPressed: choose,),),);}+ /// Both computer menus' width.+ static const double _machineMenuWidth = AppDropdown.defaultWidth;+Widget _desktopTaskBox() => ListenableBuilder(listenable: _taskFocus,builder: (context, _) => Material(@@ -2287,49 +2247,59 @@ class NewHarnessFormState extends State<NewHarnessForm> {),clipBehavior: Clip.antiAlias,child: Padding(- padding: const EdgeInsets.all(14),+ // The left 6 + the text's 7 puts the line on the 📎's ink, not its hit area.+ padding: const EdgeInsets.fromLTRB(6, 10, 8, 8),child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [FocusTraversalOrder(order: const NumericFocusOrder(4),- child: TextField(- key: const ValueKey('new-harness-task'),- controller: _taskText,- focusNode: _taskFocus,- canRequestFocus: box.takesTask,- minLines: 2,- maxLines: 7,- textInputAction: TextInputAction.send,- readOnly: box.locked || !box.takesTask,- style: DesktopChrome.text(size: 15),- cursorColor: DesktopChrome.accent,- onChanged: box.setTask,- onSubmitted: (_) {- if (!_isComposing() && !_picking) unawaited(_start());- },- onTapOutside: (_) {},- decoration: InputDecoration(- // An agent that takes no first message is not a terminal: with Kilo chosen- // the box said a terminal would open (a fresh Ubuntu VM, 2026-10-12).- hintText: box.takesTask- ? 'What would you like to work on?'- : box.isTerminal- ? 'Open a terminal in this repo'- : 'Type to ${box.agentLabel} once it opens',- hintStyle: DesktopChrome.text(- size: 15,- color: DesktopChrome.muted,+ child: Padding(+ padding: const EdgeInsets.only(left: 7),+ child: TextField(+ key: const ValueKey('new-harness-task'),+ controller: _taskText,+ focusNode: _taskFocus,+ canRequestFocus: box.takesTask,+ // As tall as what is typed, with the options under it.+ minLines: 1,+ maxLines: 7,+ textInputAction: TextInputAction.send,+ readOnly: box.locked || !box.takesTask,+ style: DesktopChrome.text(size: 13),+ cursorColor: DesktopChrome.accent,+ onChanged: box.setTask,+ onSubmitted: (_) {+ if (!_isComposing() && !_picking) unawaited(_start());+ },+ onTapOutside: (_) {},+ decoration: InputDecoration(+ // An agent that takes no first message is not a terminal: with Kilo chosen+ // the box said a terminal would open (a fresh Ubuntu VM, 2026-10-12).+ hintText: box.takesTask+ ? 'What would you like to work on?'+ : box.isTerminal+ ? 'Open a terminal in this repo'+ : 'Type to ${box.agentLabel} once it opens',+ hintStyle: DesktopChrome.text(+ size: 13,+ color: DesktopChrome.hint,+ ),+ border: InputBorder.none,+ enabledBorder: InputBorder.none,+ focusedBorder: InputBorder.none,+ isCollapsed: true,+ // Else the theme's field padding and minimum height come+ // back through applyDefaults and the line sits in a tall box.+ contentPadding: EdgeInsets.zero,+ constraints: const BoxConstraints(),+ visualDensity: VisualDensity.standard,+ filled: false,),- border: InputBorder.none,- enabledBorder: InputBorder.none,- focusedBorder: InputBorder.none,- isCollapsed: true,- filled: false,),),),- const SizedBox(height: 12),+ const SizedBox(height: 8),_desktopTaskActions(),],),@@ -2636,11 +2606,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {tapTargetSize: MaterialTapTargetSize.shrinkWrap,).copyWith(side: WidgetStateProperty.resolveWith(- (states) => BorderSide(+ (states) => const BorderSide(width: grid.AppDesktop.focusWidth,- color: states.contains(WidgetState.focused)- ? Colors.white- : Colors.transparent,+ color: Colors.transparent,),),backgroundColor: WidgetStateProperty.resolveWith(@@ -2678,22 +2646,25 @@ class NewHarnessFormState extends State<NewHarnessForm> {Rect _desktopChooserBounds(BoxConstraints constraints) {final preferredWidth = switch (box.field) {- NewHarnessField.harness || NewHarnessField.agent => 304.0,- NewHarnessField.model => 440.0,- NewHarnessField.projectMenu => math.max(- 400.0,+ // The computer menus' width: pickers side by side read as one set.+ NewHarnessField.harness ||+ NewHarnessField.agent ||+ NewHarnessField.projectMenu ||+ NewHarnessField.project ||+ NewHarnessField.machine => math.max(+ _machineMenuWidth,_desktopTextSize('Search repos', 14).width + 96,),- NewHarnessField.project => 400.0,- NewHarnessField.mode => 380.0,- NewHarnessField.profile => 320.0,- _ => 360.0,+ // Only what must show a second column on one row goes wider.+ NewHarnessField.model => 340.0,+ NewHarnessField.mode => 300.0,+ _ => _machineMenuWidth,};final width = (constraints.maxWidth - 24).clamp(0.0, preferredWidth);final maximum = (constraints.maxHeight - 24).clamp(0.0, 420.0);// Include the search controls, its vertical padding, list padding, and rim.// Refresh is taller than one text line, even when only two rows remain.- var contentHeight = _desktopSearchHeight + 20 + 2;+ var contentHeight = _desktopSearchHeight + 2 + 2;if (!_desktopRepositoryEntry) contentHeight += 12;if (box.options.isEmpty && !_desktopRepositoryEntry) contentHeight += 48;for (var i = 0; i < box.options.length && contentHeight < maximum; i++) {@@ -2786,7 +2757,8 @@ class NewHarnessFormState extends State<NewHarnessForm> {),),child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),+ // With its rule, one row's height.+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1),child: SizedBox(height: _desktopSearchHeight,child: _searchBar(),@@ -2975,14 +2947,14 @@ class NewHarnessFormState extends State<NewHarnessForm> {: _desktopLineHeight('Ag', 11) + 12;double _desktopHeadingGap(int i) => _desktopModelRows && i > 0 ? 6 : 0;double get _desktopSearchHeight =>- _desktopLineHeight('Ag', 14).clamp(32.0, double.infinity);+ _desktopLineHeight('Ag', 14).clamp(28.0, double.infinity);bool _desktopRecentDivider(int i) =>box.field == NewHarnessField.projectMenu &&i > 0 &&!box.options[i].synthetic &&box.options[i - 1].synthetic;double _desktopChoiceHeight(int i) =>- (_desktopModelRows ? 20 : 16) ++ (_desktopModelRows ? 16 : 11) +_desktopLineHeight(_desktopOptionTitle(box.options[i]),_desktopTitleSize,@@ -3068,13 +3040,20 @@ class NewHarnessFormState extends State<NewHarnessForm> {};}- Widget _desktopOption(NewHarnessOption option) {+ Widget _desktopOption(NewHarnessOption option) =>+ _HoverBuilder(builder: (hovered) => _desktopOptionRow(option, hovered));++ Widget _desktopOptionRow(NewHarnessOption option, bool hovered) {final title = _desktopOptionTitle(option);final highlighted = identical(option, box.selected);// A refused paste is the answer to what was typed, not a choice: its two// lines say why, and it keeps a quiet fill instead of the selection's.final refused = option.id == NewHarnessController.pasteInvalidId;- final active = highlighted && !refused;+ final current = box.isCurrent(option) && !_isDoor(option);+ // Blue is for the row under the pointer or the arrows, as in every other+ // dropdown. The current choice wears the quiet wash and its check.+ final active =+ !refused && !box.locked && (hovered || (highlighted && !current));final ink = active ? DesktopChrome.onSelection : DesktopChrome.foreground;final muted = active ? DesktopChrome.selectionDetail : DesktopChrome.muted;final titleStyle = DesktopChrome.text(@@ -3083,7 +3062,6 @@ class NewHarnessFormState extends State<NewHarnessForm> {);final detail = _desktopOptionDetail(option);final meta = _desktopModelRows ? option.meta : null;- final current = box.isCurrent(option) && !_isDoor(option);final note = box.field == NewHarnessField.machine? _unlinked(option)? 'Not linked'@@ -3109,6 +3087,8 @@ class NewHarnessFormState extends State<NewHarnessForm> {child: Material(color: active? DesktopChrome.activeSelection+ : current+ ? DesktopChrome.selection: highlighted? DesktopChrome.foreground.withValues(alpha: .06): Colors.transparent,@@ -3119,14 +3099,14 @@ class NewHarnessFormState extends State<NewHarnessForm> {? SystemMouseCursors.basic: SystemMouseCursors.click,borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),- hoverColor: DesktopChrome.foreground.withValues(alpha: .06),+ hoverColor: Colors.transparent,splashFactory: NoSplash.splashFactory,onTap: !box.locked ? () => _acceptChoice(option) : null,child: Padding(key: highlighted ? _choiceKey : null,padding: EdgeInsets.symmetric(horizontal: 10,- vertical: _desktopModelRows ? 10 : 8,+ vertical: _desktopModelRows ? 8 : 5.5,),child: Row(children: [@@ -3763,11 +3743,10 @@ class NewHarnessFormState extends State<NewHarnessForm> {}// Computer selection belongs to the header, independently of repo search.- Widget _desktopMachineAnchor({required Widget child}) => MenuAnchor(+ Widget _desktopMachineAnchor({required Widget child}) => AppDropdown(controller: _headerMachineMenu,childFocusNode: _headerMachineFocus,- consumeOutsideTap: true,- alignmentOffset: const Offset(8, 0),+ width: _machineMenuWidth,onOpen: () => setState(() {}),onClose: () {if (!mounted) return;@@ -3777,127 +3756,35 @@ class NewHarnessFormState extends State<NewHarnessForm> {_chooserTraversal = null;_focusEditor();},- style: MenuStyle(- alignment: Alignment.bottomLeft,- backgroundColor: WidgetStatePropertyAll(DesktopChrome.surface),- surfaceTintColor: const WidgetStatePropertyAll(Colors.transparent),- elevation: const WidgetStatePropertyAll(grid.AppMenu.elevation),- maximumSize: const WidgetStatePropertyAll(Size(264, 420)),- padding: const WidgetStatePropertyAll(EdgeInsets.all(6)),- shape: WidgetStatePropertyAll(- DesktopChrome.shape(radius: DesktopChrome.menuRadius),- ),- ),- menuChildren: [+ children: [for (final option in box.machineChoices)- MenuItemButton(+ AppMenuItem(key: ValueKey('new-harness-machine-option-${option.id}'),- autofocus: option.id == box.machineId && option.enabled,+ autofocus: option.id == box.machineId,+ selected: option.id == box.machineId,+ icon: box.app.stateOf(option.id)?.isLocalMachine == true+ ? AppIcons.laptop+ : AppIcons.monitor,+ label: _repoMachineLabel(option.id),+ detail: !option.enabled+ ? box.app.stateOf(option.id)?.needsLink == true+ ? 'Not linked'+ : 'Offline'+ : box.app.stateOf(option.id)?.isLocalMachine == true+ ? option.title+ : null,onPressed: option.enabled && !box.locked- ? () {- _selectRepoMachine(option.id);- }+ ? () => _selectRepoMachine(option.id): null,- style:- MenuItemButton.styleFrom(- foregroundColor: DesktopChrome.foreground,- disabledForegroundColor: DesktopChrome.muted,- enabledMouseCursor: SystemMouseCursors.click,- disabledMouseCursor: SystemMouseCursors.basic,- side: BorderSide.none,- backgroundColor: option.id == box.machineId- ? DesktopChrome.selection- : Colors.transparent,- padding: const EdgeInsets.symmetric(- horizontal: 10,- vertical: 8,- ),- textStyle: DesktopChrome.text(size: 13),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),- ),- ).copyWith(- foregroundColor: WidgetStateProperty.resolveWith(- (states) => states.contains(WidgetState.disabled)- ? DesktopChrome.muted- : states.contains(WidgetState.focused) ||- states.contains(WidgetState.hovered)- ? DesktopChrome.onSelection- : DesktopChrome.foreground,- ),- iconColor: WidgetStateProperty.resolveWith(- (states) => states.contains(WidgetState.disabled)- ? DesktopChrome.muted- : states.contains(WidgetState.focused) ||- states.contains(WidgetState.hovered)- ? DesktopChrome.onSelection- : DesktopChrome.muted,- ),- backgroundColor: WidgetStateProperty.resolveWith(- (states) => states.contains(WidgetState.disabled)- ? Colors.transparent- : states.contains(WidgetState.focused) ||- states.contains(WidgetState.hovered)- ? DesktopChrome.activeSelection- : option.id == box.machineId- ? DesktopChrome.selection- : Colors.transparent,- ),- ),- child: SizedBox(- width: 232,- child: Row(- children: [- Icon(- box.app.stateOf(option.id)?.isLocalMachine == true- ? AppIcons.laptop- : AppIcons.monitor,- size: 16,- ),- const SizedBox(width: 10),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- _repoMachineLabel(option.id),- maxLines: 1,- overflow: TextOverflow.ellipsis,- ),- if (!option.enabled ||- box.app.stateOf(option.id)?.isLocalMachine ==- true) ...[- const SizedBox(height: 3),- Text(- !option.enabled- ? box.app.stateOf(option.id)?.needsLink == true- ? 'Not linked'- : 'Offline'- : option.title,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: grid.AppType.caption(height: 1.35),- ),- ],- ],- ),- ),- const SizedBox(width: 8),- SizedBox(- width: 16,- child: option.id == box.machineId- ? Icon(AppIcons.check, size: 16)- : null,- ),- ],- ),- ),),],child: child,);Widget _searchBar() {+ // On desktop, the glyph and text stand on the rows' own columns, unless a+ // Back button needs the glyph's place. The outer 8 is the chooser's padding.+ final back = widget.desktop && _desktopNestedChooser;return Padding(key: _searchKey,padding: EdgeInsets.symmetric(horizontal: widget.desktop ? 8 : _margin),@@ -3908,7 +3795,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {textBaseline: TextBaseline.alphabetic,children: [SizedBox(- width: widget.desktop ? 32 : _gutter,+ width: widget.desktop ? (back ? 32 : 16) : _gutter,child: widget.desktop? _desktopNestedChooser? ExcludeFocus(@@ -3934,7 +3821,11 @@ class NewHarnessFormState extends State<NewHarnessForm> {),),)- : Icon(AppIcons.search, size: 16, color: _faint)+ : Icon(+ AppIcons.search,+ size: 16,+ color: widget.desktop ? DesktopChrome.hint : _faint,+ ): Text('>',key: const ValueKey('new-harness-prompt'),@@ -3942,7 +3833,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {style: _ink(_picking ? _theme.foreground : _faint),),),- if (widget.desktop) const SizedBox(width: 8),+ if (widget.desktop) SizedBox(width: back ? 8 : 10),Expanded(child: Actions(actions: {@@ -3965,7 +3856,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {focusNode: _inputFocus,readOnly: box.locked,showCursor: _picking,- style: _ink(_theme.foreground),+ style: _queryInk(_theme.foreground),cursorColor: widget.desktop? DesktopChrome.foreground: _theme.cursor,@@ -3982,7 +3873,9 @@ class NewHarnessFormState extends State<NewHarnessForm> {onTapOutside: (_) {},decoration: InputDecoration(hintText: _promptHint,- hintStyle: _ink(_faint),+ hintStyle: _queryInk(+ widget.desktop ? DesktopChrome.hint : _faint,+ ),hintMaxLines: 1,isDense: true,isCollapsed: true,@@ -4010,10 +3903,10 @@ class NewHarnessFormState extends State<NewHarnessForm> {onTap: box.refreshingChoices ? null : box.refreshChoices,child: widget.desktop? Padding(- padding: const EdgeInsets.all(8),+ padding: const EdgeInsets.all(6),child: Icon(AppIcons.refreshCw,- size: 18,+ size: 16,color: _faint,),)@@ -4262,6 +4155,27 @@ class NewHarnessFormState extends State<NewHarnessForm> {/// An install's running clock, ticking itself so the form does not rebuild/// every second. Disposed with the install pane.+/// Hands [builder] whether the pointer is on it.+class _HoverBuilder extends StatefulWidget {+ const _HoverBuilder({required this.builder});++ final Widget Function(bool hovered) builder;++ @override+ State<_HoverBuilder> createState() => _HoverBuilderState();+}++class _HoverBuilderState extends State<_HoverBuilder> {+ bool _hovered = false;++ @override+ Widget build(BuildContext context) => MouseRegion(+ onEnter: (_) => setState(() => _hovered = true),+ onExit: (_) => setState(() => _hovered = false),+ child: widget.builder(_hovered),+ );+}+class _Elapsed extends StatefulWidget {const _Elapsed({required this.run, required this.style});diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex c43aa6ecc..0f51e8392 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -1,3 +1,5 @@+import 'dart:math' as math;+// A browser leaves the Finder out of main.dart.js until a Finder tile is drawn.import '../finder/widgets/finder_pane_panel.dart'if (dart.library.js_interop) '../web/parts/finder_pane_panel.dart';@@ -52,7 +54,7 @@ import 'transient_menus.dart';import 'pane_resize_handle.dart';import 'pane_split_edges.dart';import '../agent_messages/pane_shared_chips.dart';-import 'box_chrome.dart' show kWorkspaceInset, terminalPaneBorder, PaneOpacity;+import 'box_chrome.dart' show kPaneInset, terminalPaneBorder, PaneOpacity;import 'desktop_chrome.dart';/// The view drawn alone when only one fits (a phone): the real zoom, else the@@ -353,6 +355,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {_focusRequest = widget.notifier.paneFocusRequest;widget.notifier.addListener(_onAppChanged);terminalFontStore.addListener(_onFontChanged);+ appearancePrefsStore.addListener(_onFontChanged);}@override@@ -495,6 +498,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {widget.notifier.removeListener(_onAppChanged);_unregisterResizeHelp?.call();terminalFontStore.removeListener(_onFontChanged);+ appearancePrefsStore.removeListener(_onFontChanged);_resizeFocus.dispose();_idleFocus.dispose();_scroll.dispose();@@ -721,6 +725,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {.where((divider) => divider.touches(focused)).firstOrNull;final extent = Size(layout.width + kPaneGap, layout.height + kPaneGap);+ final reach = math.max(kPaneGap, _kDividerReach);final floor = _MinTile.of();final minimum = Size((floor.width + kPaneGap) / extent.width,@@ -790,17 +795,19 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {key: ValueKey('resize:$swarmId:${layout.key}:${divider.id}'),rect: divider.axis == PaneResizeAxis.x? Rect.fromLTWH(- divider.position * extent.width - kPaneGap,+ divider.position * extent.width -+ (kPaneGap + reach) / 2,divider.start * extent.height,- kPaneGap,+ reach,(divider.end - divider.start) * extent.height -kPaneGap,): Rect.fromLTWH(divider.start * extent.width,- divider.position * extent.height - kPaneGap,+ divider.position * extent.height -+ (kPaneGap + reach) / 2,(divider.end - divider.start) * extent.width - kPaneGap,- kPaneGap,+ reach,),child: PaneResizeHandle(arrangement: arrangement,@@ -1228,7 +1235,10 @@ class _MinTile {}/// Pane gaps share the outer workspace inset in both directions.-const double kPaneGap = kWorkspaceInset;+double get kPaneGap => kPaneInset;++/// A divider's reach when panes touch: the Compact style has no gap to grab.+const double _kDividerReach = 8;/// What shows through the gaps.///@@ -1321,9 +1331,16 @@ class _Gap extends StatelessWidget {/// [kPaneGap] is: the rail is a card now, and two places typing 10 is how they drift apart.const double kPaneRadius = grid.AppDesktop.paneRadius;+/// Whether panes are drawn square and touching.+bool get _compactPanes =>+ appearancePrefsStore.value.panes.style == PaneStyle.compact;+/// How round a pane's corners are — the shared card radius, so a terminal does not read as a different-/// KIND of surface from the rail beside it.-const double _paneRadius = kPaneRadius;+/// KIND of surface from the rail beside it. Square in the Compact style.+double get _paneRadius => _compactPanes ? 0 : kPaneRadius;++/// How much of a faded pane's content still shows.+const double _fadedContent = .55;class _PaneCell extends StatelessWidget {const _PaneCell({@@ -1378,67 +1395,87 @@ class _PaneCell extends StatelessWidget {);}+ /// Focus Follows Mouse, only while the keyboard is already in the grid: with+ /// a menu, a dialog or a field elsewhere holding it, the pointer crossing a+ /// pane must not take the keys away.+ void _followMouse(BuildContext context) {+ if (!visible || dragging != null || paneDragging.value != null) return;+ if (notifier.isPaneFocused(pane.id)) return;+ final holder = FocusManager.instance.primaryFocus;+ final inGrid =+ holder == null ||+ holder == FocusManager.instance.rootScope ||+ holder.context?.findAncestorWidgetOfExactType<PaneGrid>() != null;+ if (inGrid) notifier.focusPane(pane.id, reveal: true);+ }+Widget _build(BuildContext context, AppearancePrefs prefs) {grid.AppTheme.watch(context);final focused = visible && notifier.isPaneFocused(pane.id);final remote = notifier.stateOf(pane.machineId)?.isLocalMachine == false;// Keep the selected harness's terminal and viewers clear, including while// a menu owns input. This changes paint, never the keyboard's destination.- final dimmed =- prefs.shadeInactivePanes &&- !_single &&- !notifier.isPaneEmphasized(pane);+ final panes = prefs.panes;+ final faded = !_single && !notifier.isPaneEmphasized(pane);final agentId = pane.agentId;final blocked =agentId != null &¬ifier.questionFor(pane.machineId, agentId) != null;- return Listener(- // The same press selects the pane and reaches its terminal or viewer.- behavior: HitTestBehavior.translucent,- onPointerDown: (_) => notifier.focusPane(pane.id),- child: ValueListenableBuilder<PaneDragRef?>(- valueListenable: paneDragging,- builder: (context, inFlight, child) => PaneSplitEdges(- enabled:- swarmMode &&- visible &&- !solo &&- agentId != null &&- pane.sharedHarness == null &&- onSplitPane != null &&- !notifier.activeSwarm.isUtility &&- !notifier.activeSwarm.isOrchestrator &&- notifier.zoomedPaneId == null &&- notifier.canAddPane &&- dragging == null &&- inFlight == null,- canSplitRight:- notifier.preparePaneSplit(PaneResizeAxis.x, paneId: pane.id) !=- null,- canSplitDown:- notifier.preparePaneSplit(PaneResizeAxis.y, paneId: pane.id) !=- null,- onSplit: (axis) => onSplitPane?.call(pane.id, axis),- child: child!,- ),- // Passthrough: the frame keeps the exact constraints the grid gives it. The landing is ALWAYS- // here, painting nothing between landings, so a landing never reparents the terminal.- child: Stack(- fit: StackFit.passthrough,- children: [- _frame(- prefs,- focused: focused,- remote: remote,- dimmed: dimmed,- blocked: blocked,- ),- Positioned.fill(- child: IgnorePointer(- child: _PaneLanding(notifier: notifier, pane: pane),+ return MouseRegion(+ opaque: false,+ onEnter: (_) {+ if (panes.focusFollowsMouse) _followMouse(context);+ },+ child: Listener(+ // The same press selects the pane and reaches its terminal or viewer.+ behavior: HitTestBehavior.translucent,+ onPointerDown: (_) => notifier.focusPane(pane.id),+ child: ValueListenableBuilder<PaneDragRef?>(+ valueListenable: paneDragging,+ builder: (context, inFlight, child) => PaneSplitEdges(+ enabled:+ swarmMode &&+ visible &&+ !solo &&+ agentId != null &&+ pane.sharedHarness == null &&+ onSplitPane != null &&+ !notifier.activeSwarm.isUtility &&+ !notifier.activeSwarm.isOrchestrator &&+ notifier.zoomedPaneId == null &&+ notifier.canAddPane &&+ dragging == null &&+ inFlight == null,+ canSplitRight:+ notifier.preparePaneSplit(PaneResizeAxis.x, paneId: pane.id) !=+ null,+ canSplitDown:+ notifier.preparePaneSplit(PaneResizeAxis.y, paneId: pane.id) !=+ null,+ onSplit: (axis) => onSplitPane?.call(pane.id, axis),+ child: child!,+ ),+ // Passthrough: the frame keeps the exact constraints the grid gives it. The landing is ALWAYS+ // here, painting nothing between landings, so a landing never reparents the terminal.+ child: Stack(+ fit: StackFit.passthrough,+ children: [+ _frame(+ prefs,+ focused: focused,+ remote: remote,+ fadeSurface: faded && panes.fade.fadesSurface,+ fadeContent: faded && panes.fade.fadesContent,+ highlight: focused && !_single && panes.highlightActive,+ blocked: blocked,),- ),- ],+ Positioned.fill(+ child: IgnorePointer(+ child: _PaneLanding(notifier: notifier, pane: pane),+ ),+ ),+ ],+ ),),),);@@ -1451,7 +1488,7 @@ class _PaneCell extends StatelessWidget {}// Keep terminal backgrounds inside the pane rim.return ClipRRect(- borderRadius: BorderRadius.circular(_paneRadius - 1),+ borderRadius: BorderRadius.circular(math.max(0, _paneRadius - 1)),child: child,);}@@ -1460,9 +1497,17 @@ class _PaneCell extends StatelessWidget {AppearancePrefs prefs, {required bool focused,required bool remote,- required bool dimmed,+ required bool fadeSurface,+ required bool fadeContent,+ required bool highlight,required bool blocked,}) {+ final compact = prefs.panes.style == PaneStyle.compact;+ final rim = terminalPaneBorder(focused: focused, remote: remote);+ // Touching panes share one line: each draws only its right and bottom, so+ // two neighbours make one line rather than two. A border that isn't the+ // same on every side can't carry a radius, and has none to carry here.+ final radius = compact ? null : BorderRadius.circular(_paneRadius);return Builder(builder: (context) => Container(key: ValueKey('pane-frame:${pane.id}'),@@ -1477,27 +1522,39 @@ class _PaneCell extends StatelessWidget {// the frame adds none (two would stack); a status pane has only this.color: PaneOpacity.of(context) < 1 && pane.session != null? null- : PaneOpacity.fill(context, grid.AppPalette.windowBg),- borderRadius: BorderRadius.circular(_paneRadius),+ : PaneOpacity.fill(+ context,+ pane.isDevices+ ? grid.AppPalette.swarmWelcome+ : grid.AppPalette.windowBg,+ ),+ borderRadius: radius,// The rim is always drawn — it is what gives an unfocused card its- // edge, now that no shared line does. It only CHANGES COLOUR on- // focus, so nothing resizes as focus moves.- border: Border.fromBorderSide(- // Keep the location cue when a pane is alone or zoomed, too.- terminalPaneBorder(focused: focused, remote: remote),- ),+ // edge, now that no shared line does. Devices is a page, not a card+ // among cards: a ring around all of it says nothing.+ border: pane.isDevices+ ? const Border.fromBorderSide(BorderSide.none)+ : compact+ ? Border(right: rim, bottom: rim)+ : Border.fromBorderSide(rim),),// A neutral gray veil lifts inactive backgrounds and softens their text// without changing terminal colors. Paint attention above the veil so// a waiting question keeps its full-strength amber rim. Keep this// decoration present even when clear: inserting/removing it would// reparent the terminal and lose its input, scroll and selection state.+ // The active pane's highlight is here too, not on the rim: painted over+ // the pane, it can't resize anything as focus moves.foregroundDecoration: BoxDecoration(- color: dimmed ? const Color(0xFF9D9D9D).withValues(alpha: .30) : null,+ color: fadeSurface+ ? const Color(0xFF9D9D9D).withValues(alpha: .30)+ : null,border: blocked? Border.all(color: grid.AppPalette.warn, width: 2)+ : highlight+ ? Border.all(color: AppColors.accent): null,- borderRadius: BorderRadius.circular(_paneRadius),+ borderRadius: radius,),// Keeps a terminal's constant repainting inside its own layer instead// of dirtying the whole grid. No key: nothing reads this boundary, it@@ -1520,7 +1577,11 @@ class _PaneCell extends StatelessWidget {// The tile being carried fades where it sits, so the grid shows// where it came FROM while the ghost shows where it is going.builder: (context, inFlight, child) => Opacity(- opacity: inFlight?.paneId == pane.id ? 0.35 : 1,+ opacity: inFlight?.paneId == pane.id+ ? 0.35+ : fadeContent+ ? _fadedContent+ : 1,child: child,),child: pane.isDevices@@ -2510,13 +2571,14 @@ class _FileDropZoneState extends State<_FileDropZone> {}}-/// Where a dragged pane may be dropped to trade places with this one.+/// Where a dragged pane may be dropped: on an edge it lands beside this one, as+/// in the TUI, and in the middle the two trade places.////// A sibling of [_DropZone] rather than a branch inside it: they are live at/// different times and mean different things at the same pixel — a rail row-/// landing here REPLACES what this tile shows, a pane landing here SWAPS the-/// two. `DragTarget<T>` keeps them apart by generic, so neither has to ask what-/// kind of drag is in flight.+/// landing here REPLACES what this tile shows, a pane landing here MOVES.+/// `DragTarget<T>` keeps them apart by generic, so neither has to ask what kind+/// of drag is in flight.class _SwapZone extends StatelessWidget {const _SwapZone({required this.notifier,@@ -2528,6 +2590,83 @@ class _SwapZone extends StatelessWidget {final int paneId;final Widget child;+ /// The edge the hand is over, read from the zone's own box.+ PaneSide? _edge(BuildContext context) {+ final pointer = paneDragPointer.value;+ final box = context.findRenderObject();+ if (pointer == null || box is! RenderBox || !box.hasSize) return null;+ return paneSideAt(box.globalToLocal(pointer), box.size);+ }++ void _drop(BuildContext context, int moving) {+ final edge = _edge(context);+ if (edge == null) {+ notifier.reorderPane(moving, paneId);+ } else if (notifier.canMovePaneBeside(moving, paneId, edge)) {+ notifier.movePaneBeside(moving, paneId, edge);+ } else if (!notifier.isPaneBeside(moving, paneId, edge)) {+ // This layout can't take a pane out cleanly: trade places instead, which+ // is what the preview said.+ notifier.reorderPane(moving, paneId);+ }+ }++ /// What the drop would do, drawn where it would happen.+ Widget _preview(BuildContext zone, int moving) {+ return ValueListenableBuilder<Offset?>(+ valueListenable: paneDragPointer,+ // The zone's box, which exists: this builder's own has no render object+ // on the frame the hand arrives, and would read as the middle.+ builder: (_, _, _) {+ final edge = _edge(zone);+ if (edge != null && notifier.isPaneBeside(moving, paneId, edge)) {+ return const SizedBox.expand();+ }+ if (edge != null && notifier.canMovePaneBeside(moving, paneId, edge)) {+ return Align(+ alignment: switch (edge) {+ PaneSide.left => Alignment.centerLeft,+ PaneSide.right => Alignment.centerRight,+ PaneSide.top => Alignment.topCenter,+ PaneSide.bottom => Alignment.bottomCenter,+ },+ child: FractionallySizedBox(+ widthFactor: edge.axis == PaneResizeAxis.x ? .5 : 1,+ heightFactor: edge.axis == PaneResizeAxis.y ? .5 : 1,+ child: Container(+ key: ValueKey('pane-drop-${edge.name}'),+ decoration: BoxDecoration(+ color: AppColors.accent.withValues(alpha: 0.16),+ border: Border.all(color: AppColors.accent),+ ),+ ),+ ),+ );+ }+ return Container(+ color: AppColors.accent.withValues(alpha: 0.16),+ child: Center(+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),+ decoration: BoxDecoration(+ color: grid.AppPalette.panelBg,+ border: Border.all(color: AppColors.accent),+ borderRadius: BorderRadius.circular(6),+ ),+ child: Text(+ 'Swap with this pane',+ style: grid.AppType.mono(+ fontWeight: FontWeight.w500,+ color: AppColors.text,+ ),+ ),+ ),+ ),+ );+ },+ );+ }+@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);@@ -2547,34 +2686,14 @@ class _SwapZone extends StatelessWidget {notifier.activeSwarm.isDevices ||dragging == null ||dragging.paneId == paneId,- child: DragTarget<PaneDragRef>(- onAcceptWithDetails: (details) =>- notifier.reorderPane(details.data.paneId, paneId),- builder: (context, candidate, _) => candidate.isEmpty- ? const SizedBox.expand()- : Container(- color: AppColors.accent.withValues(alpha: 0.16),- child: Center(- child: Container(- padding: const EdgeInsets.symmetric(- horizontal: 12,- vertical: 8,- ),- decoration: BoxDecoration(- color: grid.AppPalette.panelBg,- border: Border.all(color: AppColors.accent),- borderRadius: BorderRadius.circular(6),- ),- child: Text(- 'Swap with this pane',- style: grid.AppType.mono(- fontWeight: FontWeight.w500,- color: AppColors.text,- ),- ),- ),- ),- ),+ child: Builder(+ builder: (zone) => DragTarget<PaneDragRef>(+ onAcceptWithDetails: (details) =>+ _drop(zone, details.data.paneId),+ builder: (context, candidate, _) => candidate.isEmpty+ ? const SizedBox.expand()+ : _preview(zone, candidate.first!.paneId),+ ),),),),diff --git a/desktop/lib/widgets/pane_menu.dart b/desktop/lib/widgets/pane_menu.dartindex c8f61fd5a..dfe4327e6 100644--- a/desktop/lib/widgets/pane_menu.dart+++ b/desktop/lib/widgets/pane_menu.dart@@ -46,8 +46,8 @@ Future<T?> showPaneMenu<T>({bool Function()? shouldRestoreFocus,bool Function(Offset position)? ownsPointer,bool focusFirst = true,- double minWidth = 340,- double maxWidth = 540,+ double minWidth = 240,+ double maxWidth = 320,}) {assert((children == null) != (body == null),@@ -126,6 +126,30 @@ Future<T?> showPaneMenu<T>({return completer.future;}+/// A right-click menu at [at]: the same panel and rows as every dropdown, in an+/// overlay so the click that dismisses it still lands where it was aimed.+Future<T?> showContextMenuAt<T>({+ required BuildContext context,+ required Offset at,+ required List<Widget> Function(void Function(T?) close) children,+ double width = 240,+}) {+ final overlayWidth = MediaQuery.sizeOf(context).width;+ return showPaneMenu<T>(+ context: context,+ position: RelativeRect.fromLTRB(+ at.dx,+ at.dy,+ overlayWidth - at.dx - width,+ 0,+ ),+ minWidth: width,+ maxWidth: width,+ focusFirst: false,+ children: children,+ );+}+class _PaneMenuSurface extends StatelessWidget {const _PaneMenuSurface({required this.child});@@ -465,7 +489,7 @@ class PaneMenuRow extends StatelessWidget {overflow: TextOverflow.ellipsis,// Regular, stated by the style rather than inherited: a PopupMenuItem's default text// style is heavier than this menu wants, which read as every row being emphasised.- style: AppType.mono(color: AppColors.text),+ style: AppType.body(color: AppColors.text),),),if (detail.isNotEmpty) ...[const SizedBox(width: 12), meta(detail)],@@ -511,7 +535,7 @@ class PaneMenuRow extends StatelessWidget {/// The row's own inset from the menu edge, and the padding inside its highlight. A section header/// carries their SUM as a left inset, so header text sits exactly above the row text it heads.const double kPaneMenuInset = 6;-const double kPaneMenuRowPadding = 8;+const double kPaneMenuRowPadding = 10;/// A row's leading mark, when it has one. Not reserved on rows that do not.const double kPaneMenuMarkSize = 14;diff --git a/desktop/lib/widgets/prompt_customize.dart b/desktop/lib/widgets/prompt_customize.dartindex baf746a36..58d7b91b5 100644--- a/desktop/lib/widgets/prompt_customize.dart+++ b/desktop/lib/widgets/prompt_customize.dart@@ -224,9 +224,7 @@ class _StatusStyleChoice extends StatelessWidget {side: WidgetStateProperty.resolveWith((states) => BorderSide(width: 1.5,- color: states.contains(WidgetState.focused)- ? DesktopChrome.accent- : highContrast && selected+ color: highContrast && selected? DesktopChrome.foreground.withValues(alpha: .45): Colors.transparent,),diff --git a/desktop/lib/widgets/swarm_search_field.dart b/desktop/lib/widgets/swarm_search_field.dartindex 7f27384d3..e1b8c16bd 100644--- a/desktop/lib/widgets/swarm_search_field.dart+++ b/desktop/lib/widgets/swarm_search_field.dart@@ -90,7 +90,7 @@ class _SwarmSearchFieldState extends State<SwarmSearchField> {style: AppType.body(),decoration: InputDecoration(hintText: widget.hintText,- hintStyle: AppType.body(color: AppPalette.textSecondary),+ hintStyle: AppType.body(color: AppPalette.textFaint),prefixIcon: const Icon(AppIcons.search, size: 18),filled: true,fillColor: AppDesktop.field,diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dartindex bfc0f55a0..21167faea 100644--- a/desktop/lib/widgets/swarm_search_input.dart+++ b/desktop/lib/widgets/swarm_search_input.dart@@ -102,7 +102,7 @@ class SwarmSearchInput extends StatelessWidget {height: MediaQuery.textScalerOf(context).scale(17) * 1.45 + 24,),hintText: hintText ?? search?.hint ?? kSwarmSearchHint,- hintStyle: DesktopChrome.text(size: 17, color: DesktopChrome.muted),+ hintStyle: DesktopChrome.text(size: 17, color: DesktopChrome.hint),hintMaxLines: 1,border: InputBorder.none,enabledBorder: InputBorder.none,diff --git a/desktop/lib/widgets/task_palette.dart b/desktop/lib/widgets/task_palette.dartindex bd589f9b3..458338f87 100644--- a/desktop/lib/widgets/task_palette.dart+++ b/desktop/lib/widgets/task_palette.dart@@ -720,7 +720,7 @@ class _TaskPaletteState extends State<_TaskPalette> {hintText: "What's up?",hintStyle: DesktopChrome.text(size: 17,- color: DesktopChrome.muted,+ color: DesktopChrome.hint,height: 1.35,),),diff --git a/desktop/lib/widgets/terminal_name_prompt.dart b/desktop/lib/widgets/terminal_name_prompt.dartindex 41cc191a3..26eb8c81b 100644--- a/desktop/lib/widgets/terminal_name_prompt.dart+++ b/desktop/lib/widgets/terminal_name_prompt.dart@@ -188,13 +188,16 @@ class _TerminalNamePromptState extends State<TerminalNamePrompt> {focusNode: _input,readOnly: _saving,maxLength: widget.maxLength,- style: DesktopChrome.text(size: 14),+ style: DesktopChrome.text(size: 13),cursorColor: DesktopChrome.accent,textAlignVertical: TextAlignVertical.center,textInputAction: TextInputAction.done,decoration: InputDecoration(hintText: widget.fieldLabel,- hintStyle: DesktopChrome.text(color: DesktopChrome.muted),+ hintStyle: DesktopChrome.text(+ size: 13,+ color: DesktopChrome.hint,+ ),counterText: '',suffixText:widget.maxLength != null &&diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex fb24042b5..5c3e98723 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -3534,8 +3534,15 @@ class _TerminalHeader extends StatelessWidget {// cursor at the same spot on the header it was picked up by.dragAnchorStrategy: childDragAnchorStrategy,onDragStarted: () => paneDragging.value = handle.ref,- onDragEnd: (_) => paneDragging.value = null,- onDraggableCanceled: (_, _) => paneDragging.value = null,+ onDragUpdate: (details) => paneDragPointer.value = details.globalPosition,+ onDragEnd: (_) {+ paneDragging.value = null;+ paneDragPointer.value = null;+ },+ onDraggableCanceled: (_, _) {+ paneDragging.value = null;+ paneDragPointer.value = null;+ },feedback: _PaneGhost(session: session, size: handle.size, header: strip),// The header itself does NOT change — the whole tile fades instead, indiff --git a/desktop/lib/widgets/window_chrome.dart b/desktop/lib/widgets/window_chrome.dartindex ff1dff898..762c01b20 100644--- a/desktop/lib/widgets/window_chrome.dart+++ b/desktop/lib/widgets/window_chrome.dart@@ -1,10 +1,20 @@-import 'package:flutter/widgets.dart';+import 'package:flutter/material.dart';import 'package:window_manager/window_manager.dart';import '../core/runtime_platform.dart';import '../core/desktop_window.dart';+import '../core/test_run.dart';+import '../shared/theme/app_icons.dart';import '../shared/theme/app_theme.dart' as grid;+/// Windows hides the system caption, so every screen that fills the window+/// draws [WindowCaptionButtons] itself.+bool get drawsWindowCaption => RuntimePlatform.isWindows && !kUnderTest;++/// The height of the row [WindowCaptionButtons] sit in when no tab strip sets+/// one: the tab strip's own.+const double kWindowCaptionHeight = 40;+/// How far a full-width strip drawn at the very top of the window has to/// start from the left to clear the traffic lights.double get trafficLightClearance => RuntimePlatform.isMacOS ? 78.0 : 0.0;@@ -106,22 +116,201 @@ class WindowDragArea extends StatelessWidget {}/// A strip along the top of a screen that fills the window, so it can still be-/// dragged with the title bar gone. Zero height off macOS, where the native-/// caption bar does this itself.+/// dragged with the title bar gone. macOS keeps its native caption; Windows+/// hides it and draws the row itself, so both need this. Zero elsewhere.class WindowDragStrip extends StatelessWidget {const WindowDragStrip({super.key});@overrideWidget build(BuildContext context) {+ final managedTitleRow =+ RuntimePlatform.isMacOS || RuntimePlatform.isWindows;return DragToMoveArea(child: SizedBox(- height: RuntimePlatform.isMacOS ? windowDragBandHeight : 0,+ height: managedTitleRow ? windowDragBandHeight : 0,width: double.infinity,),);}}+/// The empty part of a caption row the app draws itself.+///+/// Drags the window and, like a system caption, restores or maximises it on a+/// double click. It sits BEHIND the row's controls rather than around them, so+/// it never joins the gesture arena under a button ([WindowDragArea] explains+/// why that costs 300 ms).+class WindowCaptionDragArea extends StatelessWidget {+ const WindowCaptionDragArea({super.key});++ @override+ Widget build(BuildContext context) {+ if (!hasManagedWindow) return const SizedBox.expand();+ return GestureDetector(+ behavior: HitTestBehavior.opaque,+ onPanStart: (_) => windowManager.startDragging(),+ onDoubleTap: () async {+ if (await windowManager.isMaximized()) {+ await windowManager.unmaximize();+ } else {+ await windowManager.maximize();+ }+ },+ child: const SizedBox.expand(),+ );+ }+}++/// Minimise, restore and close for a window whose caption the app draws.+///+/// Windows hides the system caption and puts its buttons at the end of the+/// workspace tab strip, so the tabs, the app's controls and the window's own+/// controls share the one row every other Windows app uses. Sized like+/// Windows draws them: 46 wide, the row's full height, the close button filled+/// red only under the pointer.+class WindowCaptionButtons extends StatefulWidget {+ const WindowCaptionButtons({super.key, required this.height});++ /// The row's height, so the buttons fill it edge to edge.+ final double height;++ static const double buttonWidth = 46;++ @override+ State<WindowCaptionButtons> createState() => _WindowCaptionButtonsState();+}++class _WindowCaptionButtonsState extends State<WindowCaptionButtons>+ with WindowListener {+ bool _maximized = false;++ @override+ void initState() {+ super.initState();+ windowManager.addListener(this);+ windowManager.isMaximized().then((value) {+ if (mounted) setState(() => _maximized = value);+ });+ }++ @override+ void dispose() {+ windowManager.removeListener(this);+ super.dispose();+ }++ @override+ void onWindowMaximize() => setState(() => _maximized = true);++ @override+ void onWindowUnmaximize() => setState(() => _maximized = false);++ @override+ Widget build(BuildContext context) => SizedBox(+ height: widget.height,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ _CaptionButton(+ key: const ValueKey('windows-window-minimize'),+ label: 'Minimize',+ icon: AppIcons.minus,+ onPressed: windowManager.minimize,+ ),+ _CaptionButton(+ key: const ValueKey('windows-window-maximize'),+ label: _maximized ? 'Restore' : 'Maximize',+ icon: _maximized ? AppIcons.copy : AppIcons.square,+ onPressed: () => _maximized+ ? windowManager.unmaximize()+ : windowManager.maximize(),+ ),+ _CaptionButton(+ key: const ValueKey('windows-window-close'),+ label: 'Close',+ icon: AppIcons.close,+ close: true,+ onPressed: windowManager.close,+ ),+ ],+ ),+ );+}++class _CaptionButton extends StatefulWidget {+ const _CaptionButton({+ super.key,+ required this.label,+ required this.icon,+ required this.onPressed,+ this.close = false,+ });++ final String label;+ final IconData icon;+ final VoidCallback onPressed;+ final bool close;++ @override+ State<_CaptionButton> createState() => _CaptionButtonState();+}++class _CaptionButtonState extends State<_CaptionButton> {+ bool _hovered = false;++ @override+ Widget build(BuildContext context) {+ final hovered = _hovered;+ final close = widget.close;+ final background = hovered+ ? (close ? const Color(0xffc42b1c) : grid.AppSurface.hoverFill)+ : Colors.transparent;+ final foreground = hovered && close+ ? Colors.white+ : grid.AppPalette.textPrimary;+ return Semantics(+ button: true,+ label: widget.label,+ onTap: widget.onPressed,+ child: Tooltip(+ message: widget.label,+ excludeFromSemantics: true,+ waitDuration: const Duration(milliseconds: 500),+ child: MouseRegion(+ cursor: SystemMouseCursors.click,+ onEnter: (_) => setState(() => _hovered = true),+ onExit: (_) => setState(() => _hovered = false),+ child: FocusableActionDetector(+ mouseCursor: SystemMouseCursors.click,+ onShowFocusHighlight: (value) => setState(() => _hovered = value),+ actions: {+ ActivateIntent: CallbackAction<ActivateIntent>(+ onInvoke: (_) {+ widget.onPressed();+ return null;+ },+ ),+ },+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: widget.onPressed,+ child: Container(+ width: WindowCaptionButtons.buttonWidth,+ color: background,+ alignment: Alignment.center,+ child: ExcludeSemantics(+ child: Icon(widget.icon, size: 12, color: foreground),+ ),+ ),+ ),+ ),+ ),+ ),+ );+ }+}+/// A screen that takes the whole window — sign-in, first-run setup — with a/// drag strip laid over its top edge.///@@ -139,6 +328,12 @@ class FullWindowScreen extends StatelessWidget {children: [Positioned.fill(child: child),const Positioned(top: 0, left: 0, right: 0, child: WindowDragStrip()),+ if (drawsWindowCaption)+ const Positioned(+ top: 0,+ right: 0,+ child: WindowCaptionButtons(height: kWindowCaptionHeight),+ ),],);}diff --git a/desktop/lib/widgets/workspace_account_button.dart b/desktop/lib/widgets/workspace_account_button.dartindex f3e274d78..4d30d9d89 100644--- a/desktop/lib/widgets/workspace_account_button.dart+++ b/desktop/lib/widgets/workspace_account_button.dart@@ -98,7 +98,7 @@ class WorkspaceAvatarButton extends StatelessWidget {final double size;/// The circle. Its slot in the row is [widthOf].- static const diameter = 24.0;+ static const diameter = 20.0;static double widthOf(BuildContext context) => diameter + 8;diff --git a/desktop/lib/widgets/workspace_notifications_button.dart b/desktop/lib/widgets/workspace_notifications_button.dartindex 9818bcf17..b3145fe8c 100644--- a/desktop/lib/widgets/workspace_notifications_button.dart+++ b/desktop/lib/widgets/workspace_notifications_button.dart@@ -18,8 +18,11 @@ class WorkspaceNotificationsButton extends StatelessWidget {final Color foreground;final VoidCallback? onPressed;- static double widthOf(BuildContext context) =>- workspaceBarCellSizeOf(context).width * 4;+ /// The desktop slot matches the account avatar's, so the two ends of the+ /// title row read as one pair. A phone keeps its finger-sized cell.+ static double widthOf(BuildContext context) => workspaceIsCompact(context)+ ? workspaceBarCellSizeOf(context).width * 4+ : 32;@overrideWidget build(BuildContext context) => WorkspaceBarControl(@@ -35,11 +38,11 @@ class WorkspaceNotificationsButton extends StatelessWidget {isLabelVisible: count > 0,backgroundColor: const Color(0xffcf4038),textColor: Colors.white,- smallSize: 6,- largeSize: 13,+ smallSize: 5,+ largeSize: 12,label: Text(count > 99 ? '99+' : '$count',- style: const TextStyle(fontSize: 9, fontWeight: FontWeight.w600),+ style: const TextStyle(fontSize: 8, fontWeight: FontWeight.w600),),child: Icon(AppIcons.bell,diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dartindex fa3aaffc8..583a2585c 100644--- a/desktop/lib/widgets/workspace_welcome.dart+++ b/desktop/lib/widgets/workspace_welcome.dart@@ -208,7 +208,8 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {if (widget.composerBuilder case final composer?) {return Material(key: const ValueKey('workspace-welcome'),- color: grid.AppPalette.windowBg,+ // The active tab's color, so the tab joins the page it opens.+ color: grid.AppPalette.swarmWelcome,child: composer(_withNewTabActions(_withClosedSuperTabs(_desktopSessions())),),@@ -417,10 +418,16 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {);}+ /// A heading over a list, as a rail's: a label, not one more row.+ TextStyle get _sectionLabel => grid.AppType.caption(+ color: grid.AppPalette.textSecondary,+ fontWeight: FontWeight.w600,+ );+Widget? _withClosedSuperTabs(Widget? recent) {final closed = _closedSuperTabsSection(DesktopChrome.control(color: DesktopChrome.muted),- DesktopChrome.metadata(),+ _sectionLabel,DesktopChrome.muted,);if (closed == null) return recent;@@ -447,7 +454,7 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {mainAxisSize: MainAxisSize.min,children: [Padding(- padding: const EdgeInsets.only(bottom: 8, left: 10),+ padding: const EdgeInsets.only(bottom: 8, left: 8),child: Semantics(header: true,child: Text('Recent Swarms', style: headerStyle),@@ -462,8 +469,9 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {foregroundColor: color,backgroundColor: Colors.transparent,alignment: Alignment.centerLeft,+ // On the meta row's text edge above.padding: const EdgeInsets.symmetric(- horizontal: 10,+ horizontal: 8,vertical: 8,),shape: RoundedRectangleBorder(@@ -503,10 +511,10 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {mainAxisSize: MainAxisSize.min,children: [Padding(- padding: const EdgeInsets.only(bottom: 8, left: 10),+ padding: const EdgeInsets.only(bottom: 8, left: 8),child: Semantics(header: true,- child: Text('Recent harnesses', style: DesktopChrome.metadata()),+ child: Text('Recent harnesses', style: _sectionLabel),),),for (final (index, row) in sessions.rows.indexed)@@ -519,8 +527,9 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {backgroundColor: Colors.transparent,enabledMouseCursor: SystemMouseCursors.click,alignment: Alignment.centerLeft,+ // On the meta row's text edge above.padding: const EdgeInsets.symmetric(- horizontal: 10,+ horizontal: 8,vertical: 8,),shape: RoundedRectangleBorder(diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex 0149b393d..717d4dd91 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -25,12 +25,29 @@ enum HarnessControlSymbols {/// Real AppKit controls in the title bar, beside the system traffic lights./// https://developer.apple.com/documentation/appkit/nstitlebaraccessoryviewcontroller/layoutattribute+/// One point of the workspace's color. Takes no clicks, so the title bar under+/// it still drags the window.+private final class SwarmRuleLead: NSView {+ var color: NSColor = .clear {+ didSet { needsDisplay = true }+ }++ override func draw(_ dirtyRect: NSRect) {+ color.setFill()+ bounds.fill()+ }++ override func hitTest(_ point: NSPoint) -> NSView? { nil }+}+final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {private weak var window: NSWindow?private let channel: FlutterMethodChannelprivate let appMenuChannel: FlutterMethodChannelprivate let accessory = NSTitlebarAccessoryViewController()private let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 40))+ /// The strip's bottom rule, carried on under the traffic lights.+ private let ruleLead = SwarmRuleLead()private var statusMenu: HarnessStatusMenu?private var statusBarHeight: NSLayoutConstraint?private var observers: [NSObjectProtocol] = []@@ -252,6 +269,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {if let palette {strip.updatePalette(palette)window?.backgroundColor = strip.palette.tabBar+ ruleLead.color = strip.palette.workspace}guard let window, !configured else { return }configured = true@@ -274,6 +292,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {accessory.layoutAttribute = .rightaccessory.view = stripwindow.addTitlebarAccessoryViewController(accessory)+ ruleLead.color = strip.palette.workspace+ window.contentView?.superview?.addSubview(ruleLead)if let content = window.contentView {let footer = strip.statusBarfooter.translatesAutoresizingMaskIntoConstraints = false@@ -310,6 +330,17 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {let leading = max(76, trafficLightEdge + 10)strip.setFrameSize(NSSize(width: max(200, window.frame.width - leading), height: strip.frame.height))strip.needsLayout = true+ // The accessory starts after the traffic lights, and the strip's rule with+ // it. Left alone, the title bar's own gray shows in that last point under+ // the lights, a notch where the rule begins. Just above the content.+ if let frame = ruleLead.superview {+ let content = window.contentLayoutRect+ ruleLead.frame = frame.convert(+ NSRect(x: 0, y: content.maxY, width: leading, height: 1),+ from: nil+ )+ ruleLead.autoresizingMask = frame.isFlipped ? [.maxYMargin] : [.minYMargin]+ }}private func installWorkspaceMenus() {diff --git a/desktop/test/app_choice_picker_test.dart b/desktop/test/app_choice_picker_test.dartindex c88c88423..bd130af92 100644--- a/desktop/test/app_choice_picker_test.dart+++ b/desktop/test/app_choice_picker_test.dart@@ -87,7 +87,7 @@ void main() {find.descendant(of: more, matching: find.byType(AnimatedContainer)).first,);expect(- ((container.decoration! as BoxDecoration).border! as Border).top.color,+ (container.decoration! as BoxDecoration).color,isNot(Colors.transparent),reason: 'The returned keyboard focus stays visible without selecting it',);diff --git a/desktop/test/app_select_field_review_test.dart b/desktop/test/app_select_field_review_test.dartindex 77e236bef..c50f9036f 100644--- a/desktop/test/app_select_field_review_test.dart+++ b/desktop/test/app_select_field_review_test.dart@@ -194,6 +194,8 @@ void main() {_host(AppSelectField<String>(width: 280,+ // Typeahead's path: a list past the threshold otherwise gets a search.+ filterable: false,value: '0',options: [for (var i = 0; i < 10; i++)diff --git a/desktop/test/app_select_field_test.dart b/desktop/test/app_select_field_test.dartindex ecaf31b6c..b6825aee0 100644--- a/desktop/test/app_select_field_test.dart+++ b/desktop/test/app_select_field_test.dart@@ -145,10 +145,16 @@ void main() {(tester.widget<AnimatedContainer>(box).decoration! as BoxDecoration).border!as Border;+ Color? fill() =>+ (tester.widget<AnimatedContainer>(box).decoration! as BoxDecoration)+ .color;final before = rim();+ final restingFill = fill();focus.requestFocus();await tester.pump();- expect(rim().top.color, isNot(before.top.color));+ // Focus shows in the fill, never as a colored line.+ expect(fill(), isNot(restingFill));+ expect(rim().top.color, before.top.color);expect(rim().top.width, before.top.width);expect(tester.getRect(find.text('Alpha')), label);expect(tester.widget<AnimatedContainer>(box).duration, Duration.zero);@@ -438,10 +444,7 @@ void main() {expect(calls, 0, reason: 'a no-op choice must not write to disk');});- testWidgets('the picker uses the roomy row, a context menu keeps compact', (- tester,- ) async {- // Both variants use the terminal font; only spacing and icon size differ.+ testWidgets('a picker and a context menu use the same row', (tester) async {await tester.pumpWidget(_host(Column(@@ -471,15 +474,7 @@ void main() {final pickerRow = tester.widget<AppMenuItem>(find.widgetWithText(AppMenuItem, 'Menlo'),);- expect(pickerRow.metrics, AppMenuRowMetrics.roomy);- expect(- AppMenuRowMetrics.roomy.fontSize,- equals(AppMenuRowMetrics.compact.fontSize),- );- expect(- AppMenuRowMetrics.roomy.iconSize,- greaterThan(AppMenuRowMetrics.compact.iconSize),- );+ expect(pickerRow.metrics, AppMenuRowMetrics.compact);});testWidgets('a row measures the extent its metrics claim', (tester) async {@@ -506,7 +501,7 @@ void main() {final second = tester.getRect(find.byType(AppMenuItem).at(1));expect(second.top - first.top,- closeTo(AppMenuRowMetrics.roomy.extent, 0.1),+ closeTo(AppMenuRowMetrics.compact.extent, 0.1),);});@@ -541,11 +536,10 @@ void main() {final first = tester.getRect(find.byType(AppMenuItem).at(0));final last = tester.getRect(find.byType(AppMenuItem).at(6));expect(last.top, greaterThan(first.top));- expect(last.height, greaterThan(AppMenuRowMetrics.compact.extent));+ expect(last.height, closeTo(AppMenuRowMetrics.compact.extent, 0.1));expect(last.bottom - first.top,- greaterThan(6 * AppMenuRowMetrics.compact.extent),- reason: 'seven roomy rows must occupy more than seven compact ones would',+ closeTo(7 * AppMenuRowMetrics.compact.extent, 0.1),);});@@ -637,12 +631,12 @@ void main() {final first = tester.getRect(find.byType(AppMenuItem).at(0));expect(first.height,- greaterThan(AppMenuRowMetrics.roomy.extent),+ greaterThan(AppMenuRowMetrics.compact.extent),reason: 'a row carrying a sentence is taller than one without',);expect(tester.getRect(find.byType(AppMenuItem).at(1)).bottom - first.top,- lessThanOrEqualTo(2 * AppMenuRowMetrics.roomy.detailExtent + 1),+ lessThanOrEqualTo(2 * AppMenuRowMetrics.compact.detailExtent + 1),);});});diff --git a/desktop/test/appearance_prefs_store_test.dart b/desktop/test/appearance_prefs_store_test.dartindex 26dd364cb..15b0c03a2 100644--- a/desktop/test/appearance_prefs_store_test.dart+++ b/desktop/test/appearance_prefs_store_test.dart@@ -34,7 +34,11 @@ void main() {const prefs = AppearancePrefs();expect(prefs.uiFamily, isNull);expect(prefs.uiSize, 14);- expect(prefs.shadeInactivePanes, isFalse);+ expect(prefs.panes.style, PaneStyle.comfortable);+ expect(prefs.panes.fade, PaneFade.surfaceAndContent);+ expect(prefs.panes.highlightActive, isTrue);+ expect(prefs.panes.autobalanceSplits, isTrue);+ expect(prefs.panes.focusFollowsMouse, isFalse);expect(prefs.autoRenameTabs, isFalse);// Legacy fields remain readable, but no longer control app typography.});diff --git a/desktop/test/button_hover_test.dart b/desktop/test/button_hover_test.dartindex 54955f430..b21fef5b8 100644--- a/desktop/test/button_hover_test.dart+++ b/desktop/test/button_hover_test.dart@@ -276,7 +276,7 @@ void main() {expect(ink(), restingInk);await tester.sendKeyEvent(LogicalKeyboardKey.tab);await tester.pumpAndSettle();- expect(rim().color.a, greaterThan(0));+ expect(rim().color.a, 0, reason: 'focus never draws a colored line');expect(tester.getRect(button),bounds,diff --git a/desktop/test/desktop_composer_layout_test.dart b/desktop/test/desktop_composer_layout_test.dartindex a6fd17163..35a78d7b4 100644--- a/desktop/test/desktop_composer_layout_test.dart+++ b/desktop/test/desktop_composer_layout_test.dart@@ -771,7 +771,8 @@ void main() {expect(_query.hitTestable(), findsOneWidget);expect(_machine, findsNothing);final menu = tester.getRect(_chooser);- expect(menu.width, greaterThanOrEqualTo(400));+ // As wide as the app's other dropdowns, unless a name needs more.+ expect(menu.width, greaterThanOrEqualTo(240));final hint = find.descendant(of: _query,matching: find.text('Search repos'),diff --git a/desktop/test/grid_model_picker_test.dart b/desktop/test/grid_model_picker_test.dartindex 4117b0906..879afd200 100644--- a/desktop/test/grid_model_picker_test.dart+++ b/desktop/test/grid_model_picker_test.dart@@ -709,8 +709,8 @@ void main() {.width;expect(width,- greaterThan(340),- reason: 'a row longer than the minimum asks for more',+ greaterThanOrEqualTo(340),+ reason: 'a long id still has the room a status clears',);expect(width,diff --git a/desktop/test/harness_customize_test.dart b/desktop/test/harness_customize_test.dartindex 319d5f7cd..1bbbdf1c0 100644--- a/desktop/test/harness_customize_test.dart+++ b/desktop/test/harness_customize_test.dart@@ -23,7 +23,6 @@ import 'package:harness/terminal/terminal_font_store.dart';import 'package:harness/terminal/terminal_theme.dart';import 'package:harness/terminal/terminal_theme_store.dart';import 'package:harness/widgets/harness_customize_pane.dart';-import 'package:harness/widgets/desktop_chrome.dart';import 'package:xterm/xterm.dart';import 'support/real_fonts.dart';@@ -176,7 +175,8 @@ void main() {// Workspace: the panes' shading, the tabs' names and the colour palette.await tester.tap(find.byKey(const ValueKey('customize-appearance')));await tester.pumpAndSettle();- expect(find.text('Shade inactive panes'), findsOneWidget);+ expect(find.text('Fade inactive panes'), findsOneWidget);+ expect(find.text('Pane style'), findsOneWidget);expect(find.text('Auto rename'), findsOneWidget);expect(find.text('Color palette'), findsOneWidget);expect(tester.takeException(), isNull);@@ -422,13 +422,6 @@ void main() {} finally {semantics.dispose();}- final button = tester.widget<TextButton>(- find.descendant(of: other, matching: find.byType(TextButton)),- );- expect(- button.style!.side!.resolve({WidgetState.focused})!.color,- DesktopChrome.accent,- );await _capture(tester, boundary, 'desktop-$name-focus-large-terminal');await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pumpAndSettle();diff --git a/desktop/test/new_agent_project_picker_test.dart b/desktop/test/new_agent_project_picker_test.dartindex 01c37bfbb..82d06f905 100644--- a/desktop/test/new_agent_project_picker_test.dart+++ b/desktop/test/new_agent_project_picker_test.dart@@ -373,18 +373,17 @@ void main() {.descendant(of: recentTile, matching: find.byType(AnimatedContainer)).first,);+ // Keyboard focus shows in the fill, never as a colored line.expect(- ((container.decoration! as BoxDecoration).border! as Border).top.color,+ (container.decoration! as BoxDecoration).color,isNot(Colors.transparent),);expect(tester.widget<AppChoiceTile>(newTile).selected, isTrue);expect(tester.widget<AppSelectField<String>>(recentTile).selected, isFalse);expect(((container.decoration! as BoxDecoration).border! as Border).top.color,- isNot(- tester.widget<TextButton>(newButton).style!.side!.resolve({})!.color,- ),- reason: 'Keyboard focus has its own rim, separate from the saved choice',+ Colors.transparent,+ reason: 'Keyboard focus draws no line, unlike the saved choice',);});diff --git a/desktop/test/open_picker_rendering_test.dart b/desktop/test/open_picker_rendering_test.dartindex 5e37f1bf1..15dd219a4 100644--- a/desktop/test/open_picker_rendering_test.dart+++ b/desktop/test/open_picker_rendering_test.dart@@ -244,7 +244,7 @@ void main() {DefaultSelectionStyle.of(tester.element(setupInput)).selectionColor,);expect(field.style!.fontFamily, grid.AppType.body().fontFamily);- expect(field.style!.fontSize, 14);+ expect(field.style!.fontSize, 13);expect(box.selected?.id, selectedOption);expect(field.controller, same(setupController));expect(setupController.value, setupEditing);diff --git a/desktop/test/pane_drag_swap_test.dart b/desktop/test/pane_drag_swap_test.dartindex 88fe8b944..810cda5cb 100644--- a/desktop/test/pane_drag_swap_test.dart+++ b/desktop/test/pane_drag_swap_test.dart@@ -102,4 +102,135 @@ void main() {expect(app.panes.map((p) => p.agentId).toList(), ['a1', 'a0']);});++ group('dragging a pane to another pane\'s edge moves it there', () {+ Future<Finder> mount(WidgetTester tester) async {+ app.stateOf('m')!.agents = [agent('a0', 'First'), agent('a1', 'Second')];+ app.adoptSessionForTest(terminal('a0', []));+ app.adoptSessionForTest(terminal('a1', []));+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1400, 800);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: KeymapProvider(+ keymap: map,+ child: SwarmScreen(+ notifier: app,+ projectStore: projects,+ nativeTabs: false,+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return find.byWidgetPredicate((w) => w is Draggable<PaneDragRef>);+ }++ Future<TestGesture> carry(+ WidgetTester tester,+ Finder draggables,+ Offset Function(Rect target) over,+ ) async {+ final first = app.panes.first.id, second = app.panes.last.id;+ final from = tester.getCenter(+ find.descendant(+ of: find.byKey(ValueKey('pane-frame:$first')),+ matching: draggables,+ ),+ );+ final to = over(+ tester.getRect(find.byKey(ValueKey('pane-frame:$second'))),+ );+ final gesture = await tester.startGesture(+ from,+ kind: PointerDeviceKind.mouse,+ );+ await tester.pump(const Duration(milliseconds: 50));+ for (var i = 1; i <= 10; i++) {+ await gesture.moveTo(Offset.lerp(from, to, i / 10)!);+ await tester.pump(const Duration(milliseconds: 16));+ }+ return gesture;+ }++ Rect frame(WidgetTester tester, String agentId) => tester.getRect(+ find.byKey(+ ValueKey(+ 'pane-frame:${app.panes.firstWhere((p) => p.agentId == agentId).id}',+ ),+ ),+ );++ testWidgets('above: the two stack, the dragged one on top', (tester) async {+ final draggables = await mount(tester);+ final gesture = await carry(+ tester,+ draggables,+ (target) => Offset(target.center.dx, target.top + 8),+ );+ expect(find.byKey(const ValueKey('pane-drop-top')), findsOneWidget);+ expect(find.text('Swap with this pane'), findsNothing);+ await gesture.up();+ await tester.pumpAndSettle();++ expect(app.panes.map((p) => p.agentId), ['a0', 'a1']);+ final top = frame(tester, 'a0'), bottom = frame(tester, 'a1');+ expect(top.bottom, lessThanOrEqualTo(bottom.top));+ expect(top.left, bottom.left);+ expect(top.width, bottom.width);+ });++ testWidgets('below: the two stack, the dragged one under', (tester) async {+ final draggables = await mount(tester);+ final gesture = await carry(+ tester,+ draggables,+ (target) => Offset(target.center.dx, target.bottom - 8),+ );+ await gesture.up();+ await tester.pumpAndSettle();++ expect(app.panes.map((p) => p.agentId), ['a1', 'a0']);+ expect(+ frame(tester, 'a1').bottom,+ lessThanOrEqualTo(frame(tester, 'a0').top),+ );+ });++ testWidgets('right: the two trade sides', (tester) async {+ final draggables = await mount(tester);+ final gesture = await carry(+ tester,+ draggables,+ (target) => Offset(target.right - 8, target.center.dy),+ );+ await gesture.up();+ await tester.pumpAndSettle();++ expect(app.panes.map((p) => p.agentId), ['a1', 'a0']);+ expect(+ frame(tester, 'a1').right,+ lessThanOrEqualTo(frame(tester, 'a0').left),+ );+ });++ testWidgets('left, where it already is: nothing changes', (tester) async {+ final draggables = await mount(tester);+ final before = frame(tester, 'a0');+ final gesture = await carry(+ tester,+ draggables,+ (target) => Offset(target.left + 8, target.center.dy),+ );+ expect(find.text('Swap with this pane'), findsNothing);+ expect(find.byKey(const ValueKey('pane-drop-left')), findsNothing);+ await gesture.up();+ await tester.pumpAndSettle();++ expect(app.panes.map((p) => p.agentId), ['a0', 'a1']);+ expect(frame(tester, 'a0'), before);+ });+ });}diff --git a/desktop/test/pane_modes_test.dart b/desktop/test/pane_modes_test.dartnew file mode 100644index 000000000..ca9e5ad8f--- /dev/null+++ b/desktop/test/pane_modes_test.dart@@ -0,0 +1,120 @@+// A pane's drop edges, the balanced layout, and the saved pane modes.+import 'dart:convert';+import 'dart:ui';++import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/appearance_prefs_store.dart';+import 'package:harness/state/pane_arrangement.dart';++void main() {+ group('paneSideAt', () {+ const size = Size(400, 200);++ test('the middle trades places', () {+ expect(paneSideAt(const Offset(200, 100), size), isNull);+ });++ test('each quarter nearest an edge means that edge', () {+ expect(paneSideAt(const Offset(10, 100), size), PaneSide.left);+ expect(paneSideAt(const Offset(390, 100), size), PaneSide.right);+ expect(paneSideAt(const Offset(200, 10), size), PaneSide.top);+ expect(paneSideAt(const Offset(200, 190), size), PaneSide.bottom);+ });++ test('in a corner, the nearer edge as a share of its band', () {+ expect(paneSideAt(const Offset(4, 40), size), PaneSide.left);+ expect(paneSideAt(const Offset(80, 4), size), PaneSide.top);+ });+ });++ group('moveBeside', () {+ const none = Size.zero;+ final columns = PaneArrangement(const [+ Rect.fromLTRB(0, 0, 1 / 3, 1),+ Rect.fromLTRB(1 / 3, 0, 2 / 3, 1),+ Rect.fromLTRB(2 / 3, 0, 1, 1),+ ]);++ test('the target gives up half, and the hole is filled', () {+ final after = columns.moveBeside(0, 2, PaneSide.top, minimum: none)!;+ expect(after.tiles, hasLength(3));+ // The first column's room went to its neighbour, and the third column+ // now holds two tiles, the moved one above.+ expect(after.tiles[0], const Rect.fromLTRB(0, 0, 2 / 3, 1));+ expect(after.tiles[1].top, 0);+ expect(after.tiles[1].bottom, .5);+ expect(after.tiles[2].top, .5);+ expect(after.tiles[1].left, after.tiles[2].left);+ });++ test('the tiles still cover the whole canvas', () {+ for (final side in PaneSide.values) {+ final after = columns.moveBeside(0, 1, side, minimum: none)!;+ final area = after.tiles.fold<double>(+ 0,+ (sum, tile) => sum + tile.width * tile.height,+ );+ expect(area, closeTo(1, 1e-9), reason: side.name);+ }+ });++ test('a pane already on that side is recognised', () {+ expect(columns.isBeside(0, 1, PaneSide.left), isTrue);+ expect(columns.isBeside(1, 0, PaneSide.right), isTrue);+ expect(columns.isBeside(0, 2, PaneSide.left), isFalse);+ expect(columns.isBeside(0, 1, PaneSide.top), isFalse);+ });+ });++ test('balanced evens a run of columns, not just its first divider', () {+ final uneven = PaneArrangement(const [+ Rect.fromLTRB(0, 0, .7, 1),+ Rect.fromLTRB(.7, 0, .8, 1),+ Rect.fromLTRB(.8, 0, 1, 1),+ ]);+ final even = uneven.balanced(minimum: Size.zero);+ for (final tile in even.tiles) {+ expect(tile.width, closeTo(1 / 3, 1e-3));+ }+ });++ group('PanePrefs.read', () {+ test('nothing saved keeps the old shade switch someone set', () {+ expect(PanePrefs.read(null, legacyShade: true).fade, PaneFade.surface);+ expect(PanePrefs.read(null, legacyShade: false).fade, PaneFade.off);+ expect(PanePrefs.read(null, legacyShade: null), const PanePrefs());+ });++ test('what was saved comes back', () {+ const saved = PanePrefs(+ style: PaneStyle.compact,+ fade: PaneFade.content,+ highlightActive: false,+ autobalanceSplits: false,+ focusFollowsMouse: true,+ );+ expect(+ PanePrefs.read(jsonEncode(saved.toJson()), legacyShade: false),+ saved,+ );+ });++ test('a broken or unknown value lands on the default', () {+ expect(PanePrefs.read('{not json', legacyShade: null), const PanePrefs());+ expect(+ PanePrefs.read('{"style":"tiny","fade":"?"}', legacyShade: null),+ const PanePrefs(),+ );+ });+ });++ test('Surface and Content fade what they say', () {+ expect(PaneFade.off.fadesSurface || PaneFade.off.fadesContent, isFalse);+ expect(PaneFade.surface.fadesSurface, isTrue);+ expect(PaneFade.surface.fadesContent, isFalse);+ expect(PaneFade.content.fadesSurface, isFalse);+ expect(PaneFade.content.fadesContent, isTrue);+ expect(PaneFade.surfaceAndContent.fadesSurface, isTrue);+ expect(PaneFade.surfaceAndContent.fadesContent, isTrue);+ });+}diff --git a/desktop/test/select_field_typing_test.dart b/desktop/test/select_field_typing_test.dartindex 9d1a7f322..d3de1a03d 100644--- a/desktop/test/select_field_typing_test.dart+++ b/desktop/test/select_field_typing_test.dart@@ -227,6 +227,8 @@ void main() {await _mount(tester,child: AppSelectField<String?>(+ // Typeahead's path: a list past the threshold otherwise gets a search.+ filterable: false,value: '0',options: [for (var i = 0; i < 40; i++)diff --git a/desktop/test/settings_screen_test.dart b/desktop/test/settings_screen_test.dartindex f0fd14a1d..d842a038e 100644--- a/desktop/test/settings_screen_test.dart+++ b/desktop/test/settings_screen_test.dart@@ -90,7 +90,7 @@ void main() {await openSettings(tester);// Settings opens on Account, alone at the top with no caption over it.expect(find.text('Account'), findsNWidgets(2));- for (final caption in ['GENERAL', 'AGENTS', 'LABS', 'HELP']) {+ for (final caption in ['General', 'Agents', 'Labs', 'Help']) {expect(find.text(caption), findsOneWidget, reason: caption);}expect(find.text('PREFERENCES'), findsNothing);@@ -119,13 +119,14 @@ void main() {];expect(tops, [...tops]..sort(), reason: 'in this order');// What moved out: robots to the Devices tab, devices and profiles to Machines, and what- // agents may do to Experimental (the account's, owner 2026-10-12).+ // agents may do to Experimental (the account's, owner 2026-10-12). The one+ // "Agents" left is the caption, not a row.expect(find.descendant(of: find.byType(SettingsNav),matching: find.text('Agents'),),- findsNothing,+ findsOneWidget,);for (final gone in ['Customize',@@ -402,8 +403,8 @@ void main() {expect(find.text('Account'), findsOneWidget);expect(find.text('Terminal'), findsNothing);// Its run's caption stays over it; the runs with no match go.- expect(find.text('GENERAL'), findsOneWidget);- expect(find.text('AGENTS'), findsNothing);+ expect(find.text('General'), findsOneWidget);+ expect(find.text('Agents'), findsNothing);// Appearance by what its panel holds, and by its old name.for (final query in ['wallpaper', 'customize']) {diff --git a/desktop/test/startup_test.dart b/desktop/test/startup_test.dartindex 3ca32f974..8a09c98d7 100644--- a/desktop/test/startup_test.dart+++ b/desktop/test/startup_test.dart@@ -181,7 +181,8 @@ void main() {'harness_custom_background','harness_background_behind_harnesses','harness_shade_inactive_panes',- 'harness_auto_rename_tabs',+ 'harness_panes_v1',+'harness_auto_rename_tabs','workspace_prompt_v1',},]);diff --git a/desktop/test/super_tab_attention_wave2_test.dart b/desktop/test/super_tab_attention_wave2_test.dartindex b79883329..97e90d791 100644--- a/desktop/test/super_tab_attention_wave2_test.dart+++ b/desktop/test/super_tab_attention_wave2_test.dart@@ -4,6 +4,7 @@ import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:flutter/services.dart';@@ -470,20 +471,12 @@ void main() {final other = find.ancestor(of: find.text(neighbour),- matching: find.byType(MenuItemButton),+ matching: find.byType(AppMenuItem),).first;- Material material(Finder row) => tester.widget<Material>(- find.descendant(of: row, matching: find.byType(Material)).first,- );- InkWell ink(Finder row) => tester.widget<InkWell>(- find.descendant(of: row, matching: find.byType(InkWell)).first,- );double inset(Finder row, String label) =>tester.getTopLeft(find.text(label)).dx - tester.getTopLeft(row).dx;- expect(material(notify).shape, material(other).shape);- expect(material(notify).color, material(other).color);expect(tester.getSize(notify), tester.getSize(other));expect(inset(notify, 'Notifications'), inset(other, neighbour));expect(@@ -493,27 +486,19 @@ void main() {),findsOneWidget,);- const hovered = {WidgetState.hovered};- expect(- ink(notify).overlayColor?.resolve(hovered),- ink(other).overlayColor?.resolve(hovered),- );final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);await mouse.addPointer(location: tester.getCenter(other));await tester.pump();- final otherHovered = material(other).shape;await mouse.moveTo(tester.getCenter(notify));await tester.pump();if (shotsOn) {await tester.pumpAndSettle();await captureWindow(tester, shots, 'notify-row-$menu-hover');}- expect(material(notify).shape, otherHovered);// Its submenu's rows are rows of the same kind (they had the border too).await tester.pumpAndSettle();for (final level in SuperTabNotify.values) {final row = find.byKey(ValueKey('super-notify-${level.name}'));- expect(material(row).shape, material(other).shape);expect(tester.getSize(row).height, tester.getSize(other).height);}await mouse.removePointer();diff --git a/desktop/test/super_tab_buddy_own_machines_test.dart b/desktop/test/super_tab_buddy_own_machines_test.dartindex 77377ceb3..825daeba8 100644--- a/desktop/test/super_tab_buddy_own_machines_test.dart+++ b/desktop/test/super_tab_buddy_own_machines_test.dart@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/core/models.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';@@ -255,7 +256,7 @@ void main() {await tester.tap(barMachine);await tester.pumpAndSettle();- expect(tester.widget<MenuItemButton>(option('air')).onPressed, isNull);+ expect(tester.widget<AppMenuItem>(option('air')).onPressed, isNull);await tester.tap(find.text('MacBook Air').last, warnIfMissed: false);await tester.pumpAndSettle();// The tap picked nothing, so the menu is still open: close it to read the field.@@ -282,7 +283,7 @@ void main() {await tester.tap(barMachine);await tester.pumpAndSettle();- expect(tester.widget<MenuItemButton>(option('rig')).onPressed, isNull);+ expect(tester.widget<AppMenuItem>(option('rig')).onPressed, isNull);expect(find.descendant(of: option('rig'),diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dartindex dcf536aed..aa1cab099 100644--- a/desktop/test/super_tab_chat_test.dart+++ b/desktop/test/super_tab_chat_test.dart@@ -3,6 +3,7 @@ import 'package:flutter/gestures.dart';import 'package:flutter/services.dart';import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/super_tabs/activity.dart';import 'package:harness/super_tabs/controller.dart';@@ -236,7 +237,7 @@ void main() {final c = await show(tester, server);await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Pull requests'));await tester.pumpAndSettle();server.append('The review is ready.');await c.refresh();@@ -275,7 +276,7 @@ void main() {final c = await show(tester, server);await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Pull requests'));await tester.pumpAndSettle();server.append('Not yet fetched');c.snapshot = SuperTabSnapshot.fromJson(server.state);@@ -662,7 +663,7 @@ void main() {expect(c.unread(c.selected!), isTrue);await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Pull requests'));await tester.pumpAndSettle();await tester.tap(find.byKey(const ValueKey('super-chat')));await tester.pumpAndSettle();diff --git a/desktop/test/super_tab_composer_chips_bottom_test.dart b/desktop/test/super_tab_composer_chips_bottom_test.dartindex f03deba8f..b80ce1e68 100644--- a/desktop/test/super_tab_composer_chips_bottom_test.dart+++ b/desktop/test/super_tab_composer_chips_bottom_test.dart@@ -146,10 +146,10 @@ void main() {reason: '$chip',);}- // The box is as tall as before: one control row inside its padding.+ // One control row inside its padding.expect(tester.getRect(surface).height,- closeTo(grid.AppControl.heightFieldScaled + 16, 1),+ closeTo(grid.AppControl.heightFieldScaled + 6, 1),);});diff --git a/desktop/test/super_tab_instructions_test.dart b/desktop/test/super_tab_instructions_test.dartindex 6deeb7802..b61489ee4 100644--- a/desktop/test/super_tab_instructions_test.dart+++ b/desktop/test/super_tab_instructions_test.dart@@ -3,6 +3,7 @@ import 'dart:async';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/detail_dialog.dart';import 'package:harness/super_tabs/instructions_panel.dart';@@ -71,7 +72,7 @@ void main() {return (server, controller);}- Finder menuItem(String label) => find.widgetWithText(MenuItemButton, label);+ Finder menuItem(String label) => find.widgetWithText(AppMenuItem, label);Future<void> openMenu(WidgetTester tester) async {await tester.tap(find.byTooltip('Project options'));diff --git a/desktop/test/super_tab_pane_layout_test.dart b/desktop/test/super_tab_pane_layout_test.dartindex d7ba0bce3..dec5a164c 100644--- a/desktop/test/super_tab_pane_layout_test.dart+++ b/desktop/test/super_tab_pane_layout_test.dart@@ -341,10 +341,7 @@ void main() {);await tester.pumpAndSettle();- // A strip of the design system's one gradient just outside the pane's- // left edge, darkest at the pane, fading out over the chat. A gradient,- // not a blurred shadow: a straight edge needs no blur, and a blur costs- // every repaint of the window (ENGINEERING.md 4).+ // No pane casts a shade: the 1-point rule between them separates them.Finder shadesIn(Finder pane) => find.descendant(of: pane,matching: find.byWidgetPredicate(@@ -357,25 +354,10 @@ void main() {);expect(shadesIn(center), findsNothing);expect(shadesIn(left), findsNothing);- final shade = shadesIn(right);- expect(shade, findsOne);- final decoration =- tester.widget<DecoratedBox>(shade).decoration as BoxDecoration;- expect(decoration.boxShadow, isNull);- final gradient = grid.AppDesktop.paneEdgeShade;- expect(decoration.gradient, gradient);- expect(gradient.begin, Alignment.centerRight);- expect(gradient.colors.first.a, greaterThan(0));- expect(gradient.colors.last.a, 0);- final strip = tester.getRect(shade), pane = tester.getRect(right);- expect(strip.right, pane.left);- expect(strip.width, grid.AppDesktop.paneEdgeShadeWidth);- expect(strip.top, pane.top);- expect(strip.bottom, pane.bottom);- expect(strip.left, greaterThan(tester.getRect(center).left));+ expect(shadesIn(right), findsNothing);- // It never takes a click meant for the chat beneath it.- await tester.tapAt(strip.centerLeft + const Offset(2, 0));+ // A click beside the pane is the chat's.+ await tester.tapAt(tester.getRect(right).centerLeft - const Offset(6, 0));expect(chatTaps, 1);final row = tester.widget<Row>(diff --git a/desktop/test/super_tab_pane_shadow_shots_test.dart b/desktop/test/super_tab_pane_shadow_shots_test.dartdeleted file mode 100644index 24b12a498..000000000--- a/desktop/test/super_tab_pane_shadow_shots_test.dart+++ /dev/null@@ -1,184 +0,0 @@-import 'dart:io';-import 'dart:ui' as ui;--import 'package:flutter/material.dart';-import 'package:flutter/rendering.dart';-import 'package:flutter_test/flutter_test.dart';-import 'package:harness/shared/theme/app_theme.dart' as grid;-import 'package:harness/super_tabs/pane_layout.dart';-import 'package:harness/super_tabs/roster.dart';-import 'package:harness/super_tabs/view.dart';--import 'box_render_preview_test.dart' show loadPreviewFonts;-import 'support/super_tab_fixture.dart';--/// Set to a folder to write the PR's screenshots there.-final shots = Platform.environment['SUPER_TAB_PANE_SHADOW_SHOTS'];--const _updates = [- 'Reading the offline queue before the reconnect.',- 'The reconnect keeps every queued edit in order.',- 'Two devices editing at once settle on the newest edit.',- 'Pushed the branch; the checks are running.',-];--/// Huy, 11-03: a thread, and Members, open on the right with a soft shadow on-/// their left edge, as in Slack: beside the chat in a wide window, and over it-/// as a drawer in a narrow one. Each takes the one shared shadow.-void main() {- setUpAll(() async {- if (shots != null) await loadPreviewFonts();- });-- for (final brightness in Brightness.values) {- for (final (name, size, members) in [- ('thread', const Size(1400, 800), false),- ('thread-drawer', const Size(900, 700), false),- ('members', const Size(1400, 800), true),- ('members-drawer', const Size(900, 700), true),- ]) {- testWidgets('$name casts the shared shadow (${brightness.name})', (- tester,- ) async {- final picture = GlobalKey();- const peer = {- 'kind': 'person',- 'id': 'peer',- 'name': '[email protected]',- };- final server = ConversationServer()..threads = true;- (server.state['people'] as List).add({- 'id': 'peer',- 'email': '[email protected]',- 'role': 'collaborator',- });- server.append('Should we do thread replies?');- for (var i = 1; i <= 6; i++) {- server.append(_updates[i % _updates.length]);- server.messages.last- ..['thread'] = 'message-1'- ..['replyTo'] = 'message-1'- ..['author'] = peer;- }- for (var i = 1; i <= 12; i++) {- server.append(_updates[i % _updates.length]);- server.messages.last['author'] = {- 'kind': 'agent',- 'id': 'lead-agent',- 'name': 'Lead',- };- }- final c = server.controller();- addTearDown(c.dispose);- await c.refresh();- grid.AppTheme.brightness.value = brightness;- addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);- await tester.binding.setSurfaceSize(size);- addTearDown(() => tester.binding.setSurfaceSize(null));- await tester.pumpWidget(- MaterialApp(- theme: grid.buildAppTheme(brightness: brightness),- builder: (context, child) =>- RepaintBoundary(key: picture, child: child),- home: Scaffold(- body: SuperTabView(- controller: c,- onInvite: () {},- onAddAgent: (_) {},- onOpenTerminal: (_) {},- machineName: (_) => 'Mac Studio',- ),- ),- ),- );- await tester.pumpAndSettle();- if (members) {- await tester.tap(find.byKey(const ValueKey('super-members-button')));- } else {- c.openThread('message-1');- }- await tester.pumpAndSettle();-- final pane = members- ? find.byType(SuperTabRoster)- : find.byKey(const ValueKey('super-thread-panel'));- expect(pane, findsOne);- // Written before the check, so a base without the shadow gives the- // before pictures.- if (shots != null) {- await tester.runAsync(() async {- final boundary =- picture.currentContext!.findRenderObject()!- as RenderRepaintBoundary;- final image = await boundary.toImage(pixelRatio: 1.5);- final bytes = await image.toByteData(- format: ui.ImageByteFormat.png,- );- await Directory(shots!).create(recursive: true);- await File('$shots/pane-shadow-$name-${brightness.name}.png')- .writeAsBytes(bytes!.buffer.asUint8List());- image.dispose();- });- }- final container = find.ancestor(- of: pane,- matching: find.byType(SuperTabRightPane),- );- expect(container, findsOne);- final shade = find.descendant(- of: container,- matching: find.byWidgetPredicate(- (w) =>- w is DecoratedBox &&- w.decoration is BoxDecoration &&- (w.decoration as BoxDecoration).gradient != null,- ),- );- expect(shade, findsOne);- expect(- (tester.widget<DecoratedBox>(shade).decoration as BoxDecoration)- .gradient,- grid.AppDesktop.paneEdgeShade,- );-- // What a person sees (where the chat is not under the dark drawer- // veil, which is already black): on most rows down the pane, the chat just left- // of its edge is darker than the chat a little further in.- if (!name.endsWith('drawer') || brightness == Brightness.light) {- final edge = tester.getRect(container);- final rows = [- for (var i = 1; i <= 9; i++) edge.top + edge.height * i / 10,- ];- final darker = await tester.runAsync(() async {- final boundary =- picture.currentContext!.findRenderObject()!- as RenderRepaintBoundary;- final image = await boundary.toImage();- final data = (await image.toByteData(- format: ui.ImageByteFormat.rawRgba,- ))!;- int luma(double x, double y) {- final at = (y.round() * image.width + x.round()) * 4;- return (data.getUint8(at) * 299 +- data.getUint8(at + 1) * 587 +- data.getUint8(at + 2) * 114) ~/- 1000;- }-- final count = rows- .where(- (y) => luma(edge.left - 40, y) - luma(edge.left - 2, y) >= 3,- )- .length;- image.dispose();- return count;- });- expect(darker, greaterThanOrEqualTo(6), reason: 'shaded rows of 9');- }-- await tester.pumpWidget(const SizedBox());- await c.flush();- });- }- }-}diff --git a/desktop/test/super_tab_phone_header_test.dart b/desktop/test/super_tab_phone_header_test.dartindex e216838bd..02f03d06b 100644--- a/desktop/test/super_tab_phone_header_test.dart+++ b/desktop/test/super_tab_phone_header_test.dart@@ -5,6 +5,7 @@import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/widgets/app_icon_button.dart';import 'package:harness/super_tabs/roster.dart';@@ -54,7 +55,7 @@ void main() {await tester.tap(_menu);await tester.pumpAndSettle();- final row = find.widgetWithText(MenuItemButton, 'Pull requests');+ final row = find.widgetWithText(AppMenuItem, 'Pull requests');expect(tester.getSize(row).height, greaterThanOrEqualTo(44));await tester.tap(row);await tester.pumpAndSettle();@@ -109,7 +110,7 @@ void main() {expect(_openView, findsNothing, reason: 'the chat is the default view');await tester.tap(_menu);await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Pull requests'));await tester.pumpAndSettle();expect(tester.widget<Text>(_openView).data, 'Pull requests');await unmountPhoneSuperTab(tester, chat);diff --git a/desktop/test/super_tab_project_delete_test.dart b/desktop/test/super_tab_project_delete_test.dartindex 90a9216d5..ecae44059 100644--- a/desktop/test/super_tab_project_delete_test.dart+++ b/desktop/test/super_tab_project_delete_test.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/view.dart';@@ -42,7 +43,7 @@ void main() {Future<void> openDelete(WidgetTester tester) async {await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));await tester.pumpAndSettle();await tester.tap(find.text('Delete Project'));await tester.pumpAndSettle();@@ -226,7 +227,7 @@ void main() {await mount(tester, server: server, account: 'peer');await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));await tester.pumpAndSettle();expect(find.text('Delete Project'), findsNothing);expect(server.posts, isEmpty);diff --git a/desktop/test/super_tab_project_menu_test.dart b/desktop/test/super_tab_project_menu_test.dartindex 20c85a39e..5c499e0d6 100644--- a/desktop/test/super_tab_project_menu_test.dart+++ b/desktop/test/super_tab_project_menu_test.dart@@ -1,5 +1,6 @@import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/super_tabs/project_status.dart';@@ -35,7 +36,7 @@ ConversationServer swarm({bool status = true, String owner = 'owner'}) {}Finder get menu => find.byTooltip('Project options');-Finder item(String label) => find.widgetWithText(MenuItemButton, label);+Finder item(String label) => find.widgetWithText(AppMenuItem, label);Future<void> open(WidgetTester tester) async {await tester.tap(menu);@@ -84,9 +85,7 @@ void main() {.getTopLeft(find.ancestor(of: find.text(label),- matching: find.byWidgetPredicate(- (w) => w is MenuItemButton || w is SubmenuButton,- ),+ matching: find.byWidgetPredicate((w) => w is AppMenuItem),),).dy,@@ -155,7 +154,7 @@ void main() {) async {await showView(tester, swarm(status: false));await open(tester);- expect(tester.widget<MenuItemButton>(item('Status')).onPressed, isNull);+ expect(tester.widget<AppMenuItem>(item('Status')).onPressed, isNull);});testWidgets('Pull requests opens the view, and the chat button comes back', (diff --git a/desktop/test/super_tab_project_status_test.dart b/desktop/test/super_tab_project_status_test.dartindex f995762a4..f0fdd455f 100644--- a/desktop/test/super_tab_project_status_test.dart+++ b/desktop/test/super_tab_project_status_test.dart@@ -6,6 +6,7 @@ import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/model.dart';@@ -175,7 +176,7 @@ void main() {Future<void> openStatus(WidgetTester tester) async {await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Status'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Status'));await tester.pumpAndSettle();}diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dartindex 4ca2a558f..e257bfdda 100644--- a/desktop/test/super_tab_roster_test.dart+++ b/desktop/test/super_tab_roster_test.dart@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/core/local_key_value_store.dart';import 'package:harness/core/models.dart';import 'package:harness/core/relative_time.dart';@@ -936,12 +937,12 @@ void main() {await f.show(tester);await tester.tap(f.row(0), buttons: kSecondaryMouseButton);await tester.pumpAndSettle();- final remove = find.widgetWithText(- PopupMenuItem<String>,- 'Remove from Swarm',+ final remove = find.ancestor(+ of: find.text('Remove from Swarm'),+ matching: find.byType(AppMenuItem),);expect(remove, findsOneWidget);- expect(tester.widget<PopupMenuItem<String>>(remove).enabled, isFalse);+ expect(tester.widget<AppMenuItem>(remove).onPressed, isNull);expect(find.text('Atlas is the Product Manager of project openharness. Delete the project first.',diff --git a/desktop/test/super_tab_sidebar_cleanup_test.dart b/desktop/test/super_tab_sidebar_cleanup_test.dartindex 8d5383aff..7f4809012 100644--- a/desktop/test/super_tab_sidebar_cleanup_test.dart+++ b/desktop/test/super_tab_sidebar_cleanup_test.dart@@ -92,6 +92,15 @@ void main() {greaterThan(tester.getTopLeft(find.text('Projects')).dy),);expect(find.text('Notifications'), findsNothing);+ // The foot lines up with the list, and ends on the chat box's bottom line.+ final manage = tester.getRect(find.byKey(const ValueKey('super-manage')));+ final activity = tester.getRect(+ find.byKey(const ValueKey('super-activity')),+ );+ final sidebar = tester.getRect(find.byType(ProjectSidebar));+ expect(manage.left, activity.left);+ expect(manage.width, activity.width);+ expect(sidebar.bottom - manage.bottom, ProjectSidebar.footGap);expect(tester.takeException(), isNull);await closeSwarm(tester, c);}, variant: TargetPlatformVariant.only(platform));diff --git a/desktop/test/super_tab_switch_pm_test.dart b/desktop/test/super_tab_switch_pm_test.dartindex bfc4a2fd7..554a2b19a 100644--- a/desktop/test/super_tab_switch_pm_test.dart+++ b/desktop/test/super_tab_switch_pm_test.dart@@ -2,6 +2,7 @@ import 'dart:io';import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/view.dart';@@ -115,7 +116,7 @@ void main() {Future<void> openMenu(WidgetTester tester) async {await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));await tester.pumpAndSettle();}@@ -393,13 +394,10 @@ void main() {await tester.pumpAndSettle();final reason = find.textContaining('Update Harness on Old Mac');expect(reason, findsOneWidget);- final old = tester.widget<DropdownMenuItem<String>>(- find.ancestor(- of: reason,- matching: find.byType(DropdownMenuItem<String>),- ),+ final old = tester.widget<AppMenuItem>(+ find.ancestor(of: reason, matching: find.byType(AppMenuItem)),);- expect(old.enabled, isFalse);+ expect(old.onPressed, isNull);await finish(tester);});@@ -442,13 +440,10 @@ void main() {'Only the project’s owner moves its PM to another machine.',);expect(reason, findsOneWidget);- final other = tester.widget<DropdownMenuItem<String>>(- find.ancestor(- of: reason,- matching: find.byType(DropdownMenuItem<String>),- ),+ final other = tester.widget<AppMenuItem>(+ find.ancestor(of: reason, matching: find.byType(AppMenuItem)),);- expect(other.enabled, isFalse);+ expect(other.onPressed, isNull);await finish(tester);},);diff --git a/desktop/test/super_tab_view_test.dart b/desktop/test/super_tab_view_test.dartindex 76216b630..e5ab66b9d 100644--- a/desktop/test/super_tab_view_test.dart+++ b/desktop/test/super_tab_view_test.dart@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/shared/theme/app_icons.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/super_tabs/model.dart';import 'package:harness/super_tabs/controller.dart';@@ -168,9 +169,7 @@ void main() {Future<void> openList() async {await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(- find.widgetWithText(MenuItemButton, 'Project settings…'),- );+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));await tester.pumpAndSettle();await tester.tap(find.text('Archived conversations'));await tester.pumpAndSettle();@@ -229,7 +228,7 @@ void main() {expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Project settings…'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));await tester.pumpAndSettle();await tester.tap(find.text('Archived conversations'));await tester.pumpAndSettle();diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dartindex 11f1ff325..a4fd3a33b 100644--- a/desktop/test/swarm_add_agent_test.dart+++ b/desktop/test/swarm_add_agent_test.dart@@ -3,6 +3,7 @@ import 'support/open_harness.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/appearance_prefs_store.dart';import 'package:harness/state/pane_arrangement.dart';import 'package:harness/state/swarm_navigation.dart';import 'package:harness/state/swarm_search.dart';@@ -13,6 +14,15 @@ import 'swarm_screen_test.dart' show mount, terminal;import 'swarm_state_test.dart' show createApp;void main() {+ // These pin exact rectangles after a split, with Autobalance splits off.+ setUp(() {+ final previous = appearancePrefsStore.value;+ addTearDown(() => appearancePrefsStore.value = previous);+ appearancePrefsStore.value = previous.copyWith(+ panes: previous.panes.copyWith(autobalanceSplits: false),+ );+ });+testWidgets('New Pane shortcut reuses the chosen session in this workspace', (tester,) async {diff --git a/desktop/test/swarm_creation_form_test.dart b/desktop/test/swarm_creation_form_test.dartindex 68c5831f1..22fe35ef8 100644--- a/desktop/test/swarm_creation_form_test.dart+++ b/desktop/test/swarm_creation_form_test.dart@@ -368,10 +368,10 @@ void main() {.data;bool rowEnabled(WidgetTester tester, String id) =>tester- .widget<MenuItemButton>(+ .widget<AppMenuItem>(find.descendant(of: leadRow(id),- matching: find.byType(MenuItemButton),+ matching: find.byType(AppMenuItem),),).onPressed !=@@ -610,7 +610,7 @@ void main() {);await openMachines(tester);SemanticsNode node(String id) => tester.getSemantics(- find.descendant(of: leadRow(id), matching: find.byType(MenuItemButton)),+ find.descendant(of: leadRow(id), matching: find.byType(AppMenuItem)),);expect(node('laptop'),@@ -1180,7 +1180,7 @@ void main() {.getSemantics(find.descendant(of: leadRow(id),- matching: find.byType(MenuItemButton),+ matching: find.byType(AppMenuItem),),).getSemanticsData()diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dartindex a3378d182..97e7e36fd 100644--- a/desktop/test/swarm_projects_test.dart+++ b/desktop/test/swarm_projects_test.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/super_tabs/activity.dart';import 'package:harness/super_tabs/view.dart';@@ -160,7 +161,7 @@ void main() {await mount(tester, c);await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Pull requests'));await tester.pumpAndSettle();expect(find.text('example/lamp #12'), findsOneWidget);expect(find.text('example/design #8'), findsNothing);@@ -169,7 +170,7 @@ void main() {await tester.pumpAndSettle();await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.tap(find.widgetWithText(AppMenuItem, 'Pull requests'));await tester.pumpAndSettle();expect(find.text('example/design #8'), findsOneWidget);expect(find.text('example/lamp #12'), findsNothing);@@ -218,9 +219,7 @@ void main() {await mount(tester, c);await tester.tap(find.byTooltip('Project options'));await tester.pumpAndSettle();- await tester.tap(- find.widgetWithText(MenuItemButton, 'Project settings…'),- );+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));await tester.pumpAndSettle();expect(find.text('Project details'), findsOneWidget);expect(find.text('Update cadence'), findsNothing);diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dartindex 6703ed256..1879807c3 100644--- a/desktop/test/swarm_split_test.dart+++ b/desktop/test/swarm_split_test.dart@@ -8,6 +8,7 @@ import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/shared/theme/app_pane_icon.dart';+import 'package:harness/shared/theme/appearance_prefs_store.dart';import 'package:harness/state/new_harness.dart';import 'package:harness/state/pane_arrangement.dart';import 'package:harness/state/pane_preset.dart';@@ -105,6 +106,15 @@ Future<void> _create(WidgetTester tester, _Creation connection) async {}void main() {+ // These pin exact rectangles after a split, with Autobalance splits off.+ setUp(() {+ final previous = appearancePrefsStore.value;+ addTearDown(() => appearancePrefsStore.value = previous);+ appearancePrefsStore.value = previous.copyWith(+ panes: previous.panes.copyWith(autobalanceSplits: false),+ );+ });+for (final axis in PaneResizeAxis.values) {final direction = axis == PaneResizeAxis.x ? 'right' : 'down';final shortcut = axis == PaneResizeAxis.xdiff --git a/desktop/test/terminal_ui_typography_test.dart b/desktop/test/terminal_ui_typography_test.dartindex 470e2c1ba..46aa63999 100644--- a/desktop/test/terminal_ui_typography_test.dart+++ b/desktop/test/terminal_ui_typography_test.dart@@ -172,7 +172,7 @@ void main() {final widget = element.widget as EditableText;if (element.findAncestorWidgetOfExactType<TextField>()?.key ==const ValueKey('new-harness-task')) {- expect(widget.style.fontSize, 15);+ expect(widget.style.fontSize, 13);expect(widget.style.fontFamily, grid.AppType.sansFamily);continue;}@@ -202,7 +202,7 @@ void main() {final task = tester.widget<TextField>(find.byKey(const ValueKey('new-harness-task')),);- expect(task.style!.fontSize, 15);+ expect(task.style!.fontSize, 13);expect(task.style!.fontFamily, grid.AppType.sansFamily);expect(tester.getSize(find.byKey(const ValueKey('new-harness-composer'))).width,diff --git a/desktop/test/windows_app_menu_test.dart b/desktop/test/windows_app_menu_test.dartnew file mode 100644index 000000000..3119dfbaa--- /dev/null+++ b/desktop/test/windows_app_menu_test.dart@@ -0,0 +1,295 @@+import 'dart:ui' show PointerDeviceKind;++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_menu.dart';++import 'package:harness/screens/swarm_menu_bus.dart';+import 'package:harness/shared/theme/app_icons.dart';+import 'package:harness/shared/theme/app_theme.dart';+import 'package:harness/widgets/in_window_menu_bar.dart';++/// The compact app menu Windows draws in the tab strip+/// (desktop/design/windows-app-menu.md).+///+/// It replaced the menu strip above the workspace, so the contract under test is+/// reachability: one button, one panel, the same seven sections and the same+/// action strings the strip dispatched. Styling is not pinned here — the strip's+/// own tests hold the rows to their metrics.+void main() {+ TestWidgetsFlutterBinding.ensureInitialized();++ final appActions = <String>[];+ final sinkActions = <String>[];++ setUp(() {+ appActions.clear();+ sinkActions.clear();+ swarmMenuBus.send('update', {+ 'enabled': true,+ 'canReopen': true,+ 'canFind': true,+ 'canClosePane': true,+ 'canGoBack': true,+ 'canGoForward': true,+ });+ });++ tearDown(() {+ appMenuActionSink = null;+ swarmMenuBus.send('update', {'enabled': false});+ });++ Future<void> pumpCompact(+ WidgetTester tester, {+ AppMenuActionHandler? onAction,+ bool defaultHandler = true,+ }) async {+ tester.view.physicalSize = const Size(900 * 2, 700 * 2);+ tester.view.devicePixelRatio = 2;+ addTearDown(tester.view.reset);++ await tester.pumpWidget(+ MaterialApp(+ theme: buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: InWindowMenuBar(+ compact: true,+ onAction: defaultHandler+ ? (onAction ?? (action) async => appActions.add(action))+ : null,+ ),+ ),+ ),+ );+ }++ /// Taps the first hit-testable widget under [key], settling between attempts+ /// while a panel finishes opening or its rows scroll into view.+ Future<void> tap(WidgetTester tester, String key) async {+ for (var attempt = 0; attempt < 6; attempt++) {+ final candidates = find.byKey(Key(key));+ if (candidates.evaluate().isNotEmpty) {+ await tester.ensureVisible(candidates.first);+ await tester.pumpAndSettle();+ final tappable = candidates.hitTestable();+ if (tappable.evaluate().isNotEmpty) {+ await tester.tap(tappable.first);+ await tester.pumpAndSettle();+ return;+ }+ }+ await tester.pump(const Duration(milliseconds: 50));+ }+ fail('no tappable widget for $key');+ }++ testWidgets('keeps the glyph whole in the strip\'s narrowest slot', (+ tester,+ ) async {+ await tester.pumpWidget(+ MaterialApp(+ theme: buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ // Two cells of the Windows bar font are 14-16px; the slot the tab+ // strip reserves is pinned to the button's own 32px width.+ body: Align(+ alignment: Alignment.centerLeft,+ child: SizedBox(+ width: appMenuButtonWidth,+ // A handler, as every host passes one: without it the bar+ // asserts before it draws the button this test measures.+ child: InWindowMenuBar(compact: true, onAction: (_) async {}),+ ),+ ),+ ),+ ),+ );++ expect(tester.getSize(find.byIcon(AppIcons.galleryVerticalEnd)).width, 16);+ // The drawn box is the hit area (design note UI-WAM-001: Z1 x H3).+ expect(+ tester.getSize(find.byKey(const Key('app-menu-button'))),+ const Size(32, 32),+ );+ });++ testWidgets('Escape closes the panel', (tester) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');+ expect(find.byKey(const Key('app-menu-section-harness')), findsOneWidget);++ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();++ expect(find.byKey(const Key('app-menu-section-harness')), findsNothing);+ });++ testWidgets('draws one button and no menu strip', (tester) async {+ await pumpCompact(tester);++ expect(find.byKey(const Key('app-menu-button')), findsOneWidget);+ // None of the strip's menu buttons or section names is on screen until the+ // panel opens.+ expect(find.byKey(const Key('menu-bar-harness')), findsNothing);+ expect(find.byKey(const Key('app-menu-section-harness')), findsNothing);+ });++ testWidgets('the names run across one row, with no Window section', (+ tester,+ ) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');++ for (final section in [+ 'Harness',+ 'File',+ 'Edit',+ 'View',+ 'History',+ 'Help',+ ]) {+ expect(find.text(section), findsOneWidget, reason: 'section $section');+ }+ // The window's own caption buttons are this section's rows.+ expect(find.text('Window'), findsNothing);+ // Each name is a tab over the rows the strip drew for it.+ await tap(tester, 'app-menu-section-harness');+ expect(find.text('About Harness'), findsOneWidget);+ expect(find.text('Settings…'), findsOneWidget);+ });++ testWidgets('an app row dispatches its action string', (tester) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');+ await tap(tester, 'app-menu-section-harness');+ await tap(tester, 'menu-bar-about');++ expect(appActions, ['showAbout']);+ });++ testWidgets('rows fall back to the shell sink when no handler is passed', (+ tester,+ ) async {+ appMenuActionSink = (action) async => sinkActions.add(action);+ await pumpCompact(tester, defaultHandler: false);+ await tap(tester, 'app-menu-button');+ await tap(tester, 'app-menu-section-help');+ await tap(tester, 'menu-bar-export-logs');++ expect(sinkActions, ['exportLogs']);+ expect(appActions, isEmpty);+ });++ testWidgets('a second press closes the panel', (tester) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');+ expect(find.byKey(const Key('app-menu-section-harness')), findsOneWidget);++ await tap(tester, 'app-menu-button');+ expect(find.byKey(const Key('app-menu-section-harness')), findsNothing);+ });++ testWidgets('every switcher on the strip still uses the same strings', (+ tester,+ ) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');++ // The panel is the strip's rows, so the swarm row that used to sit on the+ // File button dispatches through the bus with the same action name.+ final calls = <MethodCall>[];+ swarmMenuBus.setHandler((call) async => calls.add(call));+ addTearDown(() => swarmMenuBus.setHandler(null));+ await tap(tester, 'app-menu-section-file');+ await tap(tester, 'menu-bar-close-tab');+ expect(calls.map((call) => call.method), contains('closeActive'));+ });++ testWidgets('one panel: tabs on top, the open tab\'s rows under them', (+ tester,+ ) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');++ final tab = find.byKey(const Key('app-menu-section-harness'));+ final first = find.byKey(const Key('menu-bar-about'));+ // It opens on a tab, with its rows already there and nothing to point at.+ expect(first, findsOneWidget);+ expect(+ tester.getTopLeft(first).dy,+ greaterThan(tester.getBottomLeft(tab).dy),+ );+ // Every row is the panel's width, whatever its label's.+ expect(tester.getSize(first).width, 420);+ expect(tester.getSize(find.byKey(const Key('menu-bar-quit'))).width, 420);+ // One panel, not one per section.+ expect(find.byType(AppSubmenuItem), findsNothing);+ });++ testWidgets('a click changes the tab, and pointing at one does not', (+ tester,+ ) async {+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');+ final help = find.byKey(const Key('app-menu-section-help'));++ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);+ addTearDown(mouse.removePointer);+ await mouse.addPointer(location: Offset.zero);+ await mouse.moveTo(tester.getCenter(help));+ await tester.pumpAndSettle();+ expect(find.byKey(const Key('menu-bar-about')), findsOneWidget);+ expect(find.byKey(const Key('menu-bar-export-logs')), findsNothing);++ await tester.tap(help);+ await tester.pumpAndSettle();+ expect(find.byKey(const Key('menu-bar-about')), findsNothing);+ expect(find.byKey(const Key('menu-bar-export-logs')), findsOneWidget);+ });++ testWidgets('a long list gets a search field, and picks from what it finds', (+ tester,+ ) async {+ swarmMenuBus.send('update', {+ 'enabled': true,+ 'canFind': true,+ 'canClosePane': true,+ });+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');+ await tap(tester, 'app-menu-section-file');++ expect(find.byKey(const Key('app-menu-search')), findsOneWidget);+ await tester.enterText(find.byKey(const Key('app-menu-search')), 'split');+ await tester.pumpAndSettle();+ expect(find.text('Split Right'), findsOneWidget);+ expect(find.text('New Harness'), findsNothing);+ // The tabs stay: a search narrows the rows, not the panel.+ expect(find.byKey(const Key('app-menu-section-help')), findsOneWidget);+ });++ testWidgets('a section leaves out what cannot be used right now', (+ tester,+ ) async {+ swarmMenuBus.send('update', {+ 'enabled': true,+ 'canReopen': false,+ 'canFind': false,+ 'canClosePane': false,+ 'canGoBack': false,+ 'canGoForward': false,+ });+ await pumpCompact(tester);+ await tap(tester, 'app-menu-button');+ await tap(tester, 'app-menu-section-history');++ // Nothing greyed, no "nothing here" lines and no orphaned headings.+ expect(find.text('Back'), findsNothing);+ expect(find.text('Reopen Closed Tab or Pane'), findsNothing);+ expect(find.text('No Recent Visits'), findsNothing);+ expect(find.text('Recently Visited'), findsNothing);+ expect(find.text('Show Full History'), findsOneWidget);+ });+}diff --git a/scripts/ui-style-allowlist/desktop.json b/scripts/ui-style-allowlist/desktop.jsonindex 9962a4c63..19d996e4b 100644--- a/scripts/ui-style-allowlist/desktop.json+++ b/scripts/ui-style-allowlist/desktop.json@@ -82,7 +82,7 @@"edge-insets": 2},"desktop/lib/super_tabs/view.dart": {- "edge-insets": 19,+ "edge-insets": 18,"border-radius": 1}}