Skip to content

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

feat(web): Share and Split pane return to the menu, Download app to the phone footer

Dev jacobbf91439a6715
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index 2fd3e0cf1..dbedd1236 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -114,8 +114,9 @@ which runs the same `_commands` table keys use, gives the picker a clickable Bac
`KeyHints` — `widgets/key_hints.dart`, absent means hints shown). Below
`WorkspaceChrome.compactBelow` (web: 720px, a phone) the workspace goes compact: a tab
switcher replaces the tab row, `WorkspaceChrome.compactFooter` replaces the status bar with one
-dropdown plus Share (hidden while the on-screen keyboard is up), and `PaneGrid.soloFocused` draws only the focused harness —
-without touching zoom or the synced layout, so the same desk keeps its grid on a computer. Do not change desktop behavior for the
+dropdown, Download app, and Share when it is on (hidden while the on-screen keyboard is up), and `PaneGrid.soloFocused` draws only the focused harness —
+without touching zoom or the synced layout, so the same desk keeps its grid on a computer. Solo still records the desk's
+arrangement (`Swarm.arranged`), because that is what a split divides: without it the menu's Split pane could never run on a phone. Do not change desktop behavior for the
web, and do not copy shared screens into `lib/web/` — add a seam instead.
`kViewerMode` is true on the web:
diff --git a/desktop/lib/web/footer/web_footer_bar.dart b/desktop/lib/web/footer/web_footer_bar.dart
index 0defc190c..39f49f7e4 100644
--- a/desktop/lib/web/footer/web_footer_bar.dart
+++ b/desktop/lib/web/footer/web_footer_bar.dart
@@ -8,14 +8,16 @@ import '../../terminal/terminal_theme.dart';
import '../../terminal/terminal_theme_store.dart';
import '../../widgets/box_chrome.dart' show kWorkspaceInset;
import '../../widgets/pane_menu.dart';
+import '../../widgets/web_download_button.dart';
import '../../widgets/workspace_bar_control.dart';
import '../../widgets/workspace_share_button.dart';
import '../shell/web_dropdown_control.dart';
import '../shell/web_hidden_under_keyboard.dart';
/// The footer on a phone, shaped like its header: the whole status line as one
-/// dropdown whose menu holds each entry, and Share beside it. Gone while the
-/// on-screen keyboard is up — the terminal needs that height more.
+/// dropdown whose menu holds each entry, then Download app, and Share when it
+/// is on. Gone while the on-screen keyboard is up — the terminal needs that
+/// height more.
class WebFooterBar extends StatelessWidget {
const WebFooterBar({super.key, required this.footer});
@@ -54,7 +56,12 @@ class WebFooterBar extends StatelessWidget {
),
),
),
- if (share != null) _WebShareIconButton(share: share),
+ // One filled action in the bar: Share when it is on.
+ WebDownloadButton(prominent: share == null),
+ if (share != null) ...[
+ SizedBox(width: workspaceBarCellSizeOf(context).width),
+ _WebShareIconButton(share: share),
+ ],
],
),
),
diff --git a/desktop/lib/web/shell/web_menu_items.dart b/desktop/lib/web/shell/web_menu_items.dart
index 3361b8afc..9c56dc391 100644
--- a/desktop/lib/web/shell/web_menu_items.dart
+++ b/desktop/lib/web/shell/web_menu_items.dart
@@ -9,9 +9,11 @@ typedef WebMenuItem = ({String command, String label, WebMenuWidth width});
/// What the menu offers, in groups a thin rule separates. Only what has no
/// other door in the browser chrome: new work is the `+` beside the tabs
/// (a new tab opens on "Start an agent"), agents the search button, tabs the
-/// tab bar and switcher, attention the bell, sharing and pane work the pane's
-/// own header; keyboard tours and grid layout stay out of a mouse-first menu.
-/// All commands still reaches every one.
+/// tab bar and switcher, attention the bell, closing a pane its own header;
+/// keyboard tours and grid layout stay out of a mouse-first menu. Sharing and
+/// splitting are here because the header gave them up: Share is an
+/// experimental button, off until asked for, and a split is an edge to hover,
+/// which a finger cannot. All commands still reaches every one.
const List<List<WebMenuItem>> kWebMenuGroups = [
[
(command: 'machines.list', label: 'Machines', width: WebMenuWidth.any),
@@ -19,6 +21,12 @@ const List<List<WebMenuItem>> kWebMenuGroups = [
// The wide bar has its own Store button; the phone bar gives it up.
(command: 'app.store', label: 'Store', width: WebMenuWidth.compact),
],
+ [
+ (command: 'agent.share', label: 'Share harness', width: WebMenuWidth.any),
+ // One split, always to the right: a second "down" row only lengthens the
+ // menu, and All commands still has Split down.
+ (command: 'pane.split_right', label: 'Split pane', width: WebMenuWidth.any),
+ ],
[
(command: 'navigation.history', label: 'History', width: WebMenuWidth.any),
(
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index 55ce1a88e..b4a55b312 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -517,6 +517,15 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
);
}
+ /// How [count] panes of the active tab are laid out in [viewport].
+ _SwarmGeometry _geometry(int count, Size viewport) => _SwarmGeometry(
+ count: count,
+ viewport: viewport,
+ preset: widget.notifier.presetFor(count),
+ minimum: _MinTile.of(),
+ sizes: widget.notifier.activeSwarm.paneSizes,
+ );
+
@override
Widget build(BuildContext context) {
TerminalFontScope.watch(context);
@@ -533,20 +542,21 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
for (final pane in app.panes)
if (_shownZoom == null || pane.id == _shownZoom) pane,
];
- final layout = _SwarmGeometry(
- count: visible.length,
- viewport: constraints.biggest,
- preset: app.presetFor(visible.length),
- minimum: _MinTile.of(),
- sizes: app.activeSwarm.paneSizes,
- );
- if (_shownZoom == null) {
- app.activeSwarm.arranged = layout.arrangement;
- app.activeSwarm.arrangedKey = layout.key;
+ final layout = _geometry(visible.length, constraints.biggest);
+ // Solo draws one pane of a desk that is still there: the desk is what
+ // gets recorded, so a split made on a phone has something to divide.
+ final desk = _shownZoom == null
+ ? layout
+ : widget.soloFocused && app.zoomedPaneId == null
+ ? _geometry(app.panes.length, constraints.biggest)
+ : null;
+ if (desk != null) {
+ app.activeSwarm.arranged = desk.arrangement;
+ app.activeSwarm.arrangedKey = desk.key;
final minimum = _MinTile.of();
app.activeSwarm.arrangedMinimum = Size(
- (minimum.width + kPaneGap) / (layout.width + kPaneGap),
- (minimum.height + kPaneGap) / (layout.height + kPaneGap),
+ (minimum.width + kPaneGap) / (desk.width + kPaneGap),
+ (minimum.height + kPaneGap) / (desk.height + kPaneGap),
);
}
if (layout.columns != null) app.gridColumns = layout.columns;
diff --git a/desktop/test/web/web_app_menu_test.dart b/desktop/test/web/web_app_menu_test.dart
index f9bd46c34..4aad8f04e 100644
--- a/desktop/test/web/web_app_menu_test.dart
+++ b/desktop/test/web/web_app_menu_test.dart
@@ -62,6 +62,12 @@ void main() {
findsOneWidget,
);
expect(find.byKey(const ValueKey('web-menu:web.sign_out')), findsOneWidget);
+ // An empty tab has no pane to split and no harness to share.
+ expect(
+ find.byKey(const ValueKey('web-menu:pane.split_right')),
+ findsNothing,
+ );
+ expect(find.byKey(const ValueKey('web-menu:agent.share')), findsNothing);
await tester.tap(find.byKey(const ValueKey('web-menu:app.settings')));
await tester.pump(const Duration(milliseconds: 400));
expect(find.byType(SettingsScreen), findsOneWidget);
diff --git a/desktop/test/web_menu_items_test.dart b/desktop/test/web_menu_items_test.dart
index 2ff983251..4553e3e76 100644
--- a/desktop/test/web_menu_items_test.dart
+++ b/desktop/test/web_menu_items_test.dart
@@ -33,8 +33,6 @@ void main() {
'swarm.new',
'harnesses.list',
'navigation.needs_input',
- 'agent.share',
- 'pane.split_right',
'pane.split_down',
'pane.close',
'pane.zoom',
@@ -46,9 +44,14 @@ void main() {
}
});
+ test('sharing and one split, to the right, have a row', () {
+ final all = _commands(runnableWebMenu((_) => true, compact: true));
+ expect(all, containsAll(['agent.share', 'pane.split_right']));
+ });
+
test('rows that cannot run, and groups left empty, are not drawn', () {
final menu = runnableWebMenu(
- (command) => !command.endsWith('.list'),
+ (command) => !command.startsWith('pane.') && command != 'agent.share',
compact: false,
);
expect(menu, hasLength(kWebMenuGroups.length - 1));
diff --git a/desktop/test/web_tab_switcher_test.dart b/desktop/test/web_tab_switcher_test.dart
index 7f5cdea7d..d6c1a6e64 100644
--- a/desktop/test/web_tab_switcher_test.dart
+++ b/desktop/test/web_tab_switcher_test.dart
@@ -12,6 +12,7 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/app_state.dart';
import 'package:harness/state/terminal_pane.dart';
import 'package:harness/web/shell/web_chrome.dart';
+import 'package:harness/widgets/web_download_button.dart';
import 'support/real_fonts.dart';
@@ -186,6 +187,25 @@ void main() {
find.byKey(const ValueKey('workspace-subscription-usage')),
findsNothing,
);
+ // Beside it, Download app alone: Share is off until asked for.
+ expect(
+ tester.getRect(find.byKey(footer)).right,
+ lessThanOrEqualTo(tester.getRect(find.byType(WebDownloadButton)).left),
+ );
+ expect(
+ find.byKey(const ValueKey('workspace-share-button')),
+ findsNothing,
+ );
+
+ // One harness drawn alone still has a desk to split: the menu offers it.
+ await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(
+ find.byKey(const ValueKey('web-menu:pane.split_right')),
+ findsOneWidget,
+ );
+ await tester.tapAt(const Offset(350, 600));
+ await tester.pump(const Duration(milliseconds: 100));
await tester.tap(find.byKey(footer));
await tester.pump(const Duration(milliseconds: 100));