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(mobile): the tabs mark unrolls a rail of tab names under the header

Dev jacob4d9f3ab04bbf
diff --git a/mobile/README.md b/mobile/README.md
index 6cff3b05f..515431c4f 100644
--- a/mobile/README.md
+++ b/mobile/README.md
@@ -54,11 +54,12 @@ and it is deliberately not the window's:
the tab the phone is in, and one deleted here leaves every tab that held it.
- Which tab is open, and where you were inside it, stay on the device — as they do per window.
-What the person sees of it is one mark beside `⋯` in the terminal's header, which opens the tabs as
-a sheet (`lib/phone/desk_tabs_sheet.dart`), and a swipe that walks that tab's agents rather than the
-whole account (`lib/phone/desk_groups.dart`). **The terminal keeps the screen**: a rail of tabs
-across the top was tried and taken out again — it cost a line and a half of somebody's session,
-permanently, for a choice made a few times a day.
+What the person sees of it is one mark beside `⋯` in the terminal's header, which unrolls the tabs
+as a rail under it (`lib/phone/desk_tab_strip.dart`), and a swipe that walks that tab's agents
+rather than the whole account (`lib/phone/desk_groups.dart`). **The terminal keeps the screen**: the
+rail is not drawn until the mark is pressed and goes away again the moment a tab is picked. A rail
+standing there permanently was tried and taken out — it cost a line and a half of somebody's
+session, all day, for a choice made a few times a day.
The tabs are re-read every 15s while the app is in the foreground (`PhoneDesk.pollInterval`), and
that is not belt-and-braces here: `desk_changed` reaches a phone only over a machine's relay socket,
diff --git a/mobile/RELEASE.md b/mobile/RELEASE.md
index e8eaf36b8..a821c99c9 100644
--- a/mobile/RELEASE.md
+++ b/mobile/RELEASE.md
@@ -71,8 +71,9 @@ icon size in thirty seconds instead of in an email twenty minutes later.
| `1.0.0 (20)` | 2026-09-21 | TestFlight. The phone holds only the agent on screen: the two beside it are no longer opened in advance, and the one swiped away from is closed — each hands its terminal back to the desktop. Voice keeps the audio at both ends of a take |
| `1.0.0 (21)` | 2026-09-21 | TestFlight. The account's tabs reach the phone: a swipe stays inside the tab you are in, the tabs themselves sit behind a mark beside `⋯`, and an agent started here joins that tab |
| `1.0.0 (22)` | 2026-09-21 | TestFlight. Named **Harness** on the home screen and in the app, with a new icon; the terminal runs to the bottom edge of the screen; only an explicit Take control press claims a terminal from the desktop |
+| `1.0.0 (23)` | 2026-09-21 | TestFlight. The tabs mark unrolls the account's tabs as a rail of names under the header — the tab you are in wears a bar under its name — instead of opening a sheet; picking one switches and puts the rail away |
-`pubspec.yaml` is therefore at `1.0.0+23`: the repo always holds the NEXT build number, so a release
+`pubspec.yaml` is therefore at `1.0.0+24`: the repo always holds the NEXT build number, so a release
runs clean without anyone having to remember the last one.
### Why the app is iPhone-only
diff --git a/mobile/lib/phone/desk_tab_strip.dart b/mobile/lib/phone/desk_tab_strip.dart
new file mode 100644
index 000000000..3e8ba2155
--- /dev/null
+++ b/mobile/lib/phone/desk_tab_strip.dart
@@ -0,0 +1,195 @@
+import 'package:flutter/services.dart';
+import 'package:flutter/widgets.dart';
+
+import 'package:harness_mobile/shared/theme/app_theme.dart';
+import 'package:harness_mobile/state/app_state.dart';
+
+import 'desk_groups.dart';
+import 'phone_navigation.dart';
+import 'terminal_header.dart';
+
+/// The account's tabs as a rail of names under the terminal's header — the
+/// browser's own tab strip, one name per tab with a bar under the one you are
+/// in.
+///
+/// ```
+/// Desktop Docker Other
+/// ━━━━━━━
+/// ```
+///
+/// ⚠️ **It is not on screen by default, and that is what pays for it.** The
+/// terminal IS the screen here: every permanent line of chrome above it is a
+/// line of somebody's session that is not being shown, and the tab is chosen a
+/// few times a day. So the mark beside `⋯` opens the rail, the rail closes
+/// again the moment a tab is picked, and the terminal keeps its rows the rest
+/// of the time — see [TerminalPage].
+///
+/// ⚠️ **A tab with nothing this phone can open is drawn, dimmed and inert.**
+/// Its agents are on a machine that is asleep or wants its password. Dropping
+/// it from the rail would read as a tab somebody deleted — see [DeskGroup].
+class DeskTabStrip extends StatelessWidget {
+ const DeskTabStrip({
+ super.key,
+ required this.groups,
+ required this.activeId,
+ required this.onPick,
+ });
+
+ /// Every tab, in the desk's own order, with the leftover group last — see
+ /// [deskGroups]. Never empty.
+ final List<DeskGroup> groups;
+
+ /// [DeskGroup.id] of the tab the phone is in — see [activeDeskGroup]. Null is
+ /// a real value: it is the leftover group, and it wears the bar like any
+ /// other.
+ final String? activeId;
+
+ final void Function(DeskGroup group) onPick;
+
+ /// The rail's height, which is what the header's reveal animates open to.
+ ///
+ /// One 15pt line, the bar under it, and the air either side that keeps the
+ /// names off the header above and the output below.
+ static const double height = 40;
+
+ /// The gap between two names. Wide enough that two short tabs — `All`, `adu`
+ /// — read as two, narrow enough that four fit on a phone without scrolling.
+ static const double _gap = 22;
+
+ @override
+ Widget build(BuildContext context) {
+ AppTheme.watch(context);
+ return SizedBox(
+ height: height,
+ // Scrolls, because a desk can carry more tabs than a phone is wide. The
+ // names keep their own widths — nothing is squeezed to make a row fit,
+ // which is what turns tab names into `Deskt…`, `Dock…`.
+ child: ListView.separated(
+ scrollDirection: Axis.horizontal,
+ padding: const EdgeInsets.symmetric(
+ horizontal: TerminalHeader.sideInset,
+ ),
+ itemCount: groups.length,
+ separatorBuilder: (context, index) => const SizedBox(width: _gap),
+ itemBuilder: (context, index) {
+ final group = groups[index];
+ return _DeskTabName(
+ name: group.name,
+ selected: group.id == activeId,
+ enabled: !group.isEmpty,
+ onTap: () => onPick(group),
+ );
+ },
+ ),
+ );
+ }
+}
+
+/// One name in the rail, with the bar under it while it is the tab you are in.
+///
+/// ⚠️ **The bar is drawn in a [Stack] rather than under the text in a column.**
+/// It has to be exactly as wide as the name it belongs to, and a column in a
+/// horizontally scrolling list is laid out against an infinite width — there is
+/// no cross-axis measure for a `stretch`ed bar to take. Stacked, the text is
+/// the non-positioned child that sizes the whole thing, and the bar spans it.
+class _DeskTabName extends StatelessWidget {
+ const _DeskTabName({
+ required this.name,
+ required this.selected,
+ required this.enabled,
+ required this.onTap,
+ });
+
+ final String name;
+ final bool selected;
+
+ /// False for a tab whose agents are all out of reach: drawn dim, and it does
+ /// not answer a tap.
+ final bool enabled;
+
+ final VoidCallback onTap;
+
+ static const double _barHeight = 2;
+ static const double _barGap = 5;
+
+ @override
+ Widget build(BuildContext context) {
+ AppTheme.watch(context);
+ final color = switch ((enabled, selected)) {
+ (false, _) => AppPalette.textFaint,
+ (true, true) => AppPalette.textPrimary,
+ (true, false) => AppPalette.textSecondary,
+ };
+ return GestureDetector(
+ // Opaque, so the whole height of the rail either side of the name takes
+ // the tap — a 15pt word is a small thing to hit with a thumb.
+ behavior: HitTestBehavior.opaque,
+ onTap: enabled ? _tapped : null,
+ child: Center(
+ child: Stack(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(bottom: _barGap + _barHeight),
+ child: Text(
+ name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ color: color,
+ fontSize: 15,
+ // The tab you are in is a weight heavier as well as darker,
+ // which is what carries it to someone who cannot see the bar
+ // — the same pairing [PhoneTabBar] uses below.
+ fontWeight: selected ? FontWeight.w600 : FontWeight.w500,
+ height: 1.2,
+ ),
+ ),
+ ),
+ if (selected)
+ Positioned(
+ left: 0,
+ right: 0,
+ bottom: 0,
+ child: Container(
+ height: _barHeight,
+ decoration: BoxDecoration(
+ color: AppPalette.textPrimary,
+ borderRadius: BorderRadius.circular(_barHeight / 2),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ void _tapped() {
+ HapticFeedback.selectionClick();
+ onTap();
+ }
+}
+
+/// Switch to [group]: the phone is in that tab from here, and the agent it
+/// opens is the one this phone was last on in it — its first, the first time.
+///
+/// ⚠️ The order matters. [AppNotifier.selectDeskTab] is what settles which tab
+/// an agent that sits on TWO of them belongs to (see [activeDeskGroup]); set
+/// after the open, it would be read a frame too late and the rail would bar the
+/// tab that was left.
+void openDeskGroup(
+ BuildContext context,
+ AppNotifier notifier,
+ DeskGroup group,
+) {
+ if (group.isEmpty) return;
+ notifier.selectDeskTab(group.id);
+ final remembered = notifier.deskLastAgentIn(group.id);
+ final target = remembered != null && group.holds(remembered)
+ ? remembered
+ : (
+ machineId: group.entries.first.machineId,
+ agentId: group.entries.first.agent.id,
+ );
+ openAgent(context, notifier, target.machineId, target.agentId);
+}
diff --git a/mobile/lib/phone/desk_tabs_sheet.dart b/mobile/lib/phone/desk_tabs_sheet.dart
deleted file mode 100644
index 83345fbe4..000000000
--- a/mobile/lib/phone/desk_tabs_sheet.dart
+++ /dev/null
@@ -1,81 +0,0 @@
-import 'dart:async';
-
-import 'package:flutter/widgets.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/core/last_opened_agent.dart' show AgentRef;
-import 'package:harness_mobile/state/app_state.dart';
-
-import 'agent_index.dart';
-import 'desk_groups.dart';
-import 'phone_navigation.dart';
-import 'phone_sheet.dart';
-
-/// The account's tabs, as a sheet — the way to another tab on a phone, now that
-/// a swipe stays inside the one you are in.
-///
-/// ⚠️ **A sheet and not a row of chips along the top, and the difference is the
-/// terminal.** The terminal is the screen; every point of chrome above it is a
-/// line of somebody's session that is not shown. A rail of tabs cost a line and
-/// a half permanently, for a decision that is made a few times a day — so what
-/// stays on screen is one mark in the header beside `⋯`, and the list lives
-/// behind it.
-///
-/// [showing] is the agent on screen, which is what decides the tab the phone is
-/// in — see [activeDeskGroup]. Opened from the terminal page, so it always has
-/// one.
-Future<void> showDeskTabsSheet(
- BuildContext context,
- AppNotifier notifier, {
- required AgentRef showing,
-}) {
- final groups = deskGroups(notifier, visibleAgents(agentIndex(notifier)));
- final active = activeDeskGroup(notifier, groups, showing);
- return showPhoneSheet(
- context,
- title: 'Tabs',
- actions: [
- for (final group in groups)
- PhoneSheetAction(
- // The tab you are in wears the tick; the rest wear the tab mark. A
- // colour alone would say it to fewer people.
- icon: group.id == active.id
- ? LucideIcons.check300
- : LucideIcons.layoutGrid300,
- label: group.name,
- value: switch (group.entries.length) {
- // Its agents are on a machine that is asleep or wants its password.
- // Listed anyway: a tab missing from this list reads as one somebody
- // deleted. See [DeskGroup].
- 0 => 'not here now',
- 1 => '1 agent',
- final count => '$count agents',
- },
- // A tab with nothing this phone can open is a row to read, not one to
- // press — [showPhoneSheet] draws it dimmed and stays open on a tap.
- enabled: !group.isEmpty,
- onTap: () => _open(context, notifier, group),
- ),
- ],
- );
-}
-
-/// Switch to [group]: the phone is in that tab from here, and the agent it
-/// opens is the one this phone was last on in it — its first, the first time.
-///
-/// ⚠️ The order matters. [AppNotifier.selectDeskTab] is what settles which tab
-/// an agent that sits on TWO of them belongs to (see [activeDeskGroup]); set
-/// after the open, it would be read a frame too late and the sheet would tick
-/// the tab that was left.
-void _open(BuildContext context, AppNotifier notifier, DeskGroup group) {
- if (group.isEmpty) return;
- notifier.selectDeskTab(group.id);
- final remembered = notifier.deskLastAgentIn(group.id);
- final target = remembered != null && group.holds(remembered)
- ? remembered
- : (
- machineId: group.entries.first.machineId,
- agentId: group.entries.first.agent.id,
- );
- openAgent(context, notifier, target.machineId, target.agentId);
-}
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index d4d6b1e25..db0d9a665 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -20,10 +20,12 @@ import 'package:harness_mobile/terminal/terminal_session.dart';
import 'package:harness_mobile/widgets/rename_agent_dialog.dart';
import 'package:harness_mobile/widgets/terminal_panel.dart';
+import 'agent_index.dart';
import 'agents_list_page.dart';
import 'agents_page.dart' show openNewAgent;
import 'delete_agent.dart';
-import 'desk_tabs_sheet.dart';
+import 'desk_groups.dart';
+import 'desk_tab_strip.dart';
import 'held_height.dart';
import 'machines_tab.dart';
import 'phone_navigation.dart' show phoneRoute;
@@ -168,7 +170,7 @@ typedef _PageFacts = ({
PhoneMachineStatus? machineStatus,
bool imagePaste,
String? machineName,
- bool deskTabs,
+ String deskTabs,
});
class _TerminalPageState extends State<TerminalPage>
@@ -419,7 +421,13 @@ class _TerminalPageState extends State<TerminalPage>
// only when one of these facts moves. Tabs arriving from another computer
// change nothing else about this agent, and the mark that opens them
// would not appear until something unrelated happened to redraw the page.
- deskTabs: notifier.deskTabs.isNotEmpty,
+ //
+ // ⚠️ Their NAMES, not just whether there are any: the rail under the
+ // header draws the names, so a tab renamed on the desk has to reach a
+ // page that is showing it — see [DeskTabStrip].
+ deskTabs: [
+ for (final tab in notifier.deskTabs) '${tab.id}\u0000${tab.name}',
+ ].join('\u0001'),
);
}
@@ -1225,30 +1233,25 @@ class _TerminalPageState extends State<TerminalPage>
),
// The account's tabs, one mark before `⋯` — the
// only way to another tab now that a swipe stays
- // inside the one you are in (see [showDeskTabsSheet]).
+ // inside the one you are in.
//
- // ⚠️ **A mark, not a rail of tabs across the top.**
- // The terminal is the screen; chrome above it is
- // somebody's session not being shown, and this is a
- // choice made a few times a day.
+ // ⚠️ **It opens the rail below rather than a
+ // sheet**, and the rail is not on screen until it
+ // does: the terminal is the screen, and chrome
+ // above it is somebody's session not being shown.
+ // See [DeskTabStrip].
//
- // Undrawn for an account with no tabs at all: there
- // would be one row in the sheet, naming every agent
- // on the account, which is what a swipe already does.
+ // Undrawn for an account with no tabs at all: the
+ // rail would carry one name over every agent on the
+ // account, which is what a swipe already does.
if (widget.notifier.deskTabs.isNotEmpty)
_HeaderAction(
icon: LucideIcons.layoutGrid300,
+ // One name in both states, open and closed: it
+ // is the mark for the tabs, and the rail below
+ // is what says which of the two it is in.
tooltip: 'Tabs',
- onPressed: () => unawaited(
- showDeskTabsSheet(
- context,
- widget.notifier,
- showing: (
- machineId: widget.machineId,
- agentId: widget.agentId,
- ),
- ),
- ),
+ onPressed: _toggleTabs,
),
// Null while the agent is not loaded: there is
// nothing to act on yet, and a menu of actions
@@ -1269,6 +1272,11 @@ class _TerminalPageState extends State<TerminalPage>
),
],
),
+ // ⚠️ Above the divider, so the rail is part of the
+ // bar rather than a row floating on the output: the
+ // hairline stays the line where chrome ends and the
+ // terminal begins, wherever the rail is.
+ _tabStrip(),
Divider(height: 1, color: AppGlass.hair),
// ⚠️ Inside the header's own slide, not under it: the two are one bar as far
// as a scroll is concerned, and a band left behind while the header left
@@ -1364,6 +1372,60 @@ class _TerminalPageState extends State<TerminalPage>
});
}
+ /// Whether the tab rail under the header is open.
+ ///
+ /// Closed on arrival, and closed again the moment a tab is picked: the rail
+ /// is a question asked a few times a day, and the rest of the time its height
+ /// belongs to the terminal — see [DeskTabStrip].
+ bool _tabsOpen = false;
+
+ void _toggleTabs() => setState(() => _tabsOpen = !_tabsOpen);
+
+ /// A tab was tapped in the rail.
+ ///
+ /// [current] is the tab this page is already in, which closes the rail and
+ /// does nothing else: opening it would re-attach the terminal already on
+ /// screen, and a tap on the tab you are in reads as "yes, this one".
+ void _pickDeskGroup(DeskGroup group, {required bool current}) {
+ setState(() => _tabsOpen = false);
+ if (current) return;
+ openDeskGroup(context, widget.notifier, group);
+ }
+
+ /// The rail, open or closed, as the header's own column draws it.
+ ///
+ /// ⚠️ **The groups are built only while it is open.** [deskGroups] walks
+ /// every agent on the account, and this page is rebuilt on any fact of its
+ /// own moving — paying for that on every status tick, to lay out a rail
+ /// nobody has asked for, is work for nothing.
+ ///
+ /// Closed it is a zero-height box rather than nothing at all, so
+ /// [AnimatedSize] has a size on both sides of the change to run between.
+ Widget _tabStrip() {
+ final notifier = widget.notifier;
+ Widget child = const SizedBox(width: double.infinity);
+ if (_tabsOpen && notifier.deskTabs.isNotEmpty) {
+ final groups = deskGroups(notifier, visibleAgents(agentIndex(notifier)));
+ final activeId = activeDeskGroup(notifier, groups, (
+ machineId: widget.machineId,
+ agentId: widget.agentId,
+ )).id;
+ child = DeskTabStrip(
+ groups: groups,
+ activeId: activeId,
+ onPick: (group) => _pickDeskGroup(group, current: group.id == activeId),
+ );
+ }
+ return AnimatedSize(
+ duration: const Duration(milliseconds: 180),
+ curve: Curves.easeOutCubic,
+ // From under the header: the rail unrolls downward over the terminal
+ // rather than growing out of its own middle.
+ alignment: Alignment.topCenter,
+ child: child,
+ );
+ }
+
void _showActions({
required String machineName,
required String agentName,
diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml
index 3d755e083..5b038fb25 100644
--- a/mobile/pubspec.yaml
+++ b/mobile/pubspec.yaml
@@ -2,7 +2,7 @@ name: harness_mobile
description: "Harness viewer for iOS and Android."
publish_to: 'none'
-version: 1.0.0+23
+version: 1.0.0+24
environment:
sdk: ^3.13.0
diff --git a/mobile/test/phone_desk_tabs_test.dart b/mobile/test/phone_desk_tabs_test.dart
index b87be4f8b..027cef535 100644
--- a/mobile/test/phone_desk_tabs_test.dart
+++ b/mobile/test/phone_desk_tabs_test.dart
@@ -3,6 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness_mobile/phone/agent_home.dart';
import 'package:harness_mobile/phone/agent_swipe.dart';
import 'package:harness_mobile/phone/desk_groups.dart';
+import 'package:harness_mobile/phone/desk_tab_strip.dart';
import 'package:harness_mobile/phone/terminal_header.dart';
import 'package:harness_mobile/phone/phone_shell_scope.dart';
import 'package:harness_mobile/state/app_state.dart';
@@ -20,7 +21,7 @@ import 'desk_fixture.dart';
/// which is the whole change, and it can be read without flinging anything.
void main() {
/// The home screen as the shell mounts it: an agent picked anywhere else —
- /// the tabs sheet included — arrives through [AgentHome.openAgent], and the
+ /// the tab rail included — arrives through [AgentHome.openAgent], and the
/// shell is what carries it there.
Future<AppNotifier> pumpHome(
WidgetTester tester, {
@@ -52,23 +53,34 @@ void main() {
AgentSwipeHost pager(WidgetTester tester) =>
tester.widget<AgentSwipeHost>(find.byType(AgentSwipeHost));
- /// Open the tabs sheet from the mark in the header, and pick [tab] in it.
+ /// Open the rail from the mark in the header — see [DeskTabStrip].
///
/// ⚠️ **Timed pumps, never `pumpAndSettle`.** These pages have no terminal
/// behind them (see [deskApp]), so each one draws the "Attaching…" skeleton —
/// which breathes for ever, and `pumpAndSettle` waits for a still frame that
- /// never comes. The waits below are the sheet's own open and dismiss
- /// animations; the row runs its action after the dismissal (see
- /// [showPhoneSheet]), so the second one is the switch as well.
- Future<void> switchTo(WidgetTester tester, String tab) async {
+ /// never comes. The wait is the rail's own unroll.
+ Future<void> openRail(WidgetTester tester) async {
await tester.tap(find.byTooltip('Tabs'));
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
+ }
+
+ /// Pick [tab] in the rail already open, which switches and closes at once.
+ Future<void> pick(WidgetTester tester, String tab) async {
await tester.tap(find.text(tab));
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
}
+ /// Open the rail and pick [tab] in it.
+ Future<void> switchTo(WidgetTester tester, String tab) async {
+ await openRail(tester);
+ await pick(tester, tab);
+ }
+
+ DeskTabStrip rail(WidgetTester tester) =>
+ tester.widget<DeskTabStrip>(find.byType(DeskTabStrip));
+
List<String> swipesOver(WidgetTester tester) => [
for (final entry in pager(tester).neighbours!.entries) entry.agent.id,
];
@@ -143,7 +155,7 @@ void main() {
});
testWidgets('an account with no tabs is offered none', (tester) async {
- // Nothing on the desk: the sheet would hold one row naming every agent on
+ // Nothing on the desk: the rail would carry one name over every agent on
// the account, which is what a swipe already walks. So no mark at all, and
// the header is the row it has always been.
await pumpHome(tester, tabs: []);
@@ -198,4 +210,69 @@ void main() {
expect(pager(tester).agentId, 'a');
expect(swipesOver(tester), ['a', 'b']);
});
+
+ testWidgets('the rail is drawn only while the mark is on', (tester) async {
+ await pumpHome(
+ tester,
+ tabs: [
+ deskTab('t1', 'Desktop', ['a', 'b']),
+ deskTab('t2', 'Docker', ['c']),
+ ],
+ );
+
+ // The terminal keeps its rows until somebody asks for the tabs.
+ expect(find.byType(DeskTabStrip), findsNothing);
+
+ await openRail(tester);
+ expect(rail(tester).groups.map((group) => group.name), [
+ 'Desktop',
+ 'Docker',
+ kUntabbedGroupName,
+ ]);
+
+ // The same mark puts it away again.
+ await openRail(tester);
+ expect(find.byType(DeskTabStrip), findsNothing);
+ });
+
+ testWidgets('the rail bars the tab the agent on screen is in', (
+ tester,
+ ) async {
+ await pumpHome(
+ tester,
+ tabs: [
+ deskTab('t1', 'Desktop', ['a', 'b']),
+ deskTab('t2', 'Docker', ['c']),
+ ],
+ );
+
+ await openRail(tester);
+ expect(rail(tester).activeId, 't1');
+
+ // The rail is already open, so this is the pick alone — opening it again
+ // here would put it away.
+ await pick(tester, 'Docker');
+ await openRail(tester);
+ expect(rail(tester).activeId, 't2');
+ });
+
+ testWidgets('picking the tab you are in only closes the rail', (
+ tester,
+ ) async {
+ await pumpHome(
+ tester,
+ tabs: [
+ deskTab('t1', 'Desktop', ['a', 'b']),
+ deskTab('t2', 'Docker', ['c']),
+ ],
+ );
+
+ await switchTo(tester, 'Desktop');
+
+ // Still on `a`, and the rail is away: re-opening the tab already on screen
+ // would re-attach the terminal under it for nothing.
+ expect(pager(tester).agentId, 'a');
+ expect(swipesOver(tester), ['a', 'b']);
+ expect(find.byType(DeskTabStrip), findsNothing);
+ });
}