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
Add Settings and menu entry points for customization (#172)
Dee9b17721c8ee9
diff --git a/desktop/design/review/customization-panel.png b/desktop/design/review/customization-panel.pngnew file mode 100644index 000000000..3fda82025Binary files /dev/null and b/desktop/design/review/customization-panel.png differdiff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 92724dc71..1524b622b 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -1109,6 +1109,8 @@ class _SwarmScreenState extends State<SwarmScreen> {unawaited(_notifications());case 'settings':await _settings();+ case 'customize':+ await _customize();}if (mounted &&const {@@ -1254,25 +1256,7 @@ class _SwarmScreenState extends State<SwarmScreen> {keymap: _keymap,);});- Future<void> _customize() => _dialog(() async {- await showAppDialog<void>(- context: context,- veilTint: Colors.transparent,- veilBlur: 0,- transitionDuration: Duration.zero,- builder: (context) => Align(- alignment: Alignment.centerRight,- child: SizedBox(- width: (440 * MediaQuery.textScalerOf(context).scale(13) / 13).clamp(- 0,- MediaQuery.sizeOf(context).width,- ),- height: double.infinity,- child: HarnessCustomizePane(onClose: () => Navigator.pop(context)),- ),- ),- );- });+ Future<void> _customize() => _dialog(() => showHarnessCustomizePane(context));Future<void> _settings([SettingsSection? section]) => _dialog(() => showSettingsScreen(diff --git a/desktop/lib/settings/settings_nav.dart b/desktop/lib/settings/settings_nav.dartindex f02913923..45cea37c9 100644--- a/desktop/lib/settings/settings_nav.dart+++ b/desktop/lib/settings/settings_nav.dart@@ -5,7 +5,7 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';import '../shared/layouts/widgets/rail_section_header.dart';import '../shared/layouts/widgets/sidebar_item.dart';import '../shared/theme/app_theme.dart' as grid;-import '../widgets/window_chrome.dart';+import '../shared/widgets/section_scaffold.dart';import 'settings_section.dart';/// The settings list: the way back, a field that narrows the list to what you@@ -101,31 +101,36 @@ class _SettingsNavState extends State<SettingsNav> {@overrideWidget build(BuildContext context) {- // The rail owns its fill and spans the window's full height, so the fill- // runs under the traffic lights too — head and column read as one surface- // rather than two shades.+ // The rail and the section begin below the native title bar.grid.AppTheme.watch(context);return Container(width: SettingsNav.width,color: grid.AppSurface.recess,child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 10),+ // Rows add their own icon gutter: their glyphs and group captions sit+ // on the same 24px content inset as the section on the right.+ padding: const EdgeInsets.symmetric(+ horizontal: SectionScaffold.contentPadding - SidebarItem.iconGutter,+ ),child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- // Clearance for the traffic lights, and the rail's share of the- // window drag handle.- const WindowDragStrip(),- const SizedBox(height: 6),+ const SizedBox(height: SectionScaffold.contentPadding),// A SidebarItem like the rows below, so the way out hovers,// highlights and aligns exactly like them instead of being a// shrink-wrapped button in its own grey.- SidebarItem(- icon: LucideIcons.arrowLeft300,- label: 'Back to app',- onTap: () => Navigator.of(context).maybePop(),+ SizedBox(+ height: SectionScaffold.headingHeight(context),+ child: Center(+ child: SidebarItem(+ key: const Key('settings-back-button'),+ icon: LucideIcons.arrowLeft300,+ label: 'Back to app',+ onTap: () => Navigator.of(context).maybePop(),+ ),+ ),),- const SizedBox(height: 8),+ const SizedBox(height: 12),Focus(onKeyEvent: _searchKey,skipTraversal: true,@@ -136,7 +141,7 @@ class _SettingsNavState extends State<SettingsNav> {onSubmitted: (_) => _chooseMatch(),),),- const SizedBox(height: 2),+ const SizedBox(height: 8),Expanded(child: _navList()),],),diff --git a/desktop/lib/settings/settings_screen.dart b/desktop/lib/settings/settings_screen.dartindex e8235d879..2012dede2 100644--- a/desktop/lib/settings/settings_screen.dart+++ b/desktop/lib/settings/settings_screen.dart@@ -4,7 +4,7 @@ import 'package:flutter/services.dart';import '../analytics/analytics.dart';import '../shared/theme/app_theme.dart' as grid;import '../state/app_state.dart';-import '../widgets/window_chrome.dart';+import '../widgets/harness_customize_pane.dart';import 'sections/about_section.dart';import 'sections/account_section.dart';import 'sections/debug_section.dart';@@ -34,9 +34,13 @@ Future<void> showSettingsScreen(// because a pane reachable several ways is close to meaningless as a bare// count.required String source,-}) {- return Navigator.of(context).push<void>(- PageRouteBuilder<void>(+}) async {+ if (initialSection == SettingsSection.customize) {+ await showHarnessCustomizePane(context);+ return;+ }+ final action = await Navigator.of(context).push<SettingsSection>(+ PageRouteBuilder<SettingsSection>(// Opaque: it covers the window, and letting the shell show through would// mean compositing four live terminals under it for nothing.pageBuilder: (context, animation, _) => SettingsScreen(@@ -48,6 +52,11 @@ Future<void> showSettingsScreen(reverseTransitionDuration: Duration.zero,),);+ // Leave the opaque Settings route before opening the panel, keeping the+ // active terminals visible behind the controls and retaining caller focus.+ if (action == SettingsSection.customize && context.mounted) {+ await showHarnessCustomizePane(context);+ }}/// Settings: pick on the left, work on the right.@@ -57,7 +66,10 @@ class SettingsScreen extends StatefulWidget {required this.notifier,this.initialSection,this.source = 'unknown',- });+ }) : assert(+ initialSection != SettingsSection.customize,+ 'Open workspace actions through showSettingsScreen.',+ );final AppNotifier notifier;@@ -115,6 +127,10 @@ class _SettingsScreenState extends State<SettingsScreen> {/// Move to another pane, from the settings rail.void _show(SettingsSection target) {+ if (target == SettingsSection.customize) {+ Navigator.of(context).pop(target);+ return;+ }if (target == _section) return;analytics.screenView(_screenName(target), source: 'rail');setState(() => _section = target);@@ -130,10 +146,8 @@ class _SettingsScreenState extends State<SettingsScreen> {@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);- // Row-first, so the nav rail owns the window's full height and its fill- // runs from y=0 — under the macOS traffic lights included. A header across- // the top would have to carry the rail's fill over the pane as well, which- // is what leaves the top of a window reading as a separate, lighter band.+ // The native title bar already owns window dragging. Settings starts below+ // it, with the same content inset on both sides of the divider.return Focus(onKeyEvent: _key,child: Scaffold(@@ -144,20 +158,9 @@ class _SettingsScreenState extends State<SettingsScreen> {SettingsNav(section: _section, onSelect: _show),VerticalDivider(width: 1, color: grid.AppPalette.divider),Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- // The pane needs the traffic lights' clearance and somewhere to- // grab the window, but no fill of its own — it sits on the- // window. The rail draws its own.- const WindowDragStrip(),- Expanded(- child: _SettingsBody(- section: _section,- notifier: widget.notifier,- ),- ),- ],+ child: _SettingsBody(+ section: _section,+ notifier: widget.notifier,),),],@@ -182,6 +185,9 @@ class _SettingsBody extends StatelessWidget {final screen = switch (section) {SettingsSection.account => AccountSection(notifier: notifier),SettingsSection.usage => const UsageSection(),+ SettingsSection.customize => throw StateError(+ 'Customization opens over the workspace.',+ ),SettingsSection.devices => const DevicesSection(),SettingsSection.shortcuts => const ShortcutsSection(),SettingsSection.debug => const DebugSection(),diff --git a/desktop/lib/settings/settings_section.dart b/desktop/lib/settings/settings_section.dartindex bd4537be2..a687a517a 100644--- a/desktop/lib/settings/settings_section.dart+++ b/desktop/lib/settings/settings_section.dart@@ -3,7 +3,8 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';import '../logging/debug_surface.dart';-/// One screen in Settings — a row in its rail, and the pane that row opens.+/// A Settings navigation entry. Customize returns to the workspace and opens+/// its side panel; the other entries select a Settings page.////// Declared once, like [ShortcutAction] in `shortcuts/app_shortcuts.dart`: the/// rail, the search filter and the pane all read this list, so a section cannot@@ -11,6 +12,7 @@ import '../logging/debug_surface.dart';enum SettingsSection {account(LucideIcons.user300, 'Account'),usage(LucideIcons.chartNoAxesColumn300, 'Usage'),+ customize(LucideIcons.palette300, 'Customize'),devices(LucideIcons.zap300, 'Autonomous robots'),shortcuts(LucideIcons.keyboard300, 'Keyboard shortcuts'),debug(LucideIcons.bug300, 'Debug'),@@ -82,6 +84,7 @@ const _kSettingsGroups = [// which logs are read at all — the pane is off until somebody sets it.SettingsGroup('Preferences', [SettingsSection.usage,+ SettingsSection.customize,SettingsSection.devices,SettingsSection.account,]),diff --git a/desktop/lib/shared/theme/prompt_style.dart b/desktop/lib/shared/theme/prompt_style.dartindex b61395b4a..1f485caa7 100644--- a/desktop/lib/shared/theme/prompt_style.dart+++ b/desktop/lib/shared/theme/prompt_style.dart@@ -5,7 +5,7 @@ const kHarnessPromptMarker = '>_';enum PromptStyle {plain('Plain', 'ASCII markers, quiet and compact'),symbols('Symbols', 'Harness, machine, folder and branch marks'),- powerline('Powerline', 'Joined segments, like a shell prompt');+ powerline('Powerline', 'Joined segments with angled separators');const PromptStyle(this.label, this.description);final String label, description;diff --git a/desktop/lib/shared/widgets/section_scaffold.dart b/desktop/lib/shared/widgets/section_scaffold.dartindex e65130739..b457e8336 100644--- a/desktop/lib/shared/widgets/section_scaffold.dart+++ b/desktop/lib/shared/widgets/section_scaffold.dart@@ -17,6 +17,13 @@ class SectionScaffold extends StatelessWidget {final String title;final String? subtitle;+ static const double contentPadding = 24;++ /// Settings navigation shares this row so Back and the section heading stay+ /// aligned, including when the user enlarges text.+ static double headingHeight(BuildContext context) =>+ MediaQuery.textScalerOf(context).scale(40);+/// Fills the space under the rule, so a body that can outgrow the window/// brings its own scroll view.final Widget child;@@ -25,11 +32,18 @@ class SectionScaffold extends StatelessWidget {Widget build(BuildContext context) {final theme = Theme.of(context);return Padding(- padding: const EdgeInsets.all(24),+ padding: const EdgeInsets.all(contentPadding),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- Text(title, style: theme.textTheme.headlineSmall),+ ConstrainedBox(+ constraints: BoxConstraints(minHeight: headingHeight(context)),+ child: Align(+ alignment: Alignment.centerLeft,+ heightFactor: 1,+ child: Text(title, style: theme.textTheme.headlineSmall),+ ),+ ),if (subtitle != null) ...[const SizedBox(height: 4),Text(diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dartindex d5639d61b..9a72d87ba 100644--- a/desktop/lib/shortcuts/keymap_commands.dart+++ b/desktop/lib/shortcuts/keymap_commands.dart@@ -358,6 +358,7 @@ final harnessCommands = <HarnessCommand>['app.customize','Customize OpenHarness',ShortcutGroup.actions,+ nativeAction: 'customize',),const HarnessCommand('app.store',diff --git a/desktop/lib/widgets/harness_customize_pane.dart b/desktop/lib/widgets/harness_customize_pane.dartindex 60d6ce212..a393281e2 100644--- a/desktop/lib/widgets/harness_customize_pane.dart+++ b/desktop/lib/widgets/harness_customize_pane.dart@@ -1,5 +1,3 @@-import 'dart:async';-import 'package:flutter/material.dart';import 'package:flutter/services.dart';@@ -7,13 +5,32 @@ import '../settings/sections/appearance_section.dart';import '../settings/sections/terminal_section.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/theme/appearance_prefs_store.dart';-import '../shared/theme/harness_background.dart';-import 'swarm_wallpaper.dart';+import '../shared/widgets/app_dialog.dart';import 'box_chrome.dart';import 'prompt_customize.dart';-/// Page-local customization. Appearance and Terminal use their existing stores-/// and controls, so moving them here keeps the user's saved choices intact.+/// Opens customization over the workspace so appearance changes remain visible+/// on the terminals. All global entry points use this same right-side panel.+Future<void> showHarnessCustomizePane(BuildContext context) =>+ showAppDialog<void>(+ context: context,+ veilTint: Colors.transparent,+ veilBlur: 0,+ transitionDuration: Duration.zero,+ builder: (context) => Align(+ alignment: Alignment.centerRight,+ child: SizedBox(+ width: (440 * MediaQuery.textScalerOf(context).scale(13) / 13).clamp(+ 0,+ MediaQuery.sizeOf(context).width,+ ),+ height: double.infinity,+ child: HarnessCustomizePane(onClose: () => Navigator.pop(context)),+ ),+ ),+ );++/// Appearance and Terminal share the app's existing preference stores.class HarnessCustomizePane extends StatelessWidget {const HarnessCustomizePane({super.key, required this.onClose, this.store});final VoidCallback onClose;@@ -30,7 +47,7 @@ class HarnessCustomizePane extends StatelessWidget {child: CallbackShortcuts(bindings: {const SingleActivator(LogicalKeyboardKey.escape): onClose},child: DefaultTabController(- length: 4,+ length: 3,child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [@@ -67,11 +84,7 @@ class HarnessCustomizePane extends StatelessWidget {dividerColor: grid.AppPalette.divider,labelStyle: boxMonoStyle(size: 12),tabs: const [- Tab(key: ValueKey('customize-prompt'), text: 'Prompt'),- Tab(- key: ValueKey('customize-background'),- text: 'Wallpaper',- ),+ Tab(key: ValueKey('customize-prompt'), text: 'Pane'),Tab(key: ValueKey('customize-appearance'),text: 'Appearance',@@ -83,7 +96,6 @@ class HarnessCustomizePane extends StatelessWidget {child: TabBarView(children: [PromptCustomize(store: store ?? appearancePrefsStore),- _Backgrounds(store: store ?? appearancePrefsStore),const AppearanceSection(),const TerminalSection(),],@@ -97,97 +109,3 @@ class HarnessCustomizePane extends StatelessWidget {);}}--class _Backgrounds extends StatelessWidget {- const _Backgrounds({required this.store});- final AppearancePrefsStore store;-- @override- Widget build(BuildContext context) => SingleChildScrollView(- padding: const EdgeInsets.all(20),- child: ValueListenableBuilder<AppearancePrefs>(- valueListenable: store,- builder: (context, prefs, _) => LayoutBuilder(- builder: (context, constraints) => Wrap(- spacing: 12,- runSpacing: 12,- children: [- for (final choice in HarnessBackground.values)- SizedBox(- width: (constraints.maxWidth - 12) / 2,- child: _BackgroundChoice(- choice: choice,- selected: prefs.background == choice,- onChoose: () => unawaited(store.setBackground(choice)),- ),- ),- ],- ),- ),- ),- );-}--class _BackgroundChoice extends StatelessWidget {- const _BackgroundChoice({- required this.choice,- required this.selected,- required this.onChoose,- });- final HarnessBackground choice;- final bool selected;- final VoidCallback onChoose;-- @override- Widget build(BuildContext context) => Semantics(- selected: selected,- button: true,- label: '${choice.label} wallpaper',- onTap: onChoose,- child: ExcludeSemantics(- child: TextButton(- key: ValueKey('background-${choice.name}'),- onPressed: onChoose,- style: TextButton.styleFrom(- padding: const EdgeInsets.all(6),- foregroundColor: grid.AppPalette.textPrimary,- backgroundColor: grid.AppPalette.cardBg,- side: BorderSide(- color: selected- ? grid.AppPalette.swarmAccent- : grid.AppPalette.divider,- width: 1.5,- ),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(12),- ),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- ClipRRect(- borderRadius: BorderRadius.circular(7),- child: AspectRatio(- aspectRatio: 1.6,- child: SwarmWallpaper(background: choice, thumbnail: true),- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(4, 8, 4, 4),- child: Row(- children: [- Expanded(child: Text(choice.label)),- const SizedBox(width: 4),- SizedBox(- width: 16,- child: selected ? const Icon(Icons.check, size: 16) : null,- ),- ],- ),- ),- ],- ),- ),- ),- );-}diff --git a/desktop/lib/widgets/prompt_customize.dart b/desktop/lib/widgets/prompt_customize.dartindex b98b0a0d1..cbdcf8cdc 100644--- a/desktop/lib/widgets/prompt_customize.dart+++ b/desktop/lib/widgets/prompt_customize.dart@@ -52,7 +52,7 @@ class PromptCustomize extends StatelessWidget {crossAxisAlignment: CrossAxisAlignment.stretch,children: [Text(- 'prompt style',+ 'header style',style: boxMonoStyle(color: grid.AppPalette.textSecondary),),const SizedBox(height: 8),@@ -110,22 +110,15 @@ class PromptCustomize extends StatelessWidget {TerminalBox(child: Padding(padding: const EdgeInsets.all(12),- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- PromptContextView(- key: const ValueKey('prompt-preview'),- store: store,- contextData: const PromptContext(- harness: 'Codex',- machine: 'devbox',- project: 'openharness',- branch: 'main',- ),- ),- const SizedBox(height: 12),- Text('> fix the login flow', style: boxMonoStyle()),- ],+ child: PromptContextView(+ key: const ValueKey('prompt-preview'),+ store: store,+ contextData: const PromptContext(+ harness: 'Codex',+ machine: 'devbox',+ project: 'openharness',+ branch: 'main',+ ),),),),@@ -174,7 +167,7 @@ class PromptCustomize extends StatelessWidget {key: const ValueKey('prompt-reset'),onPressed: () => choose(const PromptPrefs()),child: Text(- 'Reset prompt style',+ 'Reset header style',style: boxMonoStyle(color: grid.AppPalette.textSecondary),),),diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex 59f7f95c5..b96629b50 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -222,6 +222,12 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {settings.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + "settings")settings.keyEquivalentModifierMask = [.command]if settings.menu == nil { appMenu.insertItem(settings, at: min(2, appMenu.numberOfItems)) }+ let customize = NSMenuItem(title: "Customize Harness", action: #selector(menuAction(_:)), keyEquivalent: "")+ customize.target = self+ customize.representedObject = "customize"+ customize.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + "customize")+ customize.image = NSImage(systemSymbolName: "paintpalette", accessibilityDescription: nil)+ appMenu.insertItem(customize, at: appMenu.index(of: settings))}func add(_ menu: NSMenu, _ title: String, _ key: String, _ action: String, _ modifiers: NSEvent.ModifierFlags = [.command]) {let item = NSMenuItem(title: title, action: #selector(menuAction(_:)), keyEquivalent: key)diff --git a/desktop/test/harness_customize_test.dart b/desktop/test/harness_customize_test.dartindex 4cd82881a..b829495fe 100644--- a/desktop/test/harness_customize_test.dart+++ b/desktop/test/harness_customize_test.dart@@ -7,14 +7,22 @@ import 'dart:ui' as ui;import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';+import 'package:flutter_riverpod/flutter_riverpod.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness/app_shell.dart';import 'package:harness/core/local_key_value_store.dart';import 'package:harness/screens/swarm_screen.dart';+import 'package:harness/settings/settings_screen.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/shared/theme/appearance_prefs_store.dart';import 'package:harness/shared/theme/color_palette.dart';import 'package:harness/shared/theme/harness_background.dart';+import 'package:harness/state/app_state.dart';+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:xterm/xterm.dart';import 'support/real_fonts.dart';@@ -159,15 +167,128 @@ void main() {},);+ for (final entry in ['command search', 'native menu', 'Settings']) {+ testWidgets(+ '$entry opens customization beside the visible terminal and Escape returns typing',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ (_) async => true,+ );+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ final app = createApp();+ addTearDown(app.dispose);+ final input = <TerminalBinaryFrame>[];+ final pane = app.adoptSessionForTest(terminal('a0', input));+ await mount(tester, app, nativeTabs: entry == 'native menu');+ final before = tester.getRect(find.byKey(pane.cellKey));+ if (entry == 'native menu') {+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ const MethodCall('customize'),+ ),+ (_) {},+ );+ } else if (entry == 'Settings') {+ await chord(tester, LogicalKeyboardKey.comma);+ await tester.pumpAndSettle();+ expect(find.byType(SettingsScreen), findsOneWidget);+ await tester.tap(find.text('Customize'));+ } else {+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);+ await tester.enterText(+ find.byKey(const ValueKey('swarm-search-input')),+ '> customize',+ );+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ }+ await tester.pumpAndSettle();+ expect(find.byType(SettingsScreen), findsNothing);+ expect(find.byType(HarnessCustomizePane), findsOneWidget);+ expect(find.byType(PromptContextView), findsWidgets);+ expect(tester.getRect(find.byKey(pane.cellKey)), before);+ final panel = tester.getRect(find.byType(HarnessCustomizePane));+ expect(panel.right, 1280);+ expect(panel.width, 440);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(find.byType(SettingsScreen), findsNothing);+ expect(find.byType(HarnessCustomizePane), findsNothing);+ expect(tester.getRect(find.byKey(pane.cellKey)), before);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);+ await tester.pump();+ expect(input.single.bytes, [27, 91, 68]);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ },+ );+ }+testWidgets(- 'command search opens customization and Escape returns typing to the terminal',+ 'customization updates both live terminal renderers without closing the panel',(tester) async {- final app = createApp();+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1280, 800);+ addTearDown(tester.view.resetDevicePixelRatio);+ addTearDown(tester.view.resetPhysicalSize);+ final appearance = appearancePrefsStore.value;+ final font = terminalFontStore.value;+ final scheme = terminalThemeStore.value;+ final palette = grid.AppTheme.palette.value;+ addTearDown(() {+ appearancePrefsStore.value = appearance;+ terminalFontStore.value = font;+ terminalThemeStore.value = scheme;+ grid.AppTheme.palette.value = palette;+ });+ appearancePrefsStore.value = const AppearancePrefs();+ terminalThemeStore.value = TerminalThemeChoice.matchApp;+ final app = createApp()..status = AppStatus.authenticated;addTearDown(app.dispose);final input = <TerminalBinaryFrame>[];- final pane = app.adoptSessionForTest(terminal('a0', input));- await mount(tester, app);- final before = tester.getRect(find.byKey(pane.cellKey));+ final sessions = [terminal('a0', input), terminal('a1', input)];+ for (final session in sessions) {+ session.terminal.write('Keep this output');+ }+ final panes = [+ for (final session in sessions) app.adoptSessionForTest(session),+ ];+ final boundary = GlobalKey();+ await tester.pumpWidget(+ RepaintBoundary(+ key: boundary,+ child: ProviderScope(+ overrides: [appStateProvider.overrideWithValue(app)],+ child: HarnessApp(+ authenticatedScreen: (app) => SwarmScreen(notifier: app),+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ final views = [+ for (final session in sessions)+ find.byWidgetPredicate(+ (widget) =>+ widget is TerminalView &&+ identical(widget.terminal, session.terminal),+ ),+ ];+ final states = [+ for (final view in views) tester.state<TerminalViewState>(view),+ ];+ final columns = [for (final session in sessions) session.cols];+ final lineHeights = [+ for (final state in states) state.renderTerminal.lineHeight,+ ];await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(find.byKey(const ValueKey('swarm-search-input')),@@ -176,15 +297,57 @@ void main() {await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pumpAndSettle();+ // Publish the same preference notifications as the controls without+ // persisting this test's choices into the developer's saved preferences.+ appearancePrefsStore.value = appearancePrefsStore.value.copyWith(+ prompt: const PromptPrefs(style: PromptStyle.powerline),+ );+ await tester.pumpAndSettle();+ for (final pane in panes) {+ final header = find.descendant(+ of: find.byKey(pane.cellKey),+ matching: find.byType(PromptContextView),+ );+ expect(+ find.descendant(of: header, matching: find.byType(ClipPath)),+ findsWidgets,+ );+ }+ await _capture(tester, boundary, 'live-panes-customization');+ await tester.tap(find.byKey(const ValueKey('customize-appearance')));+ await tester.pumpAndSettle();+ appearancePrefsStore.value = appearancePrefsStore.value.copyWith(+ palette: HarnessPalette.midnight,+ );+ await tester.pumpAndSettle();+ for (final state in states) {+ expect(+ state.widget.theme.background,+ HarnessPalette.midnight.background,+ );+ }expect(find.byType(HarnessCustomizePane), findsOneWidget);- expect(find.byType(PromptContextView), findsWidgets);- expect(tester.getRect(find.byKey(pane.cellKey)), before);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.tap(find.byKey(const ValueKey('customize-terminal')));await tester.pumpAndSettle();- expect(find.byType(HarnessCustomizePane), findsNothing);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);- await tester.pump();- expect(input.single.bytes, [27, 91, 68]);+ terminalThemeStore.value = TerminalThemeChoice.tango;+ terminalFontStore.value = font.copyWith(fontSize: font.fontSize + 2);+ await tester.pumpAndSettle();+ for (var i = 0; i < sessions.length; i++) {+ expect(tester.state(views[i]), same(states[i]));+ expect(states[i].widget.theme, same(tangoTerminalTheme));+ expect(states[i].widget.textStyle.fontSize, font.fontSize + 2);+ expect(+ states[i].renderTerminal.lineHeight,+ greaterThan(lineHeights[i]),+ );+ expect(sessions[i].cols, lessThan(columns[i]));+ expect(+ sessions[i].terminal.buffer.getText(),+ contains('Keep this output'),+ );+ }+ expect(find.byType(HarnessCustomizePane), findsOneWidget);+ expect(input, isEmpty);expect(tester.takeException(), isNull);await tester.pumpWidget(const SizedBox());},@@ -221,51 +384,6 @@ void main() {},);- testWidgets(- 'background choices support keyboard selection and survive reopening',- (tester) async {- final storage = _Storage();- final store = AppearancePrefsStore(storage: storage);- addTearDown(store.dispose);- await tester.pumpWidget(- MaterialApp(- theme: grid.buildAppTheme(brightness: Brightness.dark),- home: Scaffold(- body: SizedBox(- width: 420,- child: HarnessCustomizePane(store: store, onClose: () {}),- ),- ),- ),- );- await tester.pumpAndSettle();- await tester.tap(find.byKey(const ValueKey('customize-background')));- await tester.pumpAndSettle();- final choice = find.byKey(const ValueKey('background-lake'));- await tester.ensureVisible(choice);- await tester.tap(choice);- await tester.pumpAndSettle();- expect(store.value.background, HarnessBackground.lake);- final silk = find.descendant(- of: find.byKey(const ValueKey('background-silk')),- matching: find.text('Silk'),- );- for (var i = 0; i < 10 && !Focus.of(tester.element(silk)).hasFocus; i++) {- await tester.sendKeyEvent(LogicalKeyboardKey.tab);- await tester.pump();- }- expect(Focus.of(tester.element(silk)).hasFocus, isTrue);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pumpAndSettle();- expect(store.value.background, HarnessBackground.silk);- final reopened = AppearancePrefsStore(storage: storage);- addTearDown(reopened.dispose);- await reopened.load();- expect(reopened.value.background, HarnessBackground.silk);- expect(tester.takeException(), isNull);- },- );-for (final (width, height, scale) in [(1280.0, 800.0, 1.0),(880.0, 560.0, 1.0),@@ -336,10 +454,6 @@ void main() {'${width.toInt()}-prompt-${style.name}',);}- await tester.tap(find.byKey(const ValueKey('customize-background')));- await tester.pumpAndSettle();- await _capture(tester, boundary, '${width.toInt()}-background');-await tester.tap(find.byKey(const ValueKey('customize-appearance')));await tester.pumpAndSettle();expect(find.text('Color palette'), findsOneWidget);diff --git a/desktop/test/settings_review_render_test.dart b/desktop/test/settings_review_render_test.dartindex 865315631..694b35a85 100644--- a/desktop/test/settings_review_render_test.dart+++ b/desktop/test/settings_review_render_test.dart@@ -18,6 +18,7 @@ import 'package:harness/settings/settings_nav.dart';import 'package:harness/settings/settings_screen.dart';import 'package:harness/settings/settings_section.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/shared/widgets/section_scaffold.dart';import 'package:harness/state/app_state.dart';import 'package:harness/update/desktop_updater.dart';import 'package:harness/update/manual_update_check.dart';@@ -69,9 +70,10 @@ void main() {for (final brightness in Brightness.values) {for (final scale in [1.0, 1.8]) {- for (final section in settingsGroupsFor(- debugSurface: false,- ).expand((group) => group.sections)) {+ for (final section+ in settingsGroupsFor(debugSurface: false)+ .expand((group) => group.sections)+ .where((section) => section != SettingsSection.customize)) {testWidgets('${section.name} at minimum window, ${brightness.name}, $scale text',(tester) async {@@ -146,6 +148,20 @@ void main() {tester.widget<SettingsNav>(find.byType(SettingsNav)).section,section,);+ await tester.enterText(search, '');+ await tester.pumpAndSettle();+ final scaffold = find.byType(SectionScaffold);+ final heading = find.descendant(+ of: scaffold,+ matching: find.text(+ tester.widget<SectionScaffold>(scaffold).title,+ ),+ );+ expect(+ tester.getCenter(find.text('Back to app')).dy,+ closeTo(tester.getCenter(heading).dy, 1),+ reason: 'Back and the section title share a header at every text size.',+ );if (section == SettingsSection.about) {await tester.runAsync(() async {await precacheImage(diff --git a/desktop/test/settings_screen_test.dart b/desktop/test/settings_screen_test.dartindex 616240d4a..9d243040e 100644--- a/desktop/test/settings_screen_test.dart+++ b/desktop/test/settings_screen_test.dart@@ -23,6 +23,7 @@ import 'package:harness/shared/widgets/app_select_field.dart';import 'package:harness/shared/theme/app_theme.dart';import 'package:harness/shortcuts/keymap.dart';import 'package:harness/state/app_state.dart';+import 'package:harness/widgets/harness_customize_pane.dart';void main() {TestWidgetsFlutterBinding.ensureInitialized();@@ -71,25 +72,45 @@ void main() {return notifier;}- testWidgets(- 'Settings lists its remaining sections after customization moves',- (tester) async {- await openSettings(tester);- expect(find.text('Preferences'), findsOneWidget);- expect(find.text('Help'), findsOneWidget);- expect(find.text('Usage'), findsNWidgets(2));- expect(find.text('Keyboard shortcuts'), findsOneWidget);- expect(find.text('About'), findsOneWidget);- expect(find.text('Back to app'), findsOneWidget);- expect(find.text('Appearance'), findsNothing);- expect(find.text('Terminal'), findsNothing);- expect(find.byKey(const Key('appearance-ui-size-field')), findsNothing);- expect(- find.byKey(const Key('terminal-font-family-dropdown')),- findsNothing,- );- },- );+ testWidgets('Settings lists customization under Preferences', (tester) async {+ await openSettings(tester);+ expect(find.text('Preferences'), findsOneWidget);+ expect(find.text('Help'), findsOneWidget);+ expect(find.text('Usage'), findsNWidgets(2));+ expect(find.text('Customize'), findsOneWidget);+ expect(find.text('Keyboard shortcuts'), findsOneWidget);+ expect(find.text('About'), findsOneWidget);+ expect(find.text('Back to app'), findsOneWidget);+ expect(find.text('Appearance'), findsNothing);+ expect(find.text('Terminal'), findsNothing);+ expect(find.byKey(const Key('appearance-ui-size-field')), findsNothing);+ expect(+ find.byKey(const Key('terminal-font-family-dropdown')),+ findsNothing,+ );+ await tester.tap(find.text('Customize'));+ await tester.pumpAndSettle();+ expect(find.byType(SettingsScreen), findsNothing);+ expect(find.byType(Placeholder), findsOneWidget);+ expect(find.byType(HarnessCustomizePane), findsOneWidget);+ for (final label in ['Pane', 'Appearance', 'Terminal']) {+ expect(find.text(label), findsOneWidget);+ }+ await tester.tap(find.byKey(const ValueKey('customize-appearance')));+ await tester.pumpAndSettle();+ expect(find.byKey(const Key('appearance-ui-size-field')), findsOneWidget);+ await tester.tap(find.byKey(const ValueKey('customize-terminal')));+ await tester.pumpAndSettle();+ expect(+ find.byKey(const Key('terminal-font-family-dropdown')),+ findsOneWidget,+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(find.byType(SettingsScreen), findsNothing);+ expect(find.byType(HarnessCustomizePane), findsNothing);+ expect(tester.takeException(), isNull);+ });testWidgets('About prints the running version', (tester) async {await openSettings(tester);diff --git a/desktop/test/settings_section_test.dart b/desktop/test/settings_section_test.dartindex 21c2c2c21..7eedc0af6 100644--- a/desktop/test/settings_section_test.dart+++ b/desktop/test/settings_section_test.dart@@ -32,6 +32,7 @@ void main() {// files, and it reads nothing at all until a provider is switched on, so// there is nothing here for a shipped build to hide.SettingsSection.usage,+ SettingsSection.customize,SettingsSection.devices,SettingsSection.account,SettingsSection.shortcuts,