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.

Use one terminal font across Harness and simplify new tabs (#194)

Deee86bad87c066
diff --git a/desktop/design/new-harness-entry-rules.md b/desktop/design/new-harness-entry-rules.md
index 57fb94007..f898ec9a0 100644
--- a/desktop/design/new-harness-entry-rules.md
+++ b/desktop/design/new-harness-entry-rules.md
@@ -1,34 +1,34 @@
# New Harness entry rules
-All workspace entry points use the command dock. Start Harness submits the
-reviewed draft. Opening or cancelling it never starts a harness. Cmd-T allocates
-a temporary tab that is removed on cancellation if it remains untouched.
+Startup and Cmd-T show the same quiet welcome page. Cmd-T creates a blank tab;
+Escape leaves that tab open. The command dock opens only after an explicit
+Cmd-N, Cmd-O, or Cmd-P action. Start Harness submits the reviewed draft;
+opening or cancelling the dock never starts a harness.
The launch form starts with Agent, Machine, and Project, followed by Start
Harness, which is selected initially. There is no heading, Task row, or Open In
-row. Cmd-T and Cmd-P pickers also omit their heading and result-count row.
+row. Cmd-O and Cmd-P pickers also omit their heading and result-count row.
Tasks carried from search or Store examples remain part of the draft.
| Entry | Initial values | Destination after a successful start |
| --- | --- | --- |
-| Cmd-T → New Harness | Focused pane's agent, machine, and project | New tab |
-| Cmd-P → New Harness | Same defaults as Cmd-T | Current tab |
+| Cmd-T, then Cmd-N | Previous pane's agent, machine, and project | The blank tab opened by Cmd-T |
+| Cmd-O or Cmd-P → New Harness | Focused pane's agent, machine, and project | Current tab |
| Cmd-N or the New Harness command | Focused pane's defaults; retain a task and destination already chosen in search | Current tab unless its source requests a new tab |
| Explicit pane split | Focused pane's defaults | Requested split in that tab |
| Store New Harness, or a product's Open action in the pane or native Models menu | Explicit product and machine; suggested project named for that product | New tab |
| Store Resume Harness | Existing harness and its machine; choose from a menu when several match | Focus its existing tab or reopen a view of the same harness |
| Store Try this prompt | Same as Open, with the example as the editable task | New tab |
-| First empty workspace | Installed/preferred agent, local machine, suggested project | New tab |
+| First empty workspace | No automatic action; show the welcome page | User chooses with Cmd-N, Cmd-O, or Cmd-S |
The Store and orchestration tabs cannot host a terminal pane. Generic creation
from either uses a new tab. Command-bar requests keep the workspace context and
apply any agent or machine explicitly named by the request.
-While the harness picker is open, Cmd-T and Cmd-P change only the destination.
-They preserve the query, text selection, highlighted result, and project or
-machine filter. Repeating either shortcut refocuses the same input. The Enter
-action and available capacity update together. Cancelling still leaves
-the workspace unchanged.
+Cmd-O and Cmd-P open the same picker. Repeating either shortcut preserves the
+query, selection, highlighted result, and filters, then refocuses the input.
+Cmd-T closes the dock and opens a quiet blank tab. Creation remains blocked
+while a pending start needs confirmation.
## Git projects
@@ -52,8 +52,8 @@ its receipt, and retrying a confirmed launch failure reuses its prepared folder.
- Workspace drafts belong to their original machine, focused source harness,
and project context. A different focused harness does not inherit their edits.
-- Cmd-T and Cmd-P can resume the same workspace draft. The shortcut just used
- controls placement; a saved draft cannot redirect it to an old destination.
+- Cmd-O and Cmd-P can resume the same workspace draft. The current tab controls
+ placement; a saved draft cannot redirect it to an old destination.
- Store drafts belong to the explicitly requested product and machine. Opening
Blender cannot restore Workshop's agent, task, or generated project name.
- Escape preserves edits. Reopening the same source without a new task resumes
@@ -88,7 +88,7 @@ never silently renamed, and existing files are never overwritten.
- `test/new_harness_entry_rules_test.dart`: product changes with an open or
dismissed dock, Open/Try, edited names, machine changes, explicit agent
precedence, search isolation, exact launch payloads, pending receipts, source
- pane changes, and Cmd-T/Cmd-P draft recovery and placement. Repeated/switched
+ pane changes, and Cmd-O/Cmd-P draft recovery and placement. Repeated/switched
shortcuts retain typed tasks, text selection, existing results, and project
scope; starting then uses the displayed destination.
- `test/harness_placement_test.dart`, `test/box_flows_test.dart`,
diff --git a/desktop/integration_test/native_workspace_e2e_test.dart b/desktop/integration_test/native_workspace_e2e_test.dart
index c8ae58e0e..21d0aaf2a 100644
--- a/desktop/integration_test/native_workspace_e2e_test.dart
+++ b/desktop/integration_test/native_workspace_e2e_test.dart
@@ -42,9 +42,8 @@ import 'package:harness/state/new_harness.dart';
import 'package:harness/state/pane_preset.dart';
import 'package:harness/state/swarm_catalog.dart';
import 'package:harness/state/workspace_learning.dart';
-import 'package:harness/state/first_harness_launch.dart';
import 'package:harness/store/store_screen.dart';
-import 'package:harness/widgets/workspace_start_guide.dart';
+import 'package:harness/widgets/workspace_welcome.dart';
import 'package:harness/shortcuts/keyboard_practice.dart';
import 'package:harness/shortcuts/keymap.dart';
import 'package:harness/terminal/terminal_binary.dart';
@@ -887,7 +886,7 @@ void main() {
);
testWidgets(
- 'native first workspace opens a ready draft and keeps creation explicit',
+ 'native first workspace stays quiet until New Harness is requested',
(tester) async {
final connection = _CreationConnection();
final app = _FirstCreationApp(connection);
@@ -903,12 +902,15 @@ void main() {
notifier: app,
nativeTabs: true,
projectStore: projects,
- firstLaunch: FirstHarnessLaunch(),
),
),
);
await tester.pump(const Duration(milliseconds: 200));
await tester.pump(const Duration(milliseconds: 200));
+ expect(find.byType(NewHarnessBox), findsNothing);
+ expect(find.byType(WorkspaceWelcome), findsOneWidget);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ await tester.pump(const Duration(milliseconds: 200));
final box = tester
.widget<NewHarnessBox>(find.byType(NewHarnessBox))
.controller;
@@ -916,7 +918,7 @@ void main() {
expect(box.projectLabel, startsWith('~/harnesses/codex-'));
final proposedFolder = box.projectFolderRequest!.folderName;
expect(connection.creates, isEmpty);
- expect(find.byType(WorkspaceStartGuide).hitTestable(), findsOneWidget);
+ expect(find.byType(WorkspaceWelcome).hitTestable(), findsOneWidget);
await key(tester, LogicalKeyboardKey.enter);
await tester.pump(const Duration(milliseconds: 200));
expect(connection.creates, hasLength(1));
@@ -1052,6 +1054,8 @@ void main() {
);
await started.future;
await tester.pump();
+ await tester.tap(find.text('Try the keyboard tour'));
+ await tester.pump(const Duration(milliseconds: 200));
expect(learning.next, WorkspaceLesson.zoom);
await key(tester, LogicalKeyboardKey.enter, cmd: true);
expect(learning.next, WorkspaceLesson.commands);
@@ -1231,6 +1235,8 @@ void main() {
}
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ expect(find.byType(WorkspaceWelcome), findsOneWidget);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.enterText(search, 'login claude M2');
await tester.pump();
await key(tester, LogicalKeyboardKey.enter);
@@ -1314,20 +1320,19 @@ void main() {
),
);
await tester.pump(const Duration(milliseconds: 200));
- await key(
- tester,
- shortcut == LogicalKeyboardKey.keyT
- ? LogicalKeyboardKey.keyP
- : LogicalKeyboardKey.keyT,
- cmd: true,
- );
+ if (shortcut == LogicalKeyboardKey.keyT) {
+ await key(tester, shortcut, cmd: true);
+ expect(find.byType(WorkspaceWelcome), findsOneWidget);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ }
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
final search = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(search, 'Check retargeted keyboard input');
- await key(tester, shortcut, cmd: true);
- await key(tester, shortcut, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyP, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
final destination = app.activeSwarm;
expect(find.text('Check retargeted keyboard input'), findsWidgets);
- expect(find.text(label), findsNothing);
+ expect(find.text('New Pane'), findsNothing);
await key(tester, LogicalKeyboardKey.enter);
expect(find.byType(NewHarnessBox), findsOneWidget);
expect(
@@ -1342,7 +1347,12 @@ void main() {
await tester.pump();
expect(find.byType(NewHarnessBox), findsNothing);
expect(app.activeSwarm, same(destination));
- expect(app.activeSwarm, isNot(same(source)));
+ expect(
+ app.activeSwarm,
+ shortcut == LogicalKeyboardKey.keyT
+ ? isNot(same(source))
+ : same(source),
+ );
final session = app.focusedPane!.session!;
final view = tester.widget<TerminalView>(
find.byWidgetPredicate(
@@ -1514,7 +1524,7 @@ void main() {
final line = find.byKey(const ValueKey('new-harness-input'));
NewHarnessController prompt() =>
tester.widget<NewHarnessBox>(find.byType(NewHarnessBox)).controller;
- await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await key(tester, LogicalKeyboardKey.enter);
await tester.pump(const Duration(milliseconds: 80));
expect(prompt().engine, 'codex');
@@ -1626,6 +1636,7 @@ void main() {
// The just-created agent is immediately searchable and names a new tab.
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Refine terminal workspace',
diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dart
index 60107de7a..b0241ca34 100644
--- a/desktop/lib/app_shell.dart
+++ b/desktop/lib/app_shell.dart
@@ -81,40 +81,17 @@ class HarnessApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
- // Rebuilds MaterialApp on a font/size change, which is what re-resolves
- // every Grid token with it.
- //
- // `buildAppTheme` bakes `AppControl.*Scaled` into plain numbers at the
- // moment it runs, so a UI size that changed without rebuilding this would
- // repaint nothing at all.
- return ValueListenableBuilder<AppearancePrefs>(
- valueListenable: appearancePrefsStore,
- builder: (context, prefs, _) => _app(prefs),
+ return ListenableBuilder(
+ listenable: Listenable.merge([appearancePrefsStore, terminalFontStore]),
+ builder: (context, _) => _app(appearancePrefsStore.value),
);
}
Widget _app(AppearancePrefs prefs) {
grid.AppTheme.palette.value = prefs.palette;
- // ⚠️ ORDER MATTERS, and it is why this is a statement rather than something
- // tucked into the tree below: `buildAppTheme` reads `AppFont.sans` and
- // `AppControl.*Scaled`, so the settings have to be on `AppFont` BEFORE the
- // theme is built, in this same frame.
- //
- // Pushed through the notifier rather than calling `AppFont.apply` directly,
- // so widgets past a `const` boundary — which a top-down rebuild never
- // reaches — are marked dirty too.
- //
- // `codeSize` is passed through unchanged: code type is not on this screen
- // yet, and `apply` takes the whole set, so reading the current value back is
- // how "leave it alone" is spelled.
- final scale = prefs.uiSize / grid.AppFont.uiSizeDefault;
- grid.AppTheme.fonts.apply(
- uiFamily: prefs.uiFamily,
- uiScale: scale,
- codeSize: grid.AppFont.codeSize,
- );
return MaterialApp(
title: 'Harness',
+ themeAnimationDuration: Duration.zero,
// Flutter's DEBUG ribbon stays on a debug build: it is how a locally built
// app is told apart from the installed release at a glance (owner,
// 2026-09-16). It never appears in a release build whatever this says.
@@ -129,29 +106,9 @@ class HarnessApp extends StatelessWidget {
// Harness Desktop is dark-only: one theme, no `darkTheme`/`themeMode` to
// resolve between.
theme: grid.buildAppTheme(brightness: Brightness.dark),
- // The UI size reaches every `Text` as a text SCALE rather than as hundreds
- // of edited call sites. `withClampedTextScaling` with both bounds equal IS
- // the way to force a factor — MediaQuery has no "set the scale"
- // constructor that still inherits the platform's other metrics.
- //
- // ⚠️ It is a matched pair with the `AppControl.*Scaled` reads above, not a
- // separate nicety: those grow the BOXES and this grows the TYPE, and
- // `AppControl.fontSize` deliberately has no scaled twin so that the factor
- // is applied exactly once. Ship one without the other and a 19px setting
- // gives 19px-tall buttons wrapped around 13pt labels.
- //
- // ⚠️ The terminal is fenced out of this at five seams — see
- // `terminal_panel.dart`, `terminal_composer.dart`, `engine_identity.dart`
- // and `terminal_section.dart`, and the regression test in
- // `test/terminal_ui_scale_isolation_test.dart`. The terminal keeps its own
- // font settings because its type is a grid a remote program draws into.
- //
- // Outermost inside `builder`, with `_GridTokenScope` inside it: the clamp
- // has to be an ancestor of everything that lays out text, while the scope
- // only reads `Theme.of`, which comes from above the builder either way.
- builder: (context, child) => MediaQuery.withClampedTextScaling(
- minScaleFactor: scale,
- maxScaleFactor: scale,
+ // The chosen point size is already applied to every style and terminal
+ // cell. A second UI scale would make the chrome disagree with the grid.
+ builder: (context, child) => MediaQuery.withNoTextScaling(
child: _GridTokenScope(
child: keymap == null
? child ?? const SizedBox.shrink()
diff --git a/desktop/lib/core/desktop_window.dart b/desktop/lib/core/desktop_window.dart
index b2333e5bb..359ba783e 100644
--- a/desktop/lib/core/desktop_window.dart
+++ b/desktop/lib/core/desktop_window.dart
@@ -4,6 +4,7 @@ import 'package:window_manager/window_manager.dart';
import 'package:flutter/services.dart';
import '../shared/theme/color_palette.dart';
+import '../terminal/terminal_font_store.dart';
import 'build_identity.dart';
/// Whether this build runs inside a window the app is allowed to manage.
@@ -37,8 +38,12 @@ Future<void> configureDesktopWindow({
// return before native setup finishes and detach any error from this future.
await windowManager.waitUntilReadyToShow(options);
if (Platform.isMacOS) {
- await const MethodChannel('harness/swarm_tabs')
- .invokeMethod('configure', {'palette': palette.nativeColors});
+ await const MethodChannel('harness/swarm_tabs').invokeMethod('configure', {
+ 'palette': palette.nativeColors,
+ 'fontFamily': terminalFontStore.value.fontFamily,
+ 'fontSize': terminalFontStore.size,
+ 'fontFallbacks': terminalFontStore.value.fontFamilyFallback,
+ });
}
// 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
diff --git a/desktop/lib/orchestrator/orchestrator_launcher.dart b/desktop/lib/orchestrator/orchestrator_launcher.dart
index 27e67de52..04fa5e9fc 100644
--- a/desktop/lib/orchestrator/orchestrator_launcher.dart
+++ b/desktop/lib/orchestrator/orchestrator_launcher.dart
@@ -1,8 +1,11 @@
import 'dart:async';
+import '../shared/widgets/labeled_field.dart';
+
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
@@ -260,11 +263,11 @@ class _OrchestratorLauncherState extends State<OrchestratorLauncher> {
),
if (_advanced) ...[
const SizedBox(height: 18),
+ const FieldLabel('Project folder (optional)'),
TextField(
controller: _folder,
readOnly: _attempt != null,
decoration: const InputDecoration(
- labelText: 'Project folder (optional)',
hintText: 'Absolute path to an existing folder',
),
),
@@ -286,9 +289,8 @@ class _OrchestratorLauncherState extends State<OrchestratorLauncher> {
const SizedBox(height: 18),
Text(
'Runs on this computer with installed harnesses. Each specialist gets its own folder; no automatic installs.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 12,
),
),
if (_error != null)
diff --git a/desktop/lib/orchestrator/orchestrator_workspace.dart b/desktop/lib/orchestrator/orchestrator_workspace.dart
index f2051c433..5c083be8e 100644
--- a/desktop/lib/orchestrator/orchestrator_workspace.dart
+++ b/desktop/lib/orchestrator/orchestrator_workspace.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
@@ -368,11 +369,10 @@ class _OrchestratorWorkspaceState extends State<OrchestratorWorkspace> {
'${task.harness} · ${question != null ? 'needs input' : task.state}${task.attempt > 1 ? ' · attempt ${task.attempt}' : ''}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: task.error == null && question == null
? grid.AppPalette.textSecondary
: grid.AppPalette.warn,
- fontSize: 12,
),
),
],
@@ -475,9 +475,8 @@ class _OrchestratorWorkspaceState extends State<OrchestratorWorkspace> {
: role == 'assistant'
? 'Director'
: 'Project update',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 12,
),
),
const SizedBox(height: 6),
@@ -497,9 +496,8 @@ class _OrchestratorWorkspaceState extends State<OrchestratorWorkspace> {
].contains(message['delivery']))
Text(
'Queued for the agent',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 12,
),
),
],
@@ -516,10 +514,7 @@ class _OrchestratorWorkspaceState extends State<OrchestratorWorkspace> {
alignment: Alignment.centerLeft,
child: Text(
'Director is working…',
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 12,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
),
),
@@ -568,9 +563,8 @@ class _OrchestratorWorkspaceState extends State<OrchestratorWorkspace> {
children: [
Text(
'Shift ↵ for a new line',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11,
),
),
const SizedBox(width: 10),
diff --git a/desktop/lib/screens/home_screen.dart b/desktop/lib/screens/home_screen.dart
index ecdb1aa66..4bb81e7e9 100644
--- a/desktop/lib/screens/home_screen.dart
+++ b/desktop/lib/screens/home_screen.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:ui' show lerpDouble;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/desktop_window.dart';
import '../state/app_state.dart';
@@ -207,6 +208,7 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final notifier = widget.notifier;
return ListenableBuilder(
listenable: notifier,
@@ -698,6 +700,7 @@ class _ResizeHandle extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return MouseRegion(
cursor: SystemMouseCursors.resizeLeftRight,
child: GestureDetector(
@@ -731,6 +734,7 @@ class _ErrorStrip extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
// Pinned to the window's top edge, where the traffic lights float — so
// the text starts past them, and the strip drags the window like the rest
// of that edge.
@@ -748,7 +752,7 @@ class _ErrorStrip extends StatelessWidget {
message,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(color: AppColors.textSoft, fontSize: 10),
+ style: terminalTextStyle(color: AppColors.textSoft),
),
),
// A failure already finished (an agent's launch) has nothing left
diff --git a/desktop/lib/screens/login_screen.dart b/desktop/lib/screens/login_screen.dart
index df925f1ea..6259de6fa 100644
--- a/desktop/lib/screens/login_screen.dart
+++ b/desktop/lib/screens/login_screen.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../state/app_state.dart';
@@ -50,7 +51,8 @@ class LoginScreen extends StatelessWidget {
// Preserve room for the primary action and its explanation at the minimum
// window size with enlarged text. The illustration is supplementary.
final showFleet =
- !compact || MediaQuery.textScalerOf(context).scale(16) <= 20;
+ !compact ||
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) <= 20;
return CallbackShortcuts(
bindings: {
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 13bbe13e1..37a48d0d5 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -29,7 +29,7 @@ import '../state/harness_placement.dart';
import '../state/new_harness.dart';
import '../state/pane_arrangement.dart';
import '../terminal/terminal_viewport.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import '../usage/models_menu_controller.dart';
import '../state/swarm_catalog.dart';
import '../state/swarm_attention.dart';
@@ -72,9 +72,9 @@ import '../widgets/harness_command_bar.dart';
import '../orchestrator/orchestrator_launcher.dart';
import '../orchestrator/orchestrator_workspace.dart';
import '../state/workspace_learning.dart';
-import '../state/first_harness_launch.dart';
import '../widgets/workspace_quick_start.dart';
import '../widgets/workspace_start_guide.dart';
+import '../widgets/workspace_welcome.dart';
import '../shortcuts/keyboard_practice.dart';
class SwarmScreen extends StatefulWidget {
@@ -90,7 +90,6 @@ class SwarmScreen extends StatefulWidget {
),
this.commandResolver,
this.learning,
- this.firstLaunch,
});
final AppNotifier notifier;
final bool? nativeTabs;
@@ -99,7 +98,6 @@ class SwarmScreen extends StatefulWidget {
final bool commandBarEnabled;
final CommandResolver? commandResolver;
final WorkspaceLearning? learning;
- final FirstHarnessLaunch? firstLaunch;
@override
State<SwarmScreen> createState() => _SwarmScreenState();
}
@@ -196,121 +194,15 @@ class _SwarmScreenState extends State<SwarmScreen> {
widget.learning ??
WorkspaceLearning(storage: kUnderTest ? null : HarnessFileStore.shared);
String? _commandCatalogMachine;
- late final _firstLaunch =
- widget.firstLaunch ??
- FirstHarnessLaunch(storage: kUnderTest ? null : HarnessFileStore.shared);
- bool _firstLaunchScheduled = false;
-
- String? _emptyEntryTab;
final _newTabSources = <String, TerminalPane>{};
- bool get _isWelcomeEntry =>
- (app.activeSwarm.isEmptyStarter && !app.activeSwarm.isNewTabPage) ||
- (app.activeSwarm.kind == 'harness' &&
- app.activeSwarm.name == 'Welcome' &&
- app.activeSwarm.panes.isEmpty &&
- app.activeSwarm.presets.isEmpty);
-
bool get _showsStartGuide =>
newHarnessOpensInBox &&
app.panes.isEmpty &&
!app.activeSwarm.isStore &&
!app.activeSwarm.isOrchestrator;
- void _observeFirstLaunch() {
- if (!mounted || !newHarnessOpensInBox || !_firstLaunch.loaded) return;
- if (app.viewer != null || !_isWelcomeEntry) {
- _emptyEntryTab = null;
- _firstLaunch.handle();
- return;
- }
- if (_emptyEntryTab == app.activeSwarmId ||
- _firstLaunchScheduled ||
- app.status != AppStatus.authenticated ||
- app.machinesLoading) {
- return;
- }
- final hasHarnesses = app.machineStates.values.any(
- (machine) => machine.agents.isNotEmpty,
- );
- final local = app.machineStates.values
- .where((machine) => machine.isLocalMachine)
- .firstOrNull;
- if (!hasHarnesses &&
- (local == null ||
- local.nodeOnline != true ||
- local.needsLink ||
- local.agentLoadStatus != AgentLoadStatus.loaded)) {
- return;
- }
- final tab = app.activeSwarmId;
- _firstLaunchScheduled = true;
- WidgetsBinding.instance.addPostFrameCallback((_) {
- _firstLaunchScheduled = false;
- if (!mounted || app.activeSwarmId != tab || !_isWelcomeEntry) {
- return;
- }
- // One offer per visit: dismissing or opening another surface keeps it closed.
- _emptyEntryTab = tab;
- if (!_routeIsCurrent ||
- _dialogOpen ||
- _spokenPaletteOpen ||
- _search != null ||
- _newHarness != null ||
- _commandBarOpen) {
- return;
- }
- _firstLaunch.handle();
- if (app.machineStates.values.any(
- (machine) => machine.agents.isNotEmpty,
- )) {
- _openSearch(
- adding: true,
- placement: HarnessPlacement.newTab,
- welcome: true,
- );
- } else {
- unawaited(
- _newAgent(
- machineId: local!.machine.machineId,
- placement: HarnessPlacement.newTab,
- firstRun: true,
- ),
- );
- }
- });
- }
-
- Widget _startGuide() => app.activeSwarm.isNewTabPage
- ? const NewTabStartPage()
- : WorkspaceStartGuide(onShortcuts: _showKeyboardShortcuts);
-
- void _reviewOnboarding() {
- if (_newHarness?.requestDismiss() == false) return;
- _closeNewHarness(restoreFocus: false);
- _closeSearch(restoreFocus: false);
- _closeCommandBar(restoreFocus: false);
- dismissTransientMenus();
- // Reuse the welcome workspace and offer its dock again, preserving work
- // in every other tab. The first-entry path chooses create or search.
- final welcome = app.swarms
- .where(
- (tab) =>
- tab.kind == 'harness' &&
- tab.name == 'Welcome' &&
- tab.panes.isEmpty &&
- tab.presets.isEmpty,
- )
- .firstOrNull;
- if (welcome == null) {
- app.newSwarm(name: 'Welcome');
- } else {
- app.selectSwarm(welcome.id);
- }
- _preparePaneFocus();
- _emptyEntryTab = null;
- _observeFirstLaunch();
- }
+ Widget _startGuide() => WorkspaceWelcome(onCommand: _runShortcut);
void _showKeyboardShortcuts() {
if (_newHarness?.requestDismiss() == false) return;
@@ -327,8 +219,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
_recordNavigation();
app.addListener(_recordNavigation);
app.addListener(_observeLearning);
- app.addListener(_observeFirstLaunch);
- unawaited(_firstLaunch.load().then((_) => _observeFirstLaunch()));
unawaited(
_learning.load().then((_) {
if (mounted) _observeLearning();
@@ -388,7 +278,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
terminalFontStore.removeListener(_fontChanged);
app.removeListener(_recordNavigation);
app.removeListener(_observeLearning);
- app.removeListener(_observeFirstLaunch);
if (widget.learning == null) _learning.dispose();
FocusManager.instance.removeListener(_restoreEmptyFocus);
FocusManager.instance.removeListener(_syncKeyContext);
@@ -488,7 +377,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
if (!_canExecuteCommand(id)) return;
- if (id != 'navigation.commands' && id != 'swarm.new' && id != 'agent.add') {
+ if (id != 'navigation.commands' &&
+ id != 'swarm.new' &&
+ id != 'agent.add' &&
+ id != 'agent.open') {
_closeSearch();
}
_commands[id]?.call();
@@ -533,11 +425,54 @@ class _SwarmScreenState extends State<SwarmScreen> {
zoomed: app.zoomedPaneId != null,
);
- void _startQuickStart() {
- _learning.start();
- _observeLearning();
- if (app.focusedPane?.session?.focusInput() != true) {
- _startSearchFocus.requestFocus();
+ Future<void> _startQuickStart() async {
+ if (_newHarness?.requestDismiss() == false) return;
+ _closeNewHarness(restoreFocus: false);
+ String? next;
+ await _dialog(() async {
+ next = await showDialog<String>(
+ context: context,
+ builder: (context) => Dialog(
+ backgroundColor: grid.AppPalette.swarmWelcome,
+ insetPadding: const EdgeInsets.all(24),
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 1200, maxHeight: 800),
+ child: Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(20, 8, 8, 0),
+ child: Row(
+ children: [
+ Text('Quick Start', style: boxMonoStyle()),
+ const Spacer(),
+ TextButton(
+ onPressed: () => Navigator.pop(context, 'tour'),
+ child: const Text('Try the keyboard tour'),
+ ),
+ IconButton(
+ tooltip: 'Close',
+ onPressed: () => Navigator.pop(context),
+ icon: const Icon(Icons.close, size: 18),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: WorkspaceStartGuide(
+ onShortcuts: () => Navigator.pop(context, 'shortcuts'),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ });
+ if (!mounted) return;
+ if (next == 'shortcuts') _showKeyboardShortcuts();
+ if (next == 'tour') {
+ _learning.start();
+ _observeLearning();
}
}
@@ -614,6 +549,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
'activeId': app.activeSwarmId,
'palette': grid.AppTheme.palette.value.nativeColors,
'fontFamily': terminalFontStore.value.fontFamily,
+ 'fontSize': terminalFontStore.size,
'fontFallbacks': terminalFontStore.value.fontFamilyFallback,
'canReopen': app.canReopenLastClosed,
'canFind': _canFindTerminal,
@@ -1308,10 +1244,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
String? projectName,
String? task,
HarnessPlacement? placement,
- bool firstRun = false,
_NewHarnessSource source = _NewHarnessSource.workspace,
}) async {
- _firstLaunch.handle();
final search = source == _NewHarnessSource.workspace ? _search : null;
// A pane never lands in the store tab: New Harness from there goes to
// the empty starter tab (or a fresh one), the way New Tab does.
@@ -1396,7 +1330,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
swarmId: target,
split: requestedSplit,
placement: placement,
- firstRun: firstRun,
);
}
@@ -1472,7 +1405,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
required String swarmId,
PaneSplitRequest? split,
HarnessPlacement? placement,
- bool firstRun = false,
}) {
// A dialog's pop future can complete before didChangeDependencies refreshes
// the cached route flag. Its live route already owns the next prompt.
@@ -1551,7 +1483,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
swarmId: swarmId,
split: split,
placement: placement,
- firstRun: firstRun,
);
final content = NewHarnessBox(
docked: true,
@@ -1589,7 +1520,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
);
},
);
- final onWelcome = firstRun || _showsStartGuide;
+ final onWelcome = _showsStartGuide;
_newHarnessOverlay = OverlayEntry(
builder: (context) => KeymapProvider(
keymap: _keymap,
@@ -1940,7 +1871,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
void _openStore() {
- _firstLaunch.handle();
if (!_routeIsCurrent || _dialogOpen || _spokenPaletteOpen) return;
if (_newHarness case final box?) {
if (box.locked) {
@@ -1961,10 +1891,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
bool adding = false,
PaneSplitRequest? split,
String query = '',
- bool welcome = false,
HarnessPlacement? placement,
}) {
- _firstLaunch.handle();
if (_search != null ||
!mounted ||
_dialogOpen ||
@@ -1988,7 +1916,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
// Search is an overlay, so late pane attachment needs an explicit focus
// boundary to keep its programmatic focus request out of the picker.
_canvasFocus.descendantsAreFocusable = false;
- _searchOnWelcome = welcome || _showsStartGuide;
+ _searchOnWelcome = _showsStartGuide;
_search = SwarmSearchController(
app,
_navigation.recent,
@@ -2116,7 +2044,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
_closeSearch(restoreFocus: choice.destination.isCommand);
- // Cmd-T allocated its visible destination before the picker opened. Pin
+ // A blank tab already supplies the destination. Pin
// selection to that tab, including while an exact resume is still pending.
final targetTab = app.swarms.where((tab) => tab.id == target).firstOrNull;
await _activateSearch(
@@ -2155,10 +2083,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
padding: const EdgeInsets.fromLTRB(14, 9, 14, 2),
child: Row(
children: [
- Text(
- search.title,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
+ Text(search.title, style: boxMonoStyle(color: kBoxFaint)),
if (search.placement == HarnessPlacement.currentTab ||
search.split != null)
Expanded(
@@ -2169,7 +2094,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
key: const ValueKey('swarm-search-target'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
)
@@ -2207,7 +2132,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
onChanged: search.setQuery,
onOpen: _focusSearch,
height: 38,
- fontSize: 13,
+
terminal: true,
hintText: search.hint,
),
@@ -2269,7 +2194,11 @@ class _SwarmScreenState extends State<SwarmScreen> {
Expanded(child: _startGuide()),
ConstrainedBox(
constraints: BoxConstraints(
- maxHeight: constraints.maxHeight * .65,
+ maxHeight:
+ (constraints.maxHeight -
+ (_native ? 0 : _tabBarHeight)) *
+ (.65 * terminalFontStore.size / terminalFontSize)
+ .clamp(.65, 1.0),
),
child: contents,
),
@@ -2295,10 +2224,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
CommandDock(
expanded: true,
- topClearance: (_native ? 0.0 : _tabBarHeight).clamp(
- constraints.maxHeight * .35,
- double.infinity,
- ),
+ topClearance: _native ? 0.0 : _tabBarHeight,
child: contents,
),
],
@@ -2326,56 +2252,41 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
Future<void> _addAgent() async {
- _openPlacementPicker(HarnessPlacement.currentTab);
+ if ((app.activeSwarm.isStore || app.activeSwarm.isOrchestrator) &&
+ !_newTab()) {
+ return;
+ }
+ if (_search?.changePlacement(HarnessPlacement.currentTab) == true) {
+ _focusSearch();
+ return;
+ }
+ _closeSearch(restoreFocus: false);
+ _openSearch(adding: true, placement: HarnessPlacement.currentTab);
}
- void _newTab() {
+ bool _newTab() {
if (!mounted || _dialogOpen || _spokenPaletteOpen || !_routeIsCurrent) {
- return;
+ return false;
}
if (_newHarness case final box?) {
if (box.busy || box.checking) {
- box.warn('Check the pending creation before opening another picker.');
- return;
+ box.warn('Check the pending creation before opening another tab.');
+ return false;
}
- if (!box.requestDismiss()) return;
+ if (!box.requestDismiss()) return false;
}
final source = app.focusedPane ?? _newTabSources[app.activeSwarmId];
- final draft = _search?.adding == true && _search?.isCommandMode == false
- ? _search?.draft
- : null;
- final editing = _searchText.value;
_closeNewHarness(restoreFocus: false);
_closeSearch(restoreFocus: false);
_closeCommandBar(restoreFocus: false);
dismissTransientMenus();
_preparePaneFocus();
- app.newSwarm(newTabPage: true, draft: true);
+ app.newSwarm(newTabPage: true);
_newTabSources.removeWhere(
(id, _) => !app.swarms.any((tab) => tab.id == id),
);
if (source != null) _newTabSources[app.activeSwarmId] = source;
- _openSearch(adding: true, placement: HarnessPlacement.newTab);
- if (draft != null) {
- _search?.restoreDraft(draft, newTab: true);
- _searchText.value = editing;
- }
- }
-
- void _openPlacementPicker(HarnessPlacement requested) {
- if (requested == HarnessPlacement.newTab ||
- app.activeSwarm.isStore ||
- app.activeSwarm.isOrchestrator) {
- _newTab();
- return;
- }
- final placement = requested;
- if (_search?.changePlacement(placement) == true) {
- _focusSearch();
- return;
- }
- _closeSearch(restoreFocus: false);
- _openSearch(adding: true, placement: placement);
+ return true;
}
Future<void> _addProject() => _dialog(() async {
@@ -2523,7 +2434,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
'navigation.commands': _showSearchCommands,
'app.customize': () => unawaited(_customize()),
'app.store': _openStore,
- if (kDebugSurfaceEnabled) 'app.onboarding_review': _reviewOnboarding,
+ 'agent.open': _addAgent,
+ if (kDebugSurfaceEnabled) 'app.onboarding_review': _newTab,
'agent.rename': () => _editAgent(),
'agent.stop': () => _editAgent(stop: true),
'agent.fork': _forkAgent,
@@ -2670,11 +2582,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
?mode('keyboard.quick_start', 'Quick start', 'Four steps into real work'),
?mode('keyboard.practice', 'Keyboard practice', 'Try every shortcut'),
?mode('keyboard.open_config', 'Edit keybindings', 'keybindings.jsonc'),
- ?mode(
- 'app.customize',
- 'Customize Harness',
- 'Prompt · colors · fonts',
- ),
+ ?mode('app.customize', 'Customize Harness', 'Prompt · colors · fonts'),
?mode('app.settings', 'Settings', ''),
];
}
@@ -2721,7 +2629,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
];
void _focusCommandBar() {
- _firstLaunch.handle();
if (_commandBarOpen) {
_closeCommandBar();
return;
@@ -2777,13 +2684,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
if (message.isNotEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
- content: Text(
- message,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- ),
- ),
+ content: Text(message, style: terminalTextStyle()),
action: goBack == null
? null
: SnackBarAction(
@@ -2898,10 +2799,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
- const Expanded(
+ Expanded(
child: Text(
'Keyboard config has an error. Using the last working shortcuts.',
- style: TextStyle(fontSize: 12),
+ style: terminalTextStyle(),
),
),
TextButton(
@@ -2923,8 +2824,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
alignment: Alignment.centerLeft,
child: Text(
'$_pendingKeys … Esc to cancel',
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -2948,7 +2848,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
_projects.error ?? app.lastError!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 12),
+ style: terminalTextStyle(),
),
),
if (_projects.error == null &&
@@ -3145,7 +3045,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
);
static const double _tabBarHeight = 40;
- static const double _tabExtent = 188;
+ double _tabExtent = 188;
void _revealSelectedTab(double viewport) {
final previous = _tabGeometry;
@@ -3220,6 +3120,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
Expanded(
child: LayoutBuilder(
builder: (context, constraints) {
+ _tabExtent = constraints.maxWidth.clamp(64, 188);
_revealSelectedTab(constraints.maxWidth);
return ReorderableListView.builder(
scrollController: _tabScroll,
@@ -3356,7 +3257,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
grid.AppPalette.swarmField,
),
overlayColor: grid.AppPalette.swarmAccent,
- textStyle: boxMonoStyle(size: 12),
+ textStyle: boxMonoStyle(),
minimumSize: const Size(0, 28),
padding: const EdgeInsets.symmetric(horizontal: 12),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -3393,14 +3294,17 @@ class _TabActionsRevealState extends State<_TabActionsReveal> {
bool _hovered = false, _focused = false;
@override
- Widget build(BuildContext context) => MouseRegion(
- onEnter: (_) => setState(() => _hovered = true),
- onExit: (_) => setState(() => _hovered = false),
- child: Focus(
- canRequestFocus: false,
- includeSemantics: false,
- onFocusChange: (value) => setState(() => _focused = value),
- child: widget.builder(_hovered || _focused),
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return MouseRegion(
+ onEnter: (_) => setState(() => _hovered = true),
+ onExit: (_) => setState(() => _hovered = false),
+ child: Focus(
+ canRequestFocus: false,
+ includeSemantics: false,
+ onFocusChange: (value) => setState(() => _focused = value),
+ child: widget.builder(_hovered || _focused),
+ ),
+ );
+ }
}
diff --git a/desktop/lib/settings/appearance/palette_section.dart b/desktop/lib/settings/appearance/palette_section.dart
index 7dcd02650..c651cafb9 100644
--- a/desktop/lib/settings/appearance/palette_section.dart
+++ b/desktop/lib/settings/appearance/palette_section.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../shared/theme/app_theme.dart' as grid;
import '../../shared/theme/appearance_prefs_store.dart';
@@ -67,61 +68,65 @@ class _PaletteChoice extends StatelessWidget {
final VoidCallback onChoose;
@override
- Widget build(BuildContext context) => Semantics(
- button: true,
- selected: selected,
- onTap: onChoose,
- label: '${palette.label} palette',
- child: ExcludeSemantics(
- child: TextButton(
- key: ValueKey('palette-${palette.name}'),
- onPressed: onChoose,
- style: ButtonStyle(
- padding: const WidgetStatePropertyAll(EdgeInsets.all(8)),
- backgroundColor: WidgetStatePropertyAll(palette.panel),
- overlayColor: const WidgetStatePropertyAll(Colors.white10),
- side: WidgetStateProperty.resolveWith(
- (states) => BorderSide(
- color: selected || states.contains(WidgetState.focused)
- ? palette.accent
- : Colors.white12,
- width: selected || states.contains(WidgetState.focused) ? 1.5 : 1,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Semantics(
+ button: true,
+ selected: selected,
+ onTap: onChoose,
+ label: '${palette.label} palette',
+ child: ExcludeSemantics(
+ child: TextButton(
+ key: ValueKey('palette-${palette.name}'),
+ onPressed: onChoose,
+ style: ButtonStyle(
+ padding: const WidgetStatePropertyAll(EdgeInsets.all(8)),
+ backgroundColor: WidgetStatePropertyAll(palette.panel),
+ overlayColor: const WidgetStatePropertyAll(Colors.white10),
+ side: WidgetStateProperty.resolveWith(
+ (states) => BorderSide(
+ color: selected || states.contains(WidgetState.focused)
+ ? palette.accent
+ : Colors.white12,
+ width: selected || states.contains(WidgetState.focused)
+ ? 1.5
+ : 1,
+ ),
+ ),
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
),
- shape: WidgetStatePropertyAll(
- RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _WorkspacePreview(palette: palette),
- const SizedBox(height: 8),
- Row(
- children: [
- Expanded(
- child: Text(
- palette.label,
- style: const TextStyle(
- fontSize: 13,
- color: Colors.white,
- fontWeight: FontWeight.w500,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _WorkspacePreview(palette: palette),
+ const SizedBox(height: 8),
+ Row(
+ children: [
+ Expanded(
+ child: Text(
+ palette.label,
+ style: terminalTextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.w500,
+ ),
),
),
- ),
- SizedBox(
- width: 16,
- child: selected
- ? Icon(Icons.check, size: 16, color: palette.accent)
- : null,
- ),
- ],
- ),
- ],
+ SizedBox(
+ width: 16,
+ child: selected
+ ? Icon(Icons.check, size: 16, color: palette.accent)
+ : null,
+ ),
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
class _WorkspacePreview extends StatelessWidget {
@@ -129,111 +134,114 @@ class _WorkspacePreview extends StatelessWidget {
final HarnessPalette palette;
@override
- Widget build(BuildContext context) => ClipRRect(
- borderRadius: BorderRadius.circular(4),
- child: SizedBox(
- height: 76,
- child: ColoredBox(
- color: palette.workspace,
- child: Column(
- children: [
- ColoredBox(
- color: palette.tabBar,
- child: SizedBox(
- height: 16,
- child: Row(
- children: [
- const SizedBox(width: 6),
- for (var i = 0; i < 3; i++)
- Padding(
- padding: const EdgeInsets.only(right: 3),
- child: Container(
- width: 3,
- height: 3,
- decoration: const BoxDecoration(
- color: Colors.white38,
- shape: BoxShape.circle,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ClipRRect(
+ borderRadius: BorderRadius.circular(4),
+ child: SizedBox(
+ height: 76,
+ child: ColoredBox(
+ color: palette.workspace,
+ child: Column(
+ children: [
+ ColoredBox(
+ color: palette.tabBar,
+ child: SizedBox(
+ height: 16,
+ child: Row(
+ children: [
+ const SizedBox(width: 6),
+ for (var i = 0; i < 3; i++)
+ Padding(
+ padding: const EdgeInsets.only(right: 3),
+ child: Container(
+ width: 3,
+ height: 3,
+ decoration: const BoxDecoration(
+ color: Colors.white38,
+ shape: BoxShape.circle,
+ ),
),
),
+ const SizedBox(width: 6),
+ Container(
+ width: 40,
+ height: 12,
+ margin: const EdgeInsets.only(top: 4),
+ color: palette.workspace,
),
- const SizedBox(width: 6),
- Container(
- width: 40,
- height: 12,
- margin: const EdgeInsets.only(top: 4),
- color: palette.workspace,
- ),
- const Spacer(),
- Container(
- width: 28,
- height: 6,
- margin: const EdgeInsets.only(right: 6),
- decoration: BoxDecoration(
- color: palette.search,
- borderRadius: BorderRadius.circular(3),
+ const Spacer(),
+ Container(
+ width: 28,
+ height: 6,
+ margin: const EdgeInsets.only(right: 6),
+ decoration: BoxDecoration(
+ color: palette.search,
+ borderRadius: BorderRadius.circular(3),
+ ),
),
- ),
- ],
+ ],
+ ),
),
),
- ),
- Expanded(
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Row(
- children: [
- for (var pane = 0; pane < 2; pane++) ...[
- if (pane > 0) const SizedBox(width: 4),
- Expanded(
- child: Container(
- padding: const EdgeInsets.all(6),
- decoration: BoxDecoration(
- color: palette.background,
- borderRadius: BorderRadius.circular(3),
- border: pane == 0
- ? Border.all(
- color: palette.accent.withValues(
- alpha: 0.65,
- ),
- )
- : null,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: 20,
- height: 3,
- color: palette.accent,
- ),
- const SizedBox(height: 6),
- FractionallySizedBox(
- widthFactor: 0.85,
- child: Container(
- height: 2,
- color: Colors.white54,
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: Row(
+ children: [
+ for (var pane = 0; pane < 2; pane++) ...[
+ if (pane > 0) const SizedBox(width: 4),
+ Expanded(
+ child: Container(
+ padding: const EdgeInsets.all(6),
+ decoration: BoxDecoration(
+ color: palette.background,
+ borderRadius: BorderRadius.circular(3),
+ border: pane == 0
+ ? Border.all(
+ color: palette.accent.withValues(
+ alpha: 0.65,
+ ),
+ )
+ : null,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Container(
+ width: 20,
+ height: 3,
+ color: palette.accent,
),
- ),
- const SizedBox(height: 4),
- FractionallySizedBox(
- widthFactor: 0.6,
- child: Container(
- height: 2,
- color: Colors.white30,
+ const SizedBox(height: 6),
+ FractionallySizedBox(
+ widthFactor: 0.85,
+ child: Container(
+ height: 2,
+ color: Colors.white54,
+ ),
),
- ),
- ],
+ const SizedBox(height: 4),
+ FractionallySizedBox(
+ widthFactor: 0.6,
+ child: Container(
+ height: 2,
+ color: Colors.white30,
+ ),
+ ),
+ ],
+ ),
),
),
- ),
+ ],
],
- ],
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/settings/appearance/typography_section.dart b/desktop/lib/settings/appearance/typography_section.dart
deleted file mode 100644
index 25c258727..000000000
--- a/desktop/lib/settings/appearance/typography_section.dart
+++ /dev/null
@@ -1,265 +0,0 @@
-import 'dart:async';
-
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-
-import '../../shared/theme/app_theme.dart' as grid;
-import '../../shared/theme/appearance_prefs_store.dart';
-import '../../shared/widgets/app_select_field.dart';
-import '../../shared/widgets/section_heading.dart';
-import '../../shared/widgets/setting_row.dart';
-import '../../shared/widgets/skeleton.dart';
-import 'system_fonts.dart';
-
-/// [AppSelectField]'s closed well with a blank where the value goes, at the
-/// row's control width — what the UI font control is while the system's
-/// font list is being read.
-class _SelectSkeleton extends StatelessWidget {
- const _SelectSkeleton({super.key});
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return Container(
- width: SettingRow.controlWidth,
- height: grid.AppControl.height,
- padding: const EdgeInsets.only(left: 10, right: 8),
- decoration: BoxDecoration(
- color: grid.AppSurface.recess,
- borderRadius: BorderRadius.circular(grid.AppControl.radius),
- ),
- child: Row(
- children: [
- Expanded(
- child: SkeletonText(
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: grid.AppControl.fontSize,
- fontWeight: grid.AppControl.fontWeight,
- ),
- widthFactor: 0.55,
- ),
- ),
- const SizedBox(width: 6),
- Icon(
- Icons.expand_more_rounded,
- size: grid.AppControl.iconSize,
- color: grid.AppPalette.textSecondary,
- ),
- ],
- ),
- );
- }
-}
-
-/// Customize Harness ▸ Appearance ▸ Typography — the face the app is set in, and how big.
-///
-/// ⚠️ The APP's type, not the terminal's. The terminal keeps its own face and
-/// size in Customize Harness ▸ Terminal, because what it renders is a grid a remote
-/// program draws into rather than a label this app writes — and the UI scale is
-/// fenced out of it at five seams, guarded by
-/// `test/terminal_ui_scale_isolation_test.dart`.
-class TypographySection extends StatefulWidget {
- const TypographySection({super.key});
-
- @override
- State<TypographySection> createState() => _TypographySectionState();
-}
-
-class _TypographySectionState extends State<TypographySection> {
- /// ⚠️ Held in state, and re-made only when the SELECTED family moves.
- ///
- /// A `FutureBuilder` handed a future built inside `build` starts a new one on
- /// every rebuild, and each result rebuilds again — a loop that never settles.
- /// It costs nothing while the list is a constant and everything the day it
- /// crosses a MethodChannel, so it is written correctly now.
- late Future<List<SelectOption<String?>>> _families;
- String? _familiesFor;
-
- @override
- void initState() {
- super.initState();
- _familiesFor = appearancePrefsStore.value.uiFamily;
- _families = SystemFonts.load(selected: _familiesFor);
- }
-
- void _refreshFamilies(String? selected) {
- if (selected == _familiesFor) return;
- _familiesFor = selected;
- _families = SystemFonts.load(selected: selected);
- }
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return ValueListenableBuilder<AppearancePrefs>(
- valueListenable: appearancePrefsStore,
- builder: (context, prefs, _) {
- _refreshFamilies(prefs.uiFamily);
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SectionHeading('Text'),
- const SizedBox(height: 12),
- SettingRow(
- title: 'UI font',
- control: FutureBuilder<List<SelectOption<String?>>>(
- future: _families,
- builder: (context, snapshot) {
- final options = snapshot.data;
- // Nothing to pick from yet: a control of the right size with
- // a blank where the value goes, rather than collapsing the
- // row, so the column does not jump when the list arrives.
- if (options == null) {
- return const _SelectSkeleton(key: Key('ui-font-skeleton'));
- }
- return AppSelectField<String?>(
- width: SettingRow.controlWidth,
- value: prefs.uiFamily,
- options: options,
- onChanged: (family) =>
- unawaited(appearancePrefsStore.setUiFamily(family)),
- );
- },
- ),
- ),
- const SizedBox(height: 10),
- SettingRow(
- title: 'UI font size',
- control: _SizeField(
- value: prefs.uiSize,
- onCommitted: (size) =>
- unawaited(appearancePrefsStore.setUiSize(size)),
- ),
- ),
- const SizedBox(height: 14),
- const _TypePreview(),
- ],
- );
- },
- );
- }
-}
-
-/// The size box: a number, right-aligned, with its unit inside the field.
-///
-/// ⚠️ Commits on Enter and on losing focus, NEVER on each keystroke. Typing the
-/// `9` on the way to `19` would resize the whole app for a moment — including
-/// this very field, under the caret that is typing into it.
-class _SizeField extends StatefulWidget {
- const _SizeField({required this.value, required this.onCommitted});
-
- final double value;
- final ValueChanged<double> onCommitted;
-
- @override
- State<_SizeField> createState() => _SizeFieldState();
-}
-
-class _SizeFieldState extends State<_SizeField> {
- late final TextEditingController _controller = TextEditingController(
- text: _format(widget.value),
- );
- late final FocusNode _focus = FocusNode()..addListener(_onFocusChange);
-
- static String _format(double value) =>
- value == value.roundToDouble() ? value.round().toString() : '$value';
-
- @override
- void didUpdateWidget(covariant _SizeField old) {
- super.didUpdateWidget(old);
- // Follow the store when the change came from somewhere else (a reset), but
- // never yank the text out from under someone mid-edit.
- if (widget.value != old.value && !_focus.hasFocus) {
- _controller.text = _format(widget.value);
- }
- }
-
- @override
- void dispose() {
- _focus.removeListener(_onFocusChange);
- _focus.dispose();
- _controller.dispose();
- super.dispose();
- }
-
- void _onFocusChange() {
- if (!_focus.hasFocus) _commit();
- }
-
- void _commit() {
- final parsed = double.tryParse(_controller.text.trim());
- if (parsed == null || !parsed.isFinite) {
- // ⚠️ Revert, do not reset. Unparseable input is a typo, and answering a
- // typo by silently discarding the user's actual setting is a bigger
- // surprise than doing nothing.
- _controller.text = _format(widget.value);
- return;
- }
- final clamped = parsed.clamp(
- AppearancePrefs.uiSizeMin,
- AppearancePrefs.uiSizeMax,
- );
- // Snapped values are written BACK into the field, so it never shows a number
- // the app is not actually using.
- _controller.text = _format(clamped);
- if (clamped != widget.value) widget.onCommitted(clamped);
- }
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return SizedBox(
- width: 96,
- child: TextField(
- key: const Key('appearance-ui-size-field'),
- controller: _controller,
- focusNode: _focus,
- textAlign: TextAlign.right,
- style: grid.kFieldTextStyle,
- keyboardType: const TextInputType.numberWithOptions(decimal: true),
- inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9.]'))],
- onSubmitted: (_) => _commit(),
- decoration: const InputDecoration(
- // Inside the field, not after it: a unit hung outside would push the
- // box off the right edge the other controls line up on.
- suffixText: 'px',
- isDense: true,
- ),
- ),
- );
- }
-}
-
-/// What the choices above actually look like.
-///
-/// One line of prose at the app's own body size — which is the shape of nearly
-/// every surface in this app, so the sample is the thing rather than a stand-in
-/// for it. It scales with the setting because it is app chrome, and that is the
-/// whole point of showing it.
-class _TypePreview extends StatelessWidget {
- const _TypePreview();
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- final theme = Theme.of(context);
- return Padding(
- padding: const EdgeInsets.symmetric(vertical: 8),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('Preview', style: theme.textTheme.titleSmall),
- const SizedBox(height: 10),
- Text('Aa Bb Cc 0123456789', style: theme.textTheme.titleMedium),
- const SizedBox(height: 6),
- Text(
- 'The quick brown fox jumps over the lazy dog.',
- style: theme.textTheme.bodyMedium,
- ),
- ],
- ),
- );
- }
-}
diff --git a/desktop/lib/settings/sections/about_section.dart b/desktop/lib/settings/sections/about_section.dart
index 8d580aa7c..3f5bec2b3 100644
--- a/desktop/lib/settings/sections/about_section.dart
+++ b/desktop/lib/settings/sections/about_section.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../core/app_version.dart';
import '../../core/build_identity.dart';
@@ -75,9 +76,8 @@ class _AboutSectionState extends State<AboutSection> {
? 'Harness checks for a newer build when it starts, '
'and every six hours after that.'
: 'Updates are disabled in this build.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 11.5,
height: 1.45,
),
),
@@ -162,9 +162,8 @@ class _Identity extends StatelessWidget {
children: [
Text(
desktopAppName,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 16,
fontWeight: grid.AppFont.semibold,
letterSpacing: -0.1,
),
@@ -205,12 +204,7 @@ class _VersionLineState extends State<_VersionLine> {
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
- final style = TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 12.5,
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
- );
+ final style = terminalTextStyle(color: grid.AppPalette.textSecondary);
return Wrap(
spacing: 9,
runSpacing: 6,
@@ -277,9 +271,8 @@ class _StatusPill extends StatelessWidget {
Flexible(
child: Text(
state.label,
- style: TextStyle(
+ style: terminalTextStyle(
color: state.color,
- fontSize: 11,
fontWeight: grid.AppFont.medium,
),
),
@@ -402,30 +395,32 @@ class _AboutAction extends StatelessWidget {
final Widget action;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, constraints) {
- final text = Text(
- description,
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 12,
- height: 1.45,
- ),
- );
- final scale = MediaQuery.textScalerOf(context).scale(12) / 12;
- if (constraints.maxWidth < 420 * scale) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [text, const SizedBox(height: 10), action],
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final text = Text(
+ description,
+ style: terminalTextStyle(
+ color: grid.AppPalette.textSecondary,
+ height: 1.45,
+ ),
);
- }
- return Row(
- children: [
- Expanded(child: text),
- const SizedBox(width: 18),
- action,
- ],
- );
- },
- );
+ final scale = terminalTextScaleOf(context);
+ if (constraints.maxWidth < 420 * scale) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [text, const SizedBox(height: 10), action],
+ );
+ }
+ return Row(
+ children: [
+ Expanded(child: text),
+ const SizedBox(width: 18),
+ action,
+ ],
+ );
+ },
+ );
+ }
}
diff --git a/desktop/lib/settings/sections/appearance_section.dart b/desktop/lib/settings/sections/appearance_section.dart
index e03278d38..f0f49bc9c 100644
--- a/desktop/lib/settings/sections/appearance_section.dart
+++ b/desktop/lib/settings/sections/appearance_section.dart
@@ -1,13 +1,12 @@
import 'package:flutter/material.dart';
import '../../shared/theme/app_theme.dart' as grid;
-import '../appearance/typography_section.dart';
import '../appearance/palette_section.dart';
/// Customize Harness ▸ Appearance: how the app looks on this Mac.
///
-/// Palettes coordinate the workspace and terminal defaults. UI typography stays
-/// separate from the agent terminal's font and size in Customize Harness ▸ Terminal.
+/// Palettes coordinate the workspace and terminal defaults. The shared font
+/// and size are configured once in Customize Harness ▸ Terminal.
class AppearanceSection extends StatelessWidget {
const AppearanceSection({super.key});
@@ -20,7 +19,6 @@ class AppearanceSection extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
PaletteSection(),
- TypographySection(),
// Room under the last card so a scrolled-to-bottom pane does not end
// flush against the window edge.
SizedBox(height: 8),
diff --git a/desktop/lib/settings/sections/debug_detail_dialog.dart b/desktop/lib/settings/sections/debug_detail_dialog.dart
index c927a9266..cefd33ce5 100644
--- a/desktop/lib/settings/sections/debug_detail_dialog.dart
+++ b/desktop/lib/settings/sections/debug_detail_dialog.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../logging/log_file.dart';
import '../../logging/log_stream.dart';
@@ -44,12 +45,7 @@ class _DebugDetailDialog extends StatelessWidget {
Expanded(
child: Text(
'${entry.category} · ${debugEntryOutcome(entry)}',
- style: TextStyle(
- color: AppPalette.textSecondary,
- fontSize: 12.5,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
],
@@ -126,8 +122,7 @@ class _Caption extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 5),
child: Text(
text,
- style: TextStyle(
- fontSize: 11.5,
+ style: terminalTextStyle(
fontWeight: AppFont.medium,
color: AppPalette.textFaint,
),
@@ -157,11 +152,8 @@ class _Block extends StatelessWidget {
),
child: SelectableText(
text,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.45,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: danger ? debugDangerInk(context) : AppPalette.textPrimary,
),
),
diff --git a/desktop/lib/settings/sections/debug_filter_bar.dart b/desktop/lib/settings/sections/debug_filter_bar.dart
index f23835de8..508d578df 100644
--- a/desktop/lib/settings/sections/debug_filter_bar.dart
+++ b/desktop/lib/settings/sections/debug_filter_bar.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../shared/theme/app_theme.dart';
import '../../shared/widgets/toolbar_pill.dart';
@@ -82,17 +83,12 @@ class _LensLabel extends StatelessWidget {
children: [
Text(
lens.label,
- style: TextStyle(
- fontSize: 13,
- fontWeight: AppFont.medium,
- color: ink,
- ),
+ style: terminalTextStyle(fontWeight: AppFont.medium, color: ink),
),
const SizedBox(width: 6),
Text(
'${lens.count}',
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
fontWeight: AppFont.medium,
color: lens.selected
? ink
diff --git a/desktop/lib/settings/sections/debug_log_tile.dart b/desktop/lib/settings/sections/debug_log_tile.dart
index a304611b8..11c8fb692 100644
--- a/desktop/lib/settings/sections/debug_log_tile.dart
+++ b/desktop/lib/settings/sections/debug_log_tile.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../logging/log_file.dart';
import '../../logging/log_stream.dart';
@@ -62,11 +63,8 @@ class _DebugLogTileState extends State<DebugLogTile> {
entry.message,
maxLines: 3,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
height: 1.35,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: AppPalette.textPrimary,
),
),
@@ -95,11 +93,8 @@ class _DebugLogTileState extends State<DebugLogTile> {
entry.error!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.35,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: debugDangerInk(context),
),
),
@@ -172,12 +167,7 @@ class _Meta extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
- final style = TextStyle(
- fontSize: 11,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
- color: AppPalette.textFaint,
- );
+ final style = terminalTextStyle(color: AppPalette.textFaint);
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
diff --git a/desktop/lib/settings/sections/debug_paths_card.dart b/desktop/lib/settings/sections/debug_paths_card.dart
index b32b508ad..8c32643ea 100644
--- a/desktop/lib/settings/sections/debug_paths_card.dart
+++ b/desktop/lib/settings/sections/debug_paths_card.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../core/harness_cli_runner.dart';
import '../../logging/log_file.dart';
@@ -142,17 +143,14 @@ class _PathRow extends StatelessWidget {
width: 62,
child: Text(
label,
- style: TextStyle(fontSize: 12, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
),
Expanded(
child: SelectableText(
value,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.4,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: AppPalette.textPrimary,
),
),
diff --git a/desktop/lib/settings/sections/debug_section.dart b/desktop/lib/settings/sections/debug_section.dart
index faf679884..7f95ffa04 100644
--- a/desktop/lib/settings/sections/debug_section.dart
+++ b/desktop/lib/settings/sections/debug_section.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../logging/log_file.dart';
import '../../logging/log_stream.dart';
@@ -115,7 +116,7 @@ class _DebugSectionState extends State<DebugSection> {
const SizedBox(height: 10),
TextField(
controller: _search,
- style: const TextStyle(fontSize: 13),
+ style: terminalTextStyle(),
decoration:
labeledFieldDecoration(
'Search messages, categories, errors',
diff --git a/desktop/lib/settings/sections/debug_toolbar.dart b/desktop/lib/settings/sections/debug_toolbar.dart
index dbec06cf7..effaa4c52 100644
--- a/desktop/lib/settings/sections/debug_toolbar.dart
+++ b/desktop/lib/settings/sections/debug_toolbar.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../core/reveal_folder.dart';
import '../../widgets/export_logs_dialog.dart';
@@ -28,7 +29,7 @@ class DebugToolbar extends StatelessWidget {
Expanded(
child: Text(
'$total ${total == 1 ? 'entry' : 'entries'}',
- style: TextStyle(fontSize: 12.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
const _ExportLogsPill(),
@@ -64,6 +65,7 @@ class _ExportLogsPill extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return ToolbarPill(
onTap: () => unawaited(showExportLogsDialog(context)),
rimmed: true,
@@ -98,6 +100,7 @@ class _OpenLogsPill extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return ToolbarPill(
onTap: () => unawaited(_open(context)),
rimmed: true,
@@ -135,11 +138,7 @@ class DebugPillLabel extends StatelessWidget {
const SizedBox(width: 6),
Text(
label,
- style: TextStyle(
- fontSize: 13,
- fontWeight: AppFont.medium,
- color: ink,
- ),
+ style: terminalTextStyle(fontWeight: AppFont.medium, color: ink),
),
],
);
diff --git a/desktop/lib/settings/sections/devices_section.dart b/desktop/lib/settings/sections/devices_section.dart
index fde0d8107..e84352bb2 100644
--- a/desktop/lib/settings/sections/devices_section.dart
+++ b/desktop/lib/settings/sections/devices_section.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../autonomous_device/autonomous_device_cli.dart';
import '../../core/test_run.dart';
@@ -132,14 +133,7 @@ class _DevicesSectionState extends State<DevicesSection> {
title: Text(title),
content: SizedBox(
width: 360,
- child: Text(
- detail,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 13.5,
- height: 1.4,
- ),
- ),
+ child: Text(detail, style: terminalTextStyle(height: 1.4)),
),
actions: [
TextButton(
@@ -303,11 +297,7 @@ class _DevicesSectionState extends State<DevicesSection> {
padding: const EdgeInsets.symmetric(vertical: 12),
child: Text(
_actionError ?? _error!,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 13,
- color: grid.AppPalette.dangerFill,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.dangerFill),
),
),
if (!_unsupported && !_loading) ...[
@@ -397,9 +387,7 @@ class _DevicesSectionState extends State<DevicesSection> {
obscureText: true,
autocorrect: false,
enableSuggestions: false,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 13,
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
),
decoration: labeledFieldDecoration(
@@ -420,11 +408,7 @@ class _DevicesSectionState extends State<DevicesSection> {
const SizedBox(height: 10),
Text(
'Harness CLI keeps the connection running when you close Desktop.',
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 12,
- color: grid.AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
const SizedBox(height: 10),
],
diff --git a/desktop/lib/settings/sections/tracking_detail_dialog.dart b/desktop/lib/settings/sections/tracking_detail_dialog.dart
index fbd195bb9..fd13eea8b 100644
--- a/desktop/lib/settings/sections/tracking_detail_dialog.dart
+++ b/desktop/lib/settings/sections/tracking_detail_dialog.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../analytics/analytics_log.dart';
import '../../logging/log_file.dart';
@@ -53,6 +54,7 @@ class _Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final payload = entry.payload;
return Column(
mainAxisSize: MainAxisSize.min,
@@ -67,12 +69,7 @@ class _Body extends StatelessWidget {
Expanded(
child: Text(
'${entry.name} · ${trackedOutcome(entry)}',
- style: TextStyle(
- color: AppPalette.textSecondary,
- fontSize: 12.5,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
],
@@ -158,8 +155,7 @@ class _Caption extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 5),
child: Text(
text,
- style: TextStyle(
- fontSize: 11.5,
+ style: terminalTextStyle(
fontWeight: AppFont.medium,
color: AppPalette.textFaint,
),
@@ -188,11 +184,8 @@ class _Block extends StatelessWidget {
),
child: SelectableText(
text,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.45,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: danger ? debugDangerInk(context) : AppPalette.textPrimary,
),
),
diff --git a/desktop/lib/settings/sections/tracking_section.dart b/desktop/lib/settings/sections/tracking_section.dart
index 317b5bb36..53871ef46 100644
--- a/desktop/lib/settings/sections/tracking_section.dart
+++ b/desktop/lib/settings/sections/tracking_section.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../analytics/analytics_log.dart';
import '../../analytics/analytics_sink.dart';
@@ -168,7 +169,7 @@ class _Toolbar extends StatelessWidget {
Expanded(
child: Text(
'$total ${total == 1 ? 'event' : 'events'}',
- style: TextStyle(fontSize: 12.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
ToolbarPill(
diff --git a/desktop/lib/settings/sections/tracking_stream_card.dart b/desktop/lib/settings/sections/tracking_stream_card.dart
index 554000cdd..1f0044b1c 100644
--- a/desktop/lib/settings/sections/tracking_stream_card.dart
+++ b/desktop/lib/settings/sections/tracking_stream_card.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../analytics/analytics_sink.dart';
import '../../shared/theme/app_theme.dart';
@@ -69,8 +70,7 @@ class _TrackingStreamCardState extends State<TrackingStreamCard> {
const SizedBox(height: 6),
Text(
reason,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.4,
color: AppPalette.textSecondary,
),
@@ -113,11 +113,7 @@ class _StatePill extends StatelessWidget {
),
child: Text(
enabled ? 'Reporting' : 'Off',
- style: TextStyle(
- fontSize: 11.5,
- fontWeight: AppFont.medium,
- color: ink,
- ),
+ style: terminalTextStyle(fontWeight: AppFont.medium, color: ink),
),
);
}
@@ -144,17 +140,14 @@ class _Row extends StatelessWidget {
width: 72,
child: Text(
label,
- style: TextStyle(fontSize: 12, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
),
Expanded(
child: SelectableText(
value,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.4,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: muted
? AppPalette.textSecondary
: AppPalette.textPrimary,
diff --git a/desktop/lib/settings/sections/tracking_tile.dart b/desktop/lib/settings/sections/tracking_tile.dart
index 6d9b74e02..251eb7f44 100644
--- a/desktop/lib/settings/sections/tracking_tile.dart
+++ b/desktop/lib/settings/sections/tracking_tile.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../analytics/analytics_log.dart';
import '../../logging/log_file.dart';
@@ -61,10 +62,7 @@ class _TrackingTileState extends State<TrackingTile> {
entry.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.5,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
+ style: terminalTextStyle(
color: AppPalette.textPrimary,
),
),
@@ -93,11 +91,8 @@ class _TrackingTileState extends State<TrackingTile> {
summary,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.35,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
color: failed
? debugDangerInk(context)
: AppPalette.textSecondary,
@@ -156,12 +151,7 @@ class _Meta extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
- final style = TextStyle(
- fontSize: 11,
- fontFamily: AppFont.mono,
- fontFamilyFallback: AppFont.monoFallback,
- color: AppPalette.textFaint,
- );
+ final style = terminalTextStyle(color: AppPalette.textFaint);
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
diff --git a/desktop/lib/settings/sections/usage_detail_panels.dart b/desktop/lib/settings/sections/usage_detail_panels.dart
index 24417856f..cb49b7520 100644
--- a/desktop/lib/settings/sections/usage_detail_panels.dart
+++ b/desktop/lib/settings/sections/usage_detail_panels.dart
@@ -6,6 +6,8 @@
/// handed, so the pane can be driven from a fixture.
library;
+import 'package:harness/terminal/terminal_text.dart';
+
import 'dart:math' as math;
import 'package:flutter/material.dart';
@@ -18,7 +20,7 @@ import '../../usage/ledger/usage_report.dart';
/// How many days the bar chart shows. Ten, as Orca uses — enough to see a shape,
/// few enough that each bar keeps a readable label under it.
const _kChartDays = 10;
-const _kChartLabelStyle = TextStyle(fontSize: 9.5, height: 1.3);
+TextStyle get _kChartLabelStyle => terminalTextStyle(height: 1.3);
const _kBarHeight = 118.0;
/// The colours the four token buckets keep, everywhere they are drawn.
@@ -72,7 +74,7 @@ class UsageDailyChart extends StatelessWidget {
child: Center(
child: Text(
'Nothing in this range.',
- style: TextStyle(fontSize: 12, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
),
)
@@ -146,6 +148,7 @@ class _Bar extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final total = day.totals.total;
final segments = <({int tokens, Color colour})>[
// Top-down, so the stack reads in the same order as the legend.
@@ -214,24 +217,24 @@ class _LegendDot extends StatelessWidget {
final String label;
@override
- Widget build(BuildContext context) => Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- width: 8,
- height: 8,
- decoration: BoxDecoration(
- color: colour,
- borderRadius: BorderRadius.circular(2),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ width: 8,
+ height: 8,
+ decoration: BoxDecoration(
+ color: colour,
+ borderRadius: BorderRadius.circular(2),
+ ),
),
- ),
- const SizedBox(width: 6),
- Text(
- label,
- style: TextStyle(fontSize: 11.5, color: AppPalette.textSecondary),
- ),
- ],
- );
+ const SizedBox(width: 6),
+ Text(label, style: terminalTextStyle(color: AppPalette.textSecondary)),
+ ],
+ );
+ }
}
/// A ranked list — the top few models, or the top few projects.
@@ -243,14 +246,12 @@ class UsageBreakdownCard extends StatelessWidget {
required this.rows,
this.limit = 5,
});
-
final String title;
final String subtitle;
/// Heaviest first, as `breakdownByModel` and `breakdownByProject` return them.
final List<BreakdownRow> rows;
final int limit;
-
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
@@ -261,7 +262,7 @@ class UsageBreakdownCard extends StatelessWidget {
child: shown.isEmpty
? Text(
'Nothing in this range.',
- style: TextStyle(fontSize: 12, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -278,8 +279,7 @@ class UsageBreakdownCard extends StatelessWidget {
child: Text(
row.label,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
color: AppPalette.textPrimary,
),
),
@@ -287,8 +287,7 @@ class UsageBreakdownCard extends StatelessWidget {
const SizedBox(width: 10),
Text(
formatTokens(row.tokens),
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
color: AppPalette.textSecondary,
fontFeatures: const [
FontFeature.tabularFigures(),
@@ -300,10 +299,7 @@ class UsageBreakdownCard extends StatelessWidget {
const SizedBox(height: 2),
Text(
_rowDetail(row),
- style: TextStyle(
- fontSize: 11,
- color: AppPalette.textFaint,
- ),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
],
),
@@ -339,7 +335,7 @@ class UsageSessionsTable extends StatelessWidget {
child: rows.isEmpty
? Text(
'Nothing in this range.',
- style: TextStyle(fontSize: 12, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
)
// A table is the one thing on this pane that can genuinely outgrow
// its column, so it brings its own horizontal scroll rather than
@@ -383,22 +379,25 @@ const _kSessionColumns = <({String label, double width, bool numeric})>[
class _SessionHeaderRow extends StatelessWidget {
@override
- Widget build(BuildContext context) => Padding(
- padding: const EdgeInsets.only(bottom: 6),
- child: Row(
- children: [
- for (final column in _kSessionColumns)
- SizedBox(
- width: column.width,
- child: Text(
- column.label,
- textAlign: column.numeric ? TextAlign.right : TextAlign.left,
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 6),
+ child: Row(
+ children: [
+ for (final column in _kSessionColumns)
+ SizedBox(
+ width: column.width,
+ child: Text(
+ column.label,
+ textAlign: column.numeric ? TextAlign.right : TextAlign.left,
+ style: terminalTextStyle(color: AppPalette.textFaint),
+ ),
),
- ),
- ],
- ),
- );
+ ],
+ ),
+ );
+ }
}
class _SessionRowTile extends StatelessWidget {
@@ -408,6 +407,7 @@ class _SessionRowTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final cells = <String>[
_sessionTime(row.lastActiveAt),
row.project,
@@ -429,8 +429,7 @@ class _SessionRowTile extends StatelessWidget {
textAlign: _kSessionColumns[i].numeric
? TextAlign.right
: TextAlign.left,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: i == 1
? AppPalette.textPrimary
: AppPalette.textSecondary,
@@ -459,27 +458,30 @@ class _Card extends StatelessWidget {
final Widget child;
@override
- Widget build(BuildContext context) => Container(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 14),
- decoration: BoxDecoration(
- color: AppGlass.surfaceFill,
- borderRadius: BorderRadius.circular(14),
- boxShadow: AppGlass.cardShadow,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(title, style: Theme.of(context).textTheme.titleSmall),
- const SizedBox(height: 2),
- Text(
- subtitle,
- style: TextStyle(fontSize: 11.5, color: AppPalette.textSecondary),
- ),
- const SizedBox(height: 12),
- child,
- ],
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Container(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 14),
+ decoration: BoxDecoration(
+ color: AppGlass.surfaceFill,
+ borderRadius: BorderRadius.circular(14),
+ boxShadow: AppGlass.cardShadow,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(title, style: Theme.of(context).textTheme.titleSmall),
+ const SizedBox(height: 2),
+ Text(
+ subtitle,
+ style: terminalTextStyle(color: AppPalette.textSecondary),
+ ),
+ const SizedBox(height: 12),
+ child,
+ ],
+ ),
+ );
+ }
}
String _dayLabel(DateTime day) =>
diff --git a/desktop/lib/settings/sections/usage_header.dart b/desktop/lib/settings/sections/usage_header.dart
index d28ef1607..58c59e2e0 100644
--- a/desktop/lib/settings/sections/usage_header.dart
+++ b/desktop/lib/settings/sections/usage_header.dart
@@ -2,16 +2,12 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
-import '../../shared/theme/app_theme.dart';
+import '../../terminal/terminal_text.dart';
import '../../shared/widgets/app_select_field.dart';
import '../../usage/ledger/usage_report.dart';
-double usageControlWidth(BuildContext context, double width) => math.max(
- width,
- width *
- MediaQuery.textScalerOf(context).scale(AppControl.fontSize) /
- AppControl.fontSize,
-);
+double usageControlWidth(BuildContext context, double width) =>
+ math.max(width, width * terminalTextScaleOf(context));
/// Keep the controls together, below the caption when larger text needs room.
class UsageHeader extends StatelessWidget {
diff --git a/desktop/lib/settings/sections/usage_panels.dart b/desktop/lib/settings/sections/usage_panels.dart
index 223ce140c..32e996b1a 100644
--- a/desktop/lib/settings/sections/usage_panels.dart
+++ b/desktop/lib/settings/sections/usage_panels.dart
@@ -6,6 +6,8 @@
/// handed — none reads a store — so the pane can be driven from a fixture.
library;
+import 'package:harness/terminal/terminal_text.dart';
+
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
@@ -36,15 +38,15 @@ class UsageLoadingState extends StatelessWidget {
children: [
Text(
message,
- style: TextStyle(fontSize: 12.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
const SizedBox(height: 12),
- const SkeletonText(
- style: TextStyle(fontSize: 20, height: 1.1),
+ SkeletonText(
+ style: terminalTextStyle(height: 1.1),
widthFactor: .45,
),
const SizedBox(height: 8),
- const SkeletonText(style: TextStyle(fontSize: 12), widthFactor: .7),
+ SkeletonText(style: terminalTextStyle(), widthFactor: .7),
],
),
),
@@ -60,9 +62,7 @@ class UsageLoadingState extends StatelessWidget {
/// keeping for the sake of matching.
class StatsSummaryCards extends StatelessWidget {
const StatsSummaryCards({super.key, required this.summary});
-
final StatsSummary summary;
-
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
@@ -78,12 +78,11 @@ class StatsSummaryCards extends StatelessWidget {
child: Center(
child: Text(
'Start your first agent to begin tracking.',
- style: TextStyle(fontSize: 12.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
);
}
-
final cards = [
UsageStatCard(
label: 'Agents spawned',
@@ -101,7 +100,6 @@ class StatsSummaryCards extends StatelessWidget {
icon: LucideIcons.messagesSquare300,
),
];
-
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -122,7 +120,7 @@ class StatsSummaryCards extends StatelessWidget {
const SizedBox(height: 8),
Text(
'Tracking since ${_trackingDate(since)}',
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
],
],
@@ -173,7 +171,6 @@ class UsageStatCard extends StatelessWidget {
required this.icon,
this.footnote,
});
-
final String label;
final String value;
final IconData icon;
@@ -182,7 +179,6 @@ class UsageStatCard extends StatelessWidget {
/// because most figures need none and a card that always carried one would
/// train the eye to skip it.
final String? footnote;
-
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
@@ -204,10 +200,7 @@ class UsageStatCard extends StatelessWidget {
Expanded(
child: Text(
label,
- style: TextStyle(
- fontSize: 11.5,
- color: AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
],
@@ -215,8 +208,7 @@ class UsageStatCard extends StatelessWidget {
const SizedBox(height: 8),
Text(
value,
- style: TextStyle(
- fontSize: 20,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: AppPalette.textPrimary,
height: 1.1,
@@ -226,7 +218,7 @@ class UsageStatCard extends StatelessWidget {
const SizedBox(height: 3),
Text(
footnote!,
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
],
],
@@ -305,12 +297,12 @@ class DailyIntensityGrid extends StatelessWidget {
children: [
Text(
days.isEmpty ? '' : _shortDate(days.first.day),
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
const Spacer(),
Text(
'Less',
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
const SizedBox(width: 6),
for (var level = 0; level <= 4; level++) ...[
@@ -320,12 +312,12 @@ class DailyIntensityGrid extends StatelessWidget {
const SizedBox(width: 3),
Text(
'More',
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
const Spacer(),
Text(
days.isEmpty ? '' : _shortDate(days.last.day),
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
],
),
@@ -345,6 +337,7 @@ class _IntensityCell extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
// Step 0 is the recess the empty grid is made of; the rest climb the accent.
// Discrete steps rather than a ramp, because a heatmap is read by comparing
// squares and a smooth gradient gives the eye nothing to compare.
@@ -439,10 +432,7 @@ class TokenMixBar extends StatelessWidget {
child: Text(
'${slice.label}: ${formatTokens(slice.tokens)}',
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
- color: AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
],
@@ -506,8 +496,7 @@ class _PanelCard extends StatelessWidget {
const SizedBox(height: 2),
Text(
subtitle,
- style: TextStyle(
- fontSize: 11.5,
+ style: terminalTextStyle(
height: 1.35,
color: AppPalette.textSecondary,
),
@@ -528,8 +517,7 @@ class _PanelCard extends StatelessWidget {
),
child: Text(
label,
- style: TextStyle(
- fontSize: 10.5,
+ style: terminalTextStyle(
height: 1.25,
color: AppPalette.textSecondary,
),
@@ -621,7 +609,7 @@ class ProviderUsageRow extends StatelessWidget {
),
child: Text(
state.enabled ? 'Turn off' : 'Enable',
- style: const TextStyle(fontSize: 12),
+ style: terminalTextStyle(),
),
),
],
@@ -630,14 +618,11 @@ class ProviderUsageRow extends StatelessWidget {
if (_detail() case final detail?)
Text(
detail,
- style: TextStyle(fontSize: 11.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
if (state.status == LedgerStatus.scanning && !ledger.hasData) ...[
const SizedBox(height: 10),
- const SkeletonText(
- style: TextStyle(fontSize: 12),
- widthFactor: .55,
- ),
+ SkeletonText(style: terminalTextStyle(), widthFactor: .55),
],
if (state.enabled &&
(state.status == LedgerStatus.ok ||
@@ -650,16 +635,12 @@ class ProviderUsageRow extends StatelessWidget {
Expanded(
child: Text(
'${formatTokens(ledger.totals.total)} tokens',
- style: TextStyle(
- fontSize: 12,
- color: AppPalette.textPrimary,
- ),
+ style: terminalTextStyle(color: AppPalette.textPrimary),
),
),
Text(
formatCost(ledger.costUsd),
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: AppPalette.textPrimary,
fontFeatures: const [FontFeature.tabularFigures()],
),
@@ -743,10 +724,7 @@ class _StatusPill extends StatelessWidget {
color: color.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(6),
),
- child: Text(
- label,
- style: TextStyle(fontSize: 10.5, color: color, height: 1.3),
- ),
+ child: Text(label, style: terminalTextStyle(color: color, height: 1.3)),
);
}
}
@@ -758,9 +736,7 @@ class _StatusPill extends StatelessWidget {
/// somebody hunting for the switch it is describing.
class UsageEmptyState extends StatelessWidget {
const UsageEmptyState({super.key, required this.onEnable});
-
final ValueChanged<LedgerProvider> onEnable;
-
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
@@ -795,8 +771,7 @@ class UsageEmptyState extends StatelessWidget {
'Switch on a provider to read the logs its CLI already keeps on '
'this computer, and build the token ledger from them. Nothing is '
'read until you do, and nothing leaves this machine.',
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
height: 1.45,
color: AppPalette.textSecondary,
),
@@ -816,7 +791,7 @@ class UsageEmptyState extends StatelessWidget {
),
child: Text(
'Enable ${provider.label}',
- style: const TextStyle(fontSize: 12.5),
+ style: terminalTextStyle(),
),
),
],
diff --git a/desktop/lib/settings/sections/usage_provider_pane.dart b/desktop/lib/settings/sections/usage_provider_pane.dart
index fa096eab6..83a83873e 100644
--- a/desktop/lib/settings/sections/usage_provider_pane.dart
+++ b/desktop/lib/settings/sections/usage_provider_pane.dart
@@ -10,6 +10,8 @@
/// would filter on a distinction this app does not have.
library;
+import 'package:harness/terminal/terminal_text.dart';
+
import 'dart:async';
import 'package:flutter/material.dart';
@@ -86,7 +88,7 @@ class _UsageProviderPaneState extends State<UsageProviderPane> {
Text(
'Cache reuse rate is cache read tokens / (fresh input + cache read '
'tokens).',
- style: TextStyle(fontSize: 11, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
const SizedBox(height: 12),
UsageDailyChart(
@@ -122,6 +124,7 @@ class _Figures extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final totals = report.totals;
final cards = <Widget>[
UsageStatCard(
@@ -223,7 +226,7 @@ class _Header extends StatelessWidget {
scanning
? '${range.label} · Scanning local logs…'
: 'All local ${provider.label} usage · ${range.label}',
- style: TextStyle(fontSize: 11.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
],
),
@@ -279,8 +282,7 @@ class _DisabledCard extends StatelessWidget {
'Reads the logs the ${provider.label} CLI already keeps on this '
'computer to show token, model and session figures. Nothing is '
'read until you switch it on.',
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
height: 1.45,
color: AppPalette.textSecondary,
),
@@ -293,10 +295,7 @@ class _DisabledCard extends StatelessWidget {
minimumSize: const Size(0, 30),
padding: const EdgeInsets.symmetric(horizontal: 14),
),
- child: Text(
- 'Enable ${provider.label}',
- style: const TextStyle(fontSize: 12.5),
- ),
+ child: Text('Enable ${provider.label}', style: terminalTextStyle()),
),
],
),
@@ -306,9 +305,7 @@ class _DisabledCard extends StatelessWidget {
class _Notice extends StatelessWidget {
const _Notice({required this.message});
-
final String message;
-
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
@@ -320,7 +317,7 @@ class _Notice extends StatelessWidget {
),
child: Text(
message,
- style: TextStyle(fontSize: 12.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
);
}
diff --git a/desktop/lib/settings/sections/usage_section.dart b/desktop/lib/settings/sections/usage_section.dart
index ae916ee58..f3a3a4c0e 100644
--- a/desktop/lib/settings/sections/usage_section.dart
+++ b/desktop/lib/settings/sections/usage_section.dart
@@ -20,6 +20,8 @@
/// silently excluded most of a team's work would be worse than no total.
library;
+import 'package:harness/terminal/terminal_text.dart';
+
import 'dart:async';
import 'package:flutter/material.dart';
@@ -182,7 +184,7 @@ class _UsageSectionState extends State<UsageSection> {
if (states.values.any((state) => state.hasIncompleteFigures)) ...[
Text(
'Some usage could not be read. Totals are incomplete.',
- style: TextStyle(fontSize: 12.5, color: AppPalette.warn),
+ style: terminalTextStyle(color: AppPalette.warn),
),
const SizedBox(height: 12),
],
@@ -200,10 +202,7 @@ class _UsageSectionState extends State<UsageSection> {
))
Text(
'No figures available.',
- style: TextStyle(
- fontSize: 12.5,
- color: AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
)
else ...[
_cards(overview),
@@ -212,10 +211,7 @@ class _UsageSectionState extends State<UsageSection> {
padding: const EdgeInsets.only(top: 8),
child: Text(
'The cost is a lower bound because some model prices are unavailable.',
- style: TextStyle(
- fontSize: 11.5,
- color: AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
),
if (overview.hasAnyData) ...[
@@ -357,24 +353,27 @@ class _PanelPair extends StatelessWidget {
final Widget mix;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, constraints) {
- if (constraints.maxWidth < 680) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [intensity, const SizedBox(height: 12), mix],
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ if (constraints.maxWidth < 680) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [intensity, const SizedBox(height: 12), mix],
+ );
+ }
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(flex: 12, child: intensity),
+ const SizedBox(width: 12),
+ Expanded(flex: 8, child: mix),
+ ],
);
- }
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(flex: 12, child: intensity),
- const SizedBox(width: 12),
- Expanded(flex: 8, child: mix),
- ],
- );
- },
- );
+ },
+ );
+ }
}
/// The "Usage analytics" caption and the lens picker beside it.
@@ -438,7 +437,7 @@ class _OverviewHeader extends StatelessWidget {
const SizedBox(height: 2),
Text(
_updatedLine(),
- style: TextStyle(fontSize: 11.5, color: AppPalette.textSecondary),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
],
),
@@ -505,10 +504,7 @@ class _ProvidersHeading extends StatelessWidget {
// panel impossible to read.
'${overview.enabledCount} enabled'
'${hasFigures ? ' · ${overview.dataProviderCount} with data' : ''}',
- style: TextStyle(
- fontSize: 11.5,
- color: AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: AppPalette.textSecondary),
),
],
),
@@ -517,7 +513,7 @@ class _ProvidersHeading extends StatelessWidget {
Text(
'${overview.sessionCount} '
'${overview.sessionCount == 1 ? 'session' : 'sessions'}',
- style: TextStyle(fontSize: 11.5, color: AppPalette.textFaint),
+ style: terminalTextStyle(color: AppPalette.textFaint),
),
],
);
diff --git a/desktop/lib/settings/settings_nav.dart b/desktop/lib/settings/settings_nav.dart
index 45cea37c9..5c0667100 100644
--- a/desktop/lib/settings/settings_nav.dart
+++ b/desktop/lib/settings/settings_nav.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/layouts/widgets/rail_section_header.dart';
import '../shared/layouts/widgets/sidebar_item.dart';
@@ -226,7 +227,7 @@ class _NoMatches extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(10, 16, 10, 0),
child: Text(
'No settings match',
- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 12.5),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
);
}
diff --git a/desktop/lib/shared/layouts/widgets/rail_section_header.dart b/desktop/lib/shared/layouts/widgets/rail_section_header.dart
index a33b01181..8ca8b0fd6 100644
--- a/desktop/lib/shared/layouts/widgets/rail_section_header.dart
+++ b/desktop/lib/shared/layouts/widgets/rail_section_header.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../theme/app_theme.dart';
@@ -39,9 +40,8 @@ class RailSectionHeader extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
label,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppPalette.textFaint,
- fontSize: 11,
fontWeight: AppFont.medium,
letterSpacing: 0.2,
),
diff --git a/desktop/lib/shared/layouts/widgets/sidebar_item.dart b/desktop/lib/shared/layouts/widgets/sidebar_item.dart
index 4266eff3f..be3f9ae66 100644
--- a/desktop/lib/shared/layouts/widgets/sidebar_item.dart
+++ b/desktop/lib/shared/layouts/widgets/sidebar_item.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../theme/app_theme.dart';
import '../../widgets/scroll_reveal_text.dart';
@@ -221,6 +222,7 @@ class _SidebarRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
const radius = BorderRadius.all(Radius.circular(8));
// 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
@@ -392,17 +394,19 @@ class _RowLabel extends StatelessWidget {
/// keeps every row's text on the same baseline whatever font falls out of the
/// fallback chain, and a travelling label that dropped it would jump a pixel
/// as the pointer landed.
- static const _strut = StrutStyle(
- fontSize: 13.5,
+ static StrutStyle get _strut => StrutStyle(
+ fontSize: terminalFontStore.size,
+ fontFamily: terminalFontStore.value.fontFamily,
+ fontFamilyFallback: terminalFontStore.value.fontFamilyFallback,
height: 1.25,
forceStrutHeight: true,
);
@override
Widget build(BuildContext context) {
- final style = TextStyle(
+ TerminalFontScope.watch(context);
+ final style = terminalTextStyle(
color: ink,
- fontSize: 13.7,
height: 1.25,
fontWeight: strong ? AppFont.medium : FontWeight.w400,
);
@@ -454,6 +458,7 @@ class _RowIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
// A row's icon carries the accent whenever the row stands out — the selected
// nav item and the emphasized action (New chat) both — so the accent reads
// as "this is the one", matching the selected row's rail. Everything else
@@ -495,28 +500,31 @@ class _SelectionRail extends StatelessWidget {
final double select;
@override
- Widget build(BuildContext context) => 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),
+ Widget build(BuildContext context) {
+ TerminalFontScope.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),
+ ),
),
),
),
),
- ),
- );
+ );
+ }
}
/// A quiet section label above a group of [SidebarItem]s ("Chats", "Workspace").
@@ -587,9 +595,8 @@ class _SidebarSectionLabelState extends State<SidebarSectionLabel> {
widget.label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: ink,
- fontSize: 11.2,
fontWeight: AppFont.medium,
letterSpacing: 0,
),
diff --git a/desktop/lib/shared/layouts/widgets/sidebar_show_more.dart b/desktop/lib/shared/layouts/widgets/sidebar_show_more.dart
index f97b152e3..3e7784f7b 100644
--- a/desktop/lib/shared/layouts/widgets/sidebar_show_more.dart
+++ b/desktop/lib/shared/layouts/widgets/sidebar_show_more.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../theme/app_theme.dart';
import 'sidebar_item.dart';
@@ -148,9 +149,8 @@ class _SidebarShowMoreState extends State<SidebarShowMore> {
),
child: Text(
'Show more',
- style: TextStyle(
+ style: terminalTextStyle(
color: ink,
- fontSize: 12.5,
fontWeight: AppFont.medium,
),
),
diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dart
index 9eca2d93e..3f666b4f5 100644
--- a/desktop/lib/shared/theme/app_theme.dart
+++ b/desktop/lib/shared/theme/app_theme.dart
@@ -1,6 +1,7 @@
-import '../../core/apple_fonts.dart';
+import '../../terminal/terminal_typography.dart';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import 'color_palette.dart';
@@ -16,12 +17,6 @@ abstract final class AppTheme {
Brightness.dark,
);
- /// Fires when the user's type settings change. Separate from [brightness]
- /// because the two are independent — a theme flip must not restyle type, and
- /// changing the font must not repaint as though the palette moved — but read
- /// through the same [watch], since a widget that reads one token generally
- /// reads both.
- static final FontNotifier fonts = FontNotifier();
static final palette = ValueNotifier(HarnessPalette.graphite);
static bool get isDark => brightness.value == Brightness.dark;
@@ -75,44 +70,20 @@ abstract final class AppTheme {
/// when the notifier fires — it doesn't rebuild through the widget tree — so
/// every `const` boundary in between is irrelevant. This is exactly how
/// `Theme.of(context)` makes a widget follow the theme.
- /// It also registers for type changes, via [_FontScope]. The two travel
+ /// It also registers for type changes, via [TerminalFontScope]. The two travel
/// together deliberately: `AppTheme.watch(context)` is the one line a widget
/// adds to follow the app's appearance, and splitting it into two calls would
/// mean every widget that already follows the theme still silently ignores the
/// font — with the exact same symptom (stuck on the value it first built with)
/// that this method exists to fix.
static Brightness watch(BuildContext context) {
+ TerminalFontScope.watch(context);
context.dependOnInheritedWidgetOfExactType<_BrightnessScope>();
- context.dependOnInheritedWidgetOfExactType<_FontScope>();
context.dependOnInheritedWidgetOfExactType<_PaletteScope>();
return brightness.value;
}
}
-/// Fires when [AppFont]'s user settings change.
-///
-/// It carries no value: the settings live on [AppFont] as statics, because a
-/// token read like `AppFont.mono` has no context to look one up with. This is
-/// only the signal that they moved.
-class FontNotifier extends ChangeNotifier {
- /// Push new settings onto [AppFont] and notify, but only if they differ —
- /// setting the same font twice must not dirty the tree.
- void apply({
- String? uiFamily,
- String? codeFamily,
- required double uiScale,
- required double codeSize,
- }) {
- final changed = AppFont.apply(
- uiFamily: uiFamily,
- codeFamily: codeFamily,
- uiScale: uiScale,
- codeSize: codeSize,
- );
- if (changed) notifyListeners();
- }
-}
-
/// The brightness global, with one extra power: it can be moved *silently*.
///
/// [AppTheme.as] swaps the brightness to read the other palette and swaps it
@@ -160,10 +131,9 @@ class BrightnessScope extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return _BrightnessScope(
- notifier: AppTheme.brightness,
- child: _FontScope(
- notifier: AppTheme.fonts,
+ return TerminalFontScope(
+ child: _BrightnessScope(
+ notifier: AppTheme.brightness,
child: _PaletteScope(notifier: AppTheme.palette, child: child),
),
);
@@ -174,10 +144,6 @@ class _BrightnessScope extends InheritedNotifier<ValueNotifier<Brightness>> {
const _BrightnessScope({required super.notifier, required super.child});
}
-class _FontScope extends InheritedNotifier<FontNotifier> {
- const _FontScope({required super.notifier, required super.child});
-}
-
class _PaletteScope extends InheritedNotifier<ValueNotifier<HarnessPalette>> {
const _PaletteScope({required super.notifier, required super.child});
}
@@ -971,7 +937,7 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
// Also stated at ThemeData level, not only inside the ramp: Material builds
// text of its own (a dialog's semantics label, a field's error line) that
// never passes through `textTheme`, and without this those fall through to
- // Roboto — one stray face in an app drawn entirely in San Francisco.
+ // Roboto instead of the selected terminal font.
fontFamily: AppFont.sans,
fontFamilyFallback: AppFont.sansFallback,
scaffoldBackgroundColor: scheme.surface,
@@ -1067,15 +1033,8 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
),
],
),
- // A step under the control font: a tooltip is read *while* looking at the
- // thing it explains, so it should not compete with it. The line height is
- // for the long ones — a run of selections is several lines of quoted code,
- // and set solid it reads as a wall.
- textStyle: TextStyle(
- fontSize: 12.5,
- height: 1.45,
- color: scheme.onSurface,
- ),
+ // Tooltips keep the same font and size, with room for multiline text.
+ textStyle: terminalTextStyle(height: 1.45, color: scheme.onSurface),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
// Long quoted lines would otherwise take the tooltip out to the window's
// full width — a panel wider than the conversation it is explaining.
@@ -1125,8 +1084,8 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
isDense: true,
filled: true,
fillColor: scheme.surfaceContainerHighest,
- // A field is a control, so its hint takes the control font — 13pt, the
- // same as the button beside it. (The typed text is set on the field via
+ // A field hint uses the selected terminal font and size, like its button.
+ // (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.)
hintStyle: _fieldTextStyle(
@@ -1148,9 +1107,7 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
contentPadding: EdgeInsets.symmetric(
horizontal: 10,
vertical:
- (AppControl.heightFieldScaled -
- AppControl.fontSize * 1.35 * AppFont.uiScale) /
- 2,
+ (AppControl.heightFieldScaled - AppControl.fontSize * 1.35) / 2,
),
// The glyph sits on the text's line, not in a tap target of its own. A
// step above [AppControl.iconSize]: that size is tuned to a button's cap
@@ -1231,9 +1188,8 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
width: 520,
// A snackbar floats over everything, so it takes the panel fill.
backgroundColor: panelFill,
- contentTextStyle: TextStyle(
+ contentTextStyle: terminalTextStyle(
color: scheme.onSurface,
- fontSize: 13.5,
fontWeight: FontWeight.w600,
),
actionTextColor: AppPalette.accent,
@@ -1298,20 +1254,15 @@ abstract final class AppControl {
/// [anchoredMenuPosition] clamps to this by default.
static const double menuMaxHeight = 240;
- /// The label. 13pt medium is the macOS control font — Apple sets a push
- /// button's label at medium, not semibold; at 13pt the extra step reads as a
- /// button trying to be a heading.
- static const double fontSize = 13;
+ /// Button labels use the same selected point size as every other surface.
+ static double get fontSize => terminalFontStore.size;
static const FontWeight fontWeight = AppFont.medium;
/// A leading glyph inside a button, sized to sit on the cap height of a 13pt
/// label rather than tower over it.
static const double iconSize = 16;
- /// The glyph on a chip — an inline affordance whose label runs smaller than a
- /// button's (11pt, not 13). [iconSize] is cut to a 13pt cap height and towers
- /// over an 11pt one, so a chip needs its own step down rather than a number
- /// picked by eye at each call site.
+ /// A compact glyph for an inline chip; its text keeps the shared font size.
static const double iconSizeChip = 13;
/// Horizontal breathing room. Apple pads a push button generously sideways and
@@ -1360,10 +1311,7 @@ abstract final class AppControl {
static EdgeInsets get paddingSmallScaled =>
EdgeInsets.symmetric(horizontal: 10 * AppFont.uiScale);
- // [fontSize] deliberately has no scaled twin. The label inside a button is a
- // `Text`, so `MediaQuery`'s text scaler already grows it — scaling the
- // theme's `textStyle` too would apply the user's setting twice, and a button
- // set to 19px would render at ~26. The boxes above scale; the type does not.
+ // Text already uses the selected point size. Only control geometry scales.
}
/// How long the app's UI takes to change, and on what curve.
@@ -1420,125 +1368,17 @@ abstract final class AppMotion {
static const Curve curve = Curves.easeOut;
}
-/// The app's two font stacks, and the rule for which one a given piece of text
-/// gets.
-///
-/// The rule: **mono is for strings the user copies, not for strings they read.**
-/// A model id, an endpoint, a token — those need `l`/`1`/`I` and `0`/`O` to stay
-/// apart, because the user is going to paste them somewhere that cares. Prose
-/// (a heading, a subtitle, a node's name) is *read*, and mono makes reading it
-/// slower while making the surface look like a terminal instead of a product.
-///
-/// Numbers are the case that looks like it wants mono but doesn't: what a stat
-/// actually needs is digits that don't reflow when the value changes, and
-/// [tabularFigures] buys exactly that on the sans stack — no terminal costume
-/// required.
+/// Compatibility names for the single Terminal font preference.
abstract final class AppFont {
- /// The reading stack — matches the text theme's system font.
- ///
- /// A getter, not a const: the user can put a family of their own in front of
- /// it from Appearance, and a `const` can't be re-resolved. [sansDefault] is
- /// the shipped value, still a const, and still what everything falls back to.
- static String get sans => _uiFamily ?? sansDefault;
-
- /// The shipped reading face, per platform.
- ///
- /// A getter now, because the shipped value is not one name: nothing in the
- /// Apple stack resolves on Linux, so the app was drawn in the engine's own
- /// default rather than a face anyone chose.
- ///
- /// `Ubuntu Sans` (25.04 and later) and `Ubuntu` (before it) lead because they
- /// are what the desktop itself is set in. Measured on Ubuntu 26.04 they do
- /// not currently resolve either — both are two-axis variable fonts
- /// (`wdth,wght`) and measure identically to a family that does not exist,
- /// while the single-axis `Ubuntu Sans Mono` resolves fine — so today the
- /// effective face is `Noto Sans`, the next entry. They stay in front because
- /// they cost nothing and are the right answer the moment the engine can
- /// reach them; `Noto Sans` and `DejaVu Sans` are what actually carries it.
- static String get sansDefault =>
- hasAppleFonts ? _macSansDefault : _linuxSansDefault;
-
- static const String _macSansDefault = '.AppleSystemUIFont';
- static const String _linuxSansDefault = 'Ubuntu Sans';
-
- /// The fallbacks behind [sans].
- ///
- /// When the user has chosen a family, the *system* font goes to the front of
- /// this list rather than being dropped: a chosen face is usually a display or
- /// text font with a partial repertoire, and one missing glyph should degrade
- /// to SF Pro — the thing the app was drawn in — rather than to Arial or to a
- /// row of tofu boxes.
- static List<String> get sansFallback => _uiFamily == null
- ? _sansFallbackDefault
- : [sansDefault, ..._sansFallbackDefault];
-
- static List<String> get _sansFallbackDefault =>
- hasAppleFonts ? _macSansFallback : _linuxSansFallback;
-
- static const List<String> _macSansFallback = [
- 'SF Pro Text',
- 'Helvetica Neue',
- 'Arial',
- ];
-
- static const List<String> _linuxSansFallback = [
- 'Ubuntu',
- 'Noto Sans',
- 'DejaVu Sans',
- 'sans-serif',
- ];
-
- /// The copy-me stack: SF Mono, the system's own code face.
- ///
- /// The name matters. `'SF Mono'` does **not** resolve — CoreText returns nil
- /// for it, so Flutter quietly falls through to the next entry (that's what the
- /// login screen's `fontFamily: 'SF Mono'` has always done: it renders Menlo).
- /// The face is only reachable under its internal name, below. Verified with
- /// `NSFont(name:size:)` + `CTFontGetBoundingRectsForGlyphs`; a `flutter test`
- /// probe can't confirm this — the headless test font manager resolves every
- /// family to the same test face and reports monospace metrics for all of them.
- ///
- /// Menlo is the fallback, not a compromise: its glyphs measure within 0.01pt
- /// of SF Mono's at 13px. SF Mono leads only for a slashed zero and a tailed
- /// `l`, which is exactly what a model id needs. Avoid Monaco — it lacks a
- /// slashed zero.
- static String get mono => _codeFamily ?? monoDefault;
-
- /// The shipped code face, per platform — same argument as [sansDefault], and
- /// a worse failure when it is wrong: on Linux the whole Apple stack down to
- /// `Courier New` resolved to a PROPORTIONAL face, so anything set in "mono"
- /// was not monospaced at all. The Linux chain is the terminal's own default
- /// (see `lib/terminal/terminal_typography.dart` for why DejaVu leads).
- static String get monoDefault =>
- hasAppleFonts ? _macMonoDefault : _linuxMonoDefault;
-
- static const String _macMonoDefault = '.AppleSystemUIFontMonospaced';
- static const String _linuxMonoDefault = 'DejaVu Sans Mono';
-
- /// The fallbacks behind [mono]. The system's own mono goes in front of them
- /// once a family is chosen, for the reason given on [sansFallback] — and it
- /// matters more here: a code block that falls through to a proportional face
- /// stops being a code block.
- static List<String> get monoFallback => _codeFamily == null
- ? _monoFallbackDefault
- : [monoDefault, ..._monoFallbackDefault];
-
- static List<String> get _monoFallbackDefault =>
- hasAppleFonts ? _macMonoFallback : _linuxMonoFallback;
-
- static const List<String> _macMonoFallback = [
- 'Menlo',
- 'Monaco',
- 'Courier New',
- 'monospace',
- ];
-
- static const List<String> _linuxMonoFallback = [
- 'Ubuntu Sans Mono',
- 'Noto Sans Mono',
- 'Liberation Mono',
- 'monospace',
- ];
+ /// Legacy token names all resolve to the one terminal font preference.
+ static String get sans => terminalFontStore.value.fontFamily;
+ static String get mono => sans;
+ static List<String> get sansFallback =>
+ terminalFontStore.value.fontFamilyFallback;
+ static List<String> get monoFallback => sansFallback;
+ static String get sansDefault => terminalFontFamily;
+ static String get monoDefault => terminalFontFamily;
+ static List<String> get defaultFallback => terminalFontFallback;
/// Digits that hold a fixed width, so a stat doesn't reflow as its value
/// changes and a column of numbers lines up.
@@ -1576,132 +1416,19 @@ abstract final class AppFont {
/// ladder was introduced to fix. Reach for [medium] first.
static const FontWeight semibold = FontWeight.w600;
- /// The tracking a given size wants, in logical pixels.
- ///
- /// SF Pro is an optically-sized family: on Apple's own platforms the system
- /// re-spaces it as it scales, opening the letters up at caption sizes and
- /// pulling them in at display sizes. Flutter asks CoreText for one static
- /// face, so none of that happens for free and every size came out at the
- /// metrics of whatever master got picked — which is why small text read as
- /// cramped and large headings read as one solid mass.
- ///
- /// The curve below follows Apple's own SF Pro tracking table, rounded to the
- /// steps this app actually uses:
- ///
- /// ```
- /// ≥ 28pt -0.4 display / greeting
- /// ≥ 20pt -0.25 screen titles
- /// ≥ 17pt -0.1 section headings
- /// ≥ 15pt 0 body — the neutral point the app was drawn at
- /// ≥ 13pt +0.05 control labels
- /// < 13pt +0.12 captions, chips, meta
- /// ```
- ///
- /// The numbers are small on purpose. Tracking is not a style knob — at half a
- /// pixel it is already the difference between a line that breathes and one
- /// that doesn't, and anything larger starts to look like a logotype.
- static double trackingFor(double size) {
- if (size >= 28) return -0.4;
- if (size >= 20) return -0.25;
- if (size >= 17) return -0.1;
- if (size >= 15) return 0;
- if (size >= 13) return 0.05;
- return 0.12;
- }
-
- // — the user's type settings, mirrored here so a token read resolves them —
- //
- // These are set from one place (`FontSync` in `grid_app.dart`, fed by
- // `fontPrefsProvider`) and read from everywhere, exactly like
- // `AppTheme.brightness`. A widget reading them must call [AppTheme.watch] to
- // be rebuilt when they change — see that method for why a top-down rebuild
- // isn't enough in this app.
-
- static String? _uiFamily;
- static String? _codeFamily;
- static double _uiScale = 1;
- static double _codeSize = _codeSizeDefault;
-
- static const double _codeSizeDefault = 12.5;
-
- /// The UI size the app was DRAWN at, and therefore the denominator of
- /// [uiScale]: a setting of 14 gives a scale of exactly 1, which is the only
- /// value at which every control keeps the geometry this file specifies.
- ///
- /// Public because the settings screen has to divide by it to turn a size the
- /// user picked into the scale [apply] takes, and a second copy of the number
- /// on that side is a second thing to forget.
- static const double uiSizeDefault = 14;
-
- /// What every UI dimension is multiplied by: 1.0 is the size the app was
- /// drawn at.
- static double get uiScale => _uiScale;
+ /// Monospaced characters keep the terminal's natural cell spacing.
+ static double trackingFor(double size) => 0;
- /// The size code is set at, in logical pixels.
- ///
- /// Absolute, not scaled: the UI scale reaches code through `MediaQuery`'s text
- /// scaler like it reaches everything else, so a code surface that also
- /// multiplied by [uiScale] would apply it twice. Code surfaces wrap themselves
- /// in `MediaQuery.withNoTextScaling` and use this number as-is.
- static double get codeSize => _codeSize;
-
- /// Apply the user's type settings. Returns true when something actually
- /// changed, so the caller only fires listeners on a real change.
- static bool apply({
- String? uiFamily,
- String? codeFamily,
- required double uiScale,
- required double codeSize,
- }) {
- if (uiFamily == _uiFamily &&
- codeFamily == _codeFamily &&
- uiScale == _uiScale &&
- codeSize == _codeSize) {
- return false;
- }
- _uiFamily = uiFamily;
- _codeFamily = codeFamily;
- _uiScale = uiScale;
- _codeSize = codeSize;
- return true;
- }
+ /// Geometry scales with the selected terminal font, without scaling text twice.
+ static const double uiSizeDefault = terminalFontSize;
+ static double get uiScale => terminalFontStore.size / terminalFontSize;
+ static double get codeSize => terminalFontStore.size;
- /// The style for a surface made of code — a diff, a log, a code block, a
- /// model id the user is going to paste somewhere.
- ///
- /// Carries the user's code family *and* their code size, so a caller gets
- /// both from one place instead of remembering to read the second. [scale]
- /// is for the few call sites drawn deliberately smaller than body code (a
- /// caption under a block, a chip): it keeps them proportional to the user's
- /// choice rather than pinned to a number that stops matching once the setting
- /// moves.
- ///
- /// Pair this with `MediaQuery.withNoTextScaling` on the surface — see
- /// [codeSize] for why.
static TextStyle codeStyle({
Color? color,
- double scale = 1,
double? height,
FontWeight? fontWeight,
- }) => TextStyle(
- fontFamily: mono,
- fontFamilyFallback: monoFallback,
- fontSize: codeSize * scale,
- color: color,
- height: height,
- fontWeight: fontWeight,
- );
-
- /// Put the type settings back to the shipped defaults.
- ///
- /// For tests: the fields are static, so one test that changes the font would
- /// otherwise leak into every test that runs after it in the same process.
- static void reset() {
- _uiFamily = null;
- _codeFamily = null;
- _uiScale = 1;
- _codeSize = _codeSizeDefault;
- }
+ }) => terminalTextStyle(color: color, height: height, fontWeight: fontWeight);
}
/// A text field's rim at one state. Radius matches [AppControl.radius] so a
@@ -1714,33 +1441,21 @@ OutlineInputBorder _fieldBorder(Color color, {double width = 1}) =>
/// The label style shared by every button, carrying the UI font: a
/// `ButtonStyle.textStyle` does **not** inherit `fontFamily` from the text
-/// theme, so a button that sets only a size silently drops SF Pro.
+/// theme, so a button must receive the shared font explicitly.
///
/// A getter, not a const: it reads [AppFont.sans], which the user can change.
-TextStyle get _buttonTextStyle => TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
- fontSize: AppControl.fontSize,
+TextStyle get _buttonTextStyle => terminalTextStyle(
fontWeight: AppControl.fontWeight,
- // From the same ramp as the text theme, rather than a flat 0: a button's
- // label is 13pt, which is small enough to want its letters opened up.
letterSpacing: AppFont.trackingFor(AppControl.fontSize),
);
-/// A text field's own text: the macOS control font, so a field sits at the same
-/// scale as the button next to it.
-///
-/// Material's default field text is `bodyLarge` — 16pt, sized for a phone. On a
-/// desktop row that puts a visibly larger search box beside a 13pt button.
+/// A text field's own text uses the selected terminal font and size.
/// `InputDecorationTheme` has no `style` slot (it themes the *decoration*, not
/// the editable text), so a field must be handed this explicitly:
/// `TextField(style: kFieldTextStyle, ...)`.
TextStyle get kFieldTextStyle => _fieldTextStyle(AppPalette.textPrimary);
-TextStyle _fieldTextStyle(Color color) => TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
- fontSize: AppControl.fontSize,
+TextStyle _fieldTextStyle(Color color) => terminalTextStyle(
letterSpacing: AppFont.trackingFor(AppControl.fontSize),
color: color,
);
@@ -1830,49 +1545,29 @@ ButtonStyle _textButtonStyle() => TextButton.styleFrom(
);
TextTheme _appTextTheme(Color primary, Color secondary) {
- final base = TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
+ final base = terminalTextStyle(
color: primary,
height: 1.34,
fontWeight: AppFont.regular,
);
- /// One step of the ramp, with its tracking derived from its size.
- TextStyle step(double size, {FontWeight? weight, Color? color}) =>
- base.copyWith(
- fontSize: size,
- fontWeight: weight,
- color: color,
- letterSpacing: AppFont.trackingFor(size),
- );
-
- // The ramp splits along one line: type that *is* a heading keeps semibold,
- // type that merely names a control drops to medium.
- //
- // Large sizes carry weight optically — 25pt at semibold is already emphatic,
- // and taking it to medium would leave a screen title reading as body copy that
- // happens to be big. Small sizes are the opposite: at 12–14pt semibold turns
- // into ink rather than emphasis, and it was on *every* label, so nothing was
- // emphasised relative to anything else.
+ final heading = base.copyWith(fontWeight: AppFont.semibold);
+ final label = base.copyWith(fontWeight: AppFont.medium);
return TextTheme(
- displayLarge: step(57, weight: AppFont.semibold),
- displayMedium: step(45, weight: AppFont.semibold),
- displaySmall: step(36, weight: AppFont.semibold),
- headlineLarge: step(32, weight: AppFont.semibold),
- headlineMedium: step(29, weight: AppFont.semibold),
- headlineSmall: step(25, weight: AppFont.semibold),
- titleLarge: step(22, weight: AppFont.semibold),
- titleMedium: step(17, weight: AppFont.semibold),
- // 14.5 is where a "title" stops out-ranking anything and becomes a row
- // label, so this is the first step down.
- titleSmall: step(14.5, weight: AppFont.medium),
- bodyLarge: step(16.5),
- bodyMedium: step(15),
- bodySmall: step(13.5, color: secondary),
- // Every `label*` names a control. Medium, like the controls themselves.
- labelLarge: step(14.5, weight: AppFont.medium),
- labelMedium: step(13, weight: AppFont.medium),
- labelSmall: step(12, weight: AppFont.medium),
+ displayLarge: heading,
+ displayMedium: heading,
+ displaySmall: heading,
+ headlineLarge: heading,
+ headlineMedium: heading,
+ headlineSmall: heading,
+ titleLarge: heading,
+ titleMedium: heading,
+ titleSmall: label,
+ bodyLarge: base,
+ bodyMedium: base,
+ bodySmall: base.copyWith(color: secondary),
+ labelLarge: label,
+ labelMedium: label,
+ labelSmall: label,
);
}
diff --git a/desktop/lib/shared/theme/appearance_prefs_store.dart b/desktop/lib/shared/theme/appearance_prefs_store.dart
index 2f5ed773b..eaac0214a 100644
--- a/desktop/lib/shared/theme/appearance_prefs_store.dart
+++ b/desktop/lib/shared/theme/appearance_prefs_store.dart
@@ -4,19 +4,13 @@ import 'package:flutter/foundation.dart';
import '../../core/harness_file_store.dart';
import '../../core/local_key_value_store.dart';
-import 'app_theme.dart';
import 'color_palette.dart';
import 'harness_background.dart';
import 'prompt_style.dart';
-/// The app's coordinated palette and UI typography on this computer.
-///
-/// This does not change the terminal's type. The terminal renders a grid a remote
-/// program draws into, so it keeps its own face and its own size in
-/// [TerminalFontStore], reached from Customize Harness ▸ Terminal — and the app's UI
-/// scale is fenced out of it at five seams (see the notes in
-/// `terminal_panel.dart` and `terminal_composer.dart`, and the regression test
-/// in `test/terminal_ui_scale_isolation_test.dart`).
+/// Palette, background, and prompt preferences on this computer.
+/// Legacy UI font fields remain readable for older builds; current typography
+/// is controlled only by TerminalFontStore.
@immutable
class AppearancePrefs {
const AppearancePrefs({
@@ -31,25 +25,11 @@ class AppearancePrefs {
final HarnessPalette palette;
final HarnessBackground background;
- /// The face the app's chrome is set in. `null` means the system font, which is
- /// what [AppFont.sans] falls back to.
- ///
- /// Never the empty string. CoreText resolves `''` to nothing at all and the
- /// text simply disappears, so "use the system font" is represented by the
- /// absence of a value at every layer — here, and as a deleted key on disk.
+ /// Legacy fields, retained for settings compatibility with older builds.
final String? uiFamily;
-
- /// The base size everything else is measured against, in logical pixels.
final double uiSize;
+ static const double uiSizeDefault = 14;
- /// The size the app was drawn at. [AppFont.uiScale] is this over that, so at
- /// 14 the scale is exactly 1 and every control keeps the geometry the design
- /// system specifies.
- static const double uiSizeDefault = AppFont.uiSizeDefault;
-
- /// ⚠️ Not a matter of taste. A control here is a fixed-height box built for a
- /// 13pt label — [AppControl.height] 32, [AppControl.heightField] 36 — and past
- /// roughly ±35% the label stops fitting the box it sits in.
static const double uiSizeMin = 11;
static const double uiSizeMax = 19;
diff --git a/desktop/lib/shared/widgets/app_choice_picker.dart b/desktop/lib/shared/widgets/app_choice_picker.dart
index a03798652..bdaabc344 100644
--- a/desktop/lib/shared/widgets/app_choice_picker.dart
+++ b/desktop/lib/shared/widgets/app_choice_picker.dart
@@ -1,6 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../theme/app_theme.dart';
import 'app_select_field.dart';
@@ -140,16 +141,8 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
if (widget.tileSize != null) return _tileChoices();
final candidates = _visibleOptions;
if (candidates.isEmpty) return const SizedBox.shrink();
- final textStyle = TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
- fontSize: 13,
- fontWeight: FontWeight.w500,
- );
- final detailStyle = textStyle.copyWith(
- fontSize: 12,
- fontWeight: FontWeight.w400,
- );
+ final textStyle = terminalTextStyle(fontWeight: FontWeight.w500);
+ final detailStyle = textStyle.copyWith(fontWeight: FontWeight.w400);
final height = widget.showDetails
? (widget.compact ? 52.0 : 58.0)
: (widget.compact ? 40.0 : 44.0);
@@ -455,54 +448,57 @@ class AppChoiceTile extends StatelessWidget {
final bool terminalStyle;
@override
- Widget build(BuildContext context) => SizedBox(
- width: size.width,
- height: size.height,
- child: Semantics(
- selected: selected,
- inMutuallyExclusiveGroup: true,
- child: TextButton(
- focusNode: focusNode,
- onPressed: onPressed,
- style:
- TextButton.styleFrom(
- foregroundColor: AppPalette.textPrimary,
- backgroundColor: selected
- ? AppPalette.swarmAccent.withValues(alpha: .16)
- : terminalStyle
- ? Colors.transparent
- : AppSurface.recess,
- padding: terminalStyle ? terminalPadding : padding,
- textStyle: terminalStyle
- ? DefaultTextStyle.of(context).style
- : null,
- minimumSize: terminalStyle ? Size.zero : null,
- tapTargetSize: terminalStyle
- ? MaterialTapTargetSize.shrinkWrap
- : null,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(
- terminalStyle ? 2 : AppControl.radius,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return SizedBox(
+ width: size.width,
+ height: size.height,
+ child: Semantics(
+ selected: selected,
+ inMutuallyExclusiveGroup: true,
+ child: TextButton(
+ focusNode: focusNode,
+ onPressed: onPressed,
+ style:
+ TextButton.styleFrom(
+ foregroundColor: AppPalette.textPrimary,
+ backgroundColor: selected
+ ? AppPalette.swarmAccent.withValues(alpha: .16)
+ : terminalStyle
+ ? Colors.transparent
+ : AppSurface.recess,
+ padding: terminalStyle ? terminalPadding : padding,
+ textStyle: terminalStyle
+ ? DefaultTextStyle.of(context).style
+ : null,
+ minimumSize: terminalStyle ? Size.zero : null,
+ tapTargetSize: terminalStyle
+ ? MaterialTapTargetSize.shrinkWrap
+ : null,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(
+ terminalStyle ? 2 : AppControl.radius,
+ ),
),
- ),
- ).copyWith(
- side: WidgetStateProperty.resolveWith(
- (states) => BorderSide(
- color: selected && !terminalStyle
- ? AppPalette.swarmAccent.withValues(alpha: .7)
- : Colors.transparent,
+ ).copyWith(
+ side: WidgetStateProperty.resolveWith(
+ (states) => BorderSide(
+ color: selected && !terminalStyle
+ ? AppPalette.swarmAccent.withValues(alpha: .7)
+ : Colors.transparent,
+ ),
),
),
- ),
- child: AppChoiceTileContent(
- terminalStyle: terminalStyle,
- label: label,
- detail: detail,
- leading: terminalStyle ? Text(selected ? '>' : ' ') : leading,
+ child: AppChoiceTileContent(
+ terminalStyle: terminalStyle,
+ label: label,
+ detail: detail,
+ leading: terminalStyle ? Text(selected ? '>' : ' ') : leading,
+ ),
),
),
- ),
- );
+ );
+ }
}
class AppChoiceTileContent extends StatelessWidget {
@@ -522,8 +518,8 @@ class AppChoiceTileContent extends StatelessWidget {
/// The name's type, and the detail's under it. Written down because the tile
/// height is arithmetic over exactly these numbers — see [linesFor] and the
/// New Harness dialog's `tileSize`.
- static const double labelSize = 16;
- static const double detailSize = 14;
+ static double get labelSize => terminalFontStore.size;
+ static double get detailSize => terminalFontStore.size;
static const double lineHeight = 1.25;
static const double lineGap = 4;
@@ -562,9 +558,9 @@ class AppChoiceTileContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
if (terminalStyle) {
final style = DefaultTextStyle.of(context).style.copyWith(
- fontSize: 13,
height: 1.35,
fontWeight: FontWeight.w400,
color: AppPalette.textPrimary,
@@ -593,10 +589,7 @@ class AppChoiceTileContent extends StatelessWidget {
detail!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: style.copyWith(
- fontSize: 12,
- color: AppPalette.textSecondary,
- ),
+ style: style.copyWith(color: AppPalette.textSecondary),
),
),
],
@@ -608,10 +601,7 @@ class AppChoiceTileContent extends StatelessWidget {
),
);
}
- final labelStyle = TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
- fontSize: labelSize,
+ final labelStyle = terminalTextStyle(
height: lineHeight,
fontWeight: AppFont.medium,
color: AppPalette.textPrimary,
@@ -656,10 +646,7 @@ class AppChoiceTileContent extends StatelessWidget {
detail!,
maxLines: lines.detail,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
- fontSize: detailSize,
+ style: terminalTextStyle(
height: lineHeight,
color: AppPalette.textSecondary,
),
diff --git a/desktop/lib/shared/widgets/app_menu.dart b/desktop/lib/shared/widgets/app_menu.dart
index 732893f87..f93e7e880 100644
--- a/desktop/lib/shared/widgets/app_menu.dart
+++ b/desktop/lib/shared/widgets/app_menu.dart
@@ -1,51 +1,30 @@
+import 'dart:math' as math;
+
+import 'package:harness/terminal/terminal_text.dart';
+
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../theme/app_theme.dart';
-/// The measurements one [AppMenuItem] is built from.
-///
-/// TWO sizes exist in this app, deliberately, and the distinction is worth
-/// stating because two sizes is otherwise exactly the drift this file was
-/// written to end:
-///
-/// [compact] — a CONTEXT menu. A short list of actions on the thing you just
-/// right-clicked or pressed ⋯ on: the machine and agent menus, the account
-/// menu. macOS sets these tight, and they are read in a glance.
-///
-/// [roomy] — a PICKER's list. The menu IS the control: it is the only place
-/// the choices are ever shown, it is read down rather than glanced at, and it
-/// is often long enough to scroll. macOS gives a popup button's list more room
-/// than a context menu for the same reason.
-///
-/// A third size would be drift. Reach for one of these two.
+/// Menus share the terminal typography. Compact and roomy variants only
+/// change padding and icon spacing.
@immutable
class AppMenuRowMetrics {
- const AppMenuRowMetrics({
- required this.fontSize,
- required this.noteSize,
- required this.iconSize,
- required this.padding,
- required this.extent,
- });
+ const AppMenuRowMetrics({required this.iconSize, required this.padding});
- final double fontSize;
- final double noteSize;
+ double get fontSize => terminalFontStore.size;
+ double get noteSize => terminalFontStore.size;
final double iconSize;
final EdgeInsets padding;
- /// The height a row of this size actually lays out at.
- ///
- /// ⚠️ MEASURED, not derived, and the difference has already cost a bug. Adding
- /// the paddings up for [compact] gives 33.6; a laid-out row measures 34.0,
- /// because the line box rounds up to the font's own metrics rather than taking
- /// `fontSize × height` literally. Over seven rows that 0.4 became 2.8 — enough
- /// to overflow a panel sized from the arithmetic and hang a scrollbar on it.
- ///
- /// `app_select_field_test.dart` measures a real row against this to 0.1, so a
- /// padding that moves without this moving fails a test rather than quietly
- /// mis-sizing every panel.
- final double extent;
+ /// Round line metrics up before adding padding, so panels reserve enough
+ /// room at every supported terminal size. The extra two pixels are the row
+ /// border; app_select_field_test checks the result against actual layout.
+ double get extent =>
+ math.max(iconSize, (fontSize * 1.2).ceilToDouble()) +
+ padding.vertical +
+ 2;
/// What a row with a [AppMenuItem.detail] line lays out at instead.
///
@@ -54,46 +33,29 @@ class AppMenuRowMetrics {
/// Stated rather than derived at the call site for the same reason [extent]
/// is: a panel sized by arithmetic that disagrees with the layout by half a
/// pixel per row wears a scrollbar it does not need.
- double get detailExtent => extent + noteSize * 1.25 + 2;
+ double get detailExtent =>
+ math.max(
+ iconSize,
+ (fontSize * 1.2).ceilToDouble() + (noteSize * 1.25).ceilToDouble() + 2,
+ ) +
+ padding.vertical +
+ 2;
/// A context menu's row: the macOS control scale.
static const compact = AppMenuRowMetrics(
- fontSize: 13,
- noteSize: 11.5,
iconSize: 16,
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 8),
- extent: 34,
);
- /// A picker's row — one step up on every axis at once, which is the only way
- /// to change a platform convention without breaking the proportions inside it.
+ /// A picker's row has more padding, with the same font as a context menu.
static const roomy = AppMenuRowMetrics(
- fontSize: 14,
- noteSize: 12.5,
iconSize: 18,
padding: EdgeInsets.symmetric(horizontal: 11, vertical: 10),
- extent: 40,
);
}
-/// The height one [AppMenuItem] occupies.
-///
-/// Stated so a caller that has to SIZE a panel — see [AppSelectField] — can do
-/// the arithmetic up front instead of discovering at runtime that its list
-/// overflows by a few pixels and wears a scrollbar for no reason.
-///
-/// ⚠️ MEASURED, not derived, and the difference matters. Adding the paddings up
-///
-/// outer 1 × 2 = 2 · inner 8 × 2 = 16 · line 13 × 1.2 = 15.6 → 33.6
-///
-/// gives 33.6, which is WRONG: a laid-out row measures 34.0, because the line
-/// box rounds up to the font's own metrics rather than taking `fontSize ×
-/// height` literally. Over seven rows that 0.4 becomes 2.8 — the width of the
-/// mistake that put a scrollbar on the engine picker in the first place.
-///
-/// `app_select_field_test.dart` measures a real row against this to 0.1, so if
-/// a padding moves and this does not, a test says so.
-const double kMenuRowExtent = 34.0;
+/// Shared by menu rows and pickers that reserve space before laying them out.
+double get kMenuRowExtent => AppMenuRowMetrics.compact.extent;
// (kept as the compact row's extent; see AppMenuRowMetrics.compact.extent)
/// One row in an [AppMenu] panel.
@@ -265,14 +227,8 @@ class _AppMenuItemState extends State<AppMenuItem> {
widget.label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: widget.danger ? error : AppPalette.textPrimary,
- fontFamily:
- widget.textStyle?.fontFamily ?? AppFont.sans,
- fontFamilyFallback:
- widget.textStyle?.fontFamilyFallback ??
- AppFont.sansFallback,
- fontSize: widget.metrics.fontSize,
height: 1.2,
fontWeight: widget.selected
? AppFont.semibold
@@ -285,14 +241,8 @@ class _AppMenuItemState extends State<AppMenuItem> {
detail,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppPalette.textSecondary,
- fontFamily:
- widget.textStyle?.fontFamily ?? AppFont.sans,
- fontFamilyFallback:
- widget.textStyle?.fontFamilyFallback ??
- AppFont.sansFallback,
- fontSize: widget.metrics.noteSize,
height: 1.25,
),
),
@@ -307,14 +257,8 @@ class _AppMenuItemState extends State<AppMenuItem> {
widget.note!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppPalette.textFaint,
- fontFamily:
- widget.textStyle?.fontFamily ?? AppFont.sans,
- fontFamilyFallback:
- widget.textStyle?.fontFamilyFallback ??
- AppFont.sansFallback,
- fontSize: widget.metrics.noteSize,
height: 1.2,
),
),
diff --git a/desktop/lib/shared/widgets/app_select_field.dart b/desktop/lib/shared/widgets/app_select_field.dart
index 81ed43b38..2bb69b011 100644
--- a/desktop/lib/shared/widgets/app_select_field.dart
+++ b/desktop/lib/shared/widgets/app_select_field.dart
@@ -2,6 +2,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../theme/app_theme.dart';
import 'app_menu.dart';
@@ -660,11 +661,7 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {
overflow: TextOverflow.ellipsis,
style:
widget.textStyle ??
- TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback:
- AppFont.sansFallback,
- fontSize: AppControl.fontSize,
+ terminalTextStyle(
fontWeight: AppControl.fontWeight,
letterSpacing: AppFont.trackingFor(
AppControl.fontSize,
@@ -680,11 +677,7 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {
current!.note!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback:
- AppFont.sansFallback,
- fontSize: 11.5,
+ style: terminalTextStyle(
color: AppPalette.textFaint,
),
),
diff --git a/desktop/lib/shared/widgets/command_row.dart b/desktop/lib/shared/widgets/command_row.dart
index d75db9803..62a1ce12d 100644
--- a/desktop/lib/shared/widgets/command_row.dart
+++ b/desktop/lib/shared/widgets/command_row.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../theme/app_theme.dart';
import '../theme/app_theme.dart' as grid;
@@ -20,6 +21,7 @@ class CommandRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return InkWell(
onTap: onCopy,
borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),
@@ -37,11 +39,7 @@ class CommandRow extends StatelessWidget {
Expanded(
child: SelectableText(
command,
- style: TextStyle(
- color: AppColors.text,
- fontFamily: AppFonts.mono,
- fontSize: 13,
- ),
+ style: terminalTextStyle(color: AppColors.text),
),
),
Icon(
diff --git a/desktop/lib/shared/widgets/empty_state.dart b/desktop/lib/shared/widgets/empty_state.dart
index cf50eb9f9..4fda07c24 100644
--- a/desktop/lib/shared/widgets/empty_state.dart
+++ b/desktop/lib/shared/widgets/empty_state.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../theme/app_theme.dart';
@@ -58,9 +59,8 @@ class EmptyState extends StatelessWidget {
Text(
title,
textAlign: TextAlign.center,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppPalette.textPrimary,
- fontSize: compact ? 13 : 14.5,
fontWeight: FontWeight.w600,
),
),
@@ -71,9 +71,8 @@ class EmptyState extends StatelessWidget {
child: Text(
message!,
textAlign: TextAlign.center,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppPalette.textSecondary,
- fontSize: compact ? 12 : 13,
height: 1.4,
),
),
diff --git a/desktop/lib/shared/widgets/section_heading.dart b/desktop/lib/shared/widgets/section_heading.dart
index fd1886c75..529a5a879 100644
--- a/desktop/lib/shared/widgets/section_heading.dart
+++ b/desktop/lib/shared/widgets/section_heading.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../theme/app_theme.dart';
@@ -33,11 +34,8 @@ class SectionHeading extends StatelessWidget {
children: [
Text(
title,
- style: TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
+ style: terminalTextStyle(
color: AppPalette.textPrimary,
- fontSize: 19,
fontWeight: AppFont.semibold,
letterSpacing: -0.2,
height: 1.2,
diff --git a/desktop/lib/shared/widgets/skeleton.dart b/desktop/lib/shared/widgets/skeleton.dart
index 1cc3eb164..62e3fe8c1 100644
--- a/desktop/lib/shared/widgets/skeleton.dart
+++ b/desktop/lib/shared/widgets/skeleton.dart
@@ -168,7 +168,9 @@ class SkeletonText extends StatelessWidget {
AppTheme.watch(context);
final height = lineHeight(context, style, strutStyle: strutStyle);
final fontSize =
- style.fontSize ?? DefaultTextStyle.of(context).style.fontSize ?? 14;
+ style.fontSize ??
+ DefaultTextStyle.of(context).style.fontSize ??
+ AppControl.fontSize;
final bar = barHeight ?? (fontSize * 0.72).roundToDouble().clamp(6.0, 16.0);
Widget line = Skeleton.text(width: width, height: bar);
if (width == null) {
diff --git a/desktop/lib/sharing/share_harness_dialog.dart b/desktop/lib/sharing/share_harness_dialog.dart
index 65bc9751e..b825462f8 100644
--- a/desktop/lib/sharing/share_harness_dialog.dart
+++ b/desktop/lib/sharing/share_harness_dialog.dart
@@ -1,6 +1,9 @@
import 'dart:async';
+import '../shared/widgets/labeled_field.dart';
+
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
@@ -205,6 +208,7 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {
style: TextStyle(color: grid.AppPalette.textSecondary),
),
const SizedBox(height: 22),
+ const FieldLabel('Add people by email'),
TextField(
controller: _emails,
autofocus: true,
@@ -213,7 +217,6 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {
maxLines: 2,
minLines: 1,
decoration: const InputDecoration(
- labelText: 'Add people by email',
),
onSubmitted: (_) => _invite(),
@@ -292,10 +295,10 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {
color: grid.AppSurface.recess,
borderRadius: BorderRadius.circular(8),
),
- child: const Text(
+ child: Text(
'They’ll find this harness in Machines → Shared with you using the invited email. '
'Keep your machine online while they watch. You can remove access at any time.',
- style: TextStyle(fontSize: 12, height: 1.5),
+ style: terminalTextStyle(height: 1.5),
),
),
],
@@ -335,15 +338,15 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {
backgroundColor: grid.AppSurface.recess,
child: Text(
email.substring(0, 1).toUpperCase(),
- style: const TextStyle(fontSize: 13),
+ style: terminalTextStyle(),
),
),
title: Text(
email,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 13),
+ style: terminalTextStyle(),
),
- subtitle: Text(subtitle, style: const TextStyle(fontSize: 11)),
+ subtitle: Text(subtitle, style: terminalTextStyle()),
trailing: TextButton(
onPressed: _busy ? null : () => _remove(share['id'] as String),
child: const Text('Remove'),
diff --git a/desktop/lib/sharing/shared_harness_panel.dart b/desktop/lib/sharing/shared_harness_panel.dart
index 352a3943a..fdafc70f5 100644
--- a/desktop/lib/sharing/shared_harness_panel.dart
+++ b/desktop/lib/sharing/shared_harness_panel.dart
@@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:typed_data';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../logging/app_log.dart';
@@ -220,14 +221,11 @@ class _SharedHarnessPanelState extends State<SharedHarnessPanel> {
child: Text(
widget.grant.name,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontWeight: FontWeight.w600,
- fontSize: 13,
- ),
+ style: terminalTextStyle(fontWeight: FontWeight.w600),
),
),
const SizedBox(width: 8),
- const Text('View only', style: TextStyle(fontSize: 11)),
+ Text('View only', style: terminalTextStyle()),
const SizedBox(width: 12),
Tooltip(
message:
@@ -241,8 +239,7 @@ class _SharedHarnessPanelState extends State<SharedHarnessPanel> {
: live
? 'Live'
: 'Reconnecting',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -260,7 +257,7 @@ class _SharedHarnessPanelState extends State<SharedHarnessPanel> {
width: double.infinity,
padding: const EdgeInsets.all(12),
color: grid.AppSurface.recess,
- child: Text(_failure!, style: const TextStyle(fontSize: 12)),
+ child: Text(_failure!, style: terminalTextStyle()),
),
Expanded(
child: LayoutBuilder(
@@ -289,8 +286,7 @@ class _SharedHarnessPanelState extends State<SharedHarnessPanel> {
Text(
_viewerMessage,
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -354,7 +350,7 @@ class _SharedHarnessPanelState extends State<SharedHarnessPanel> {
child: Text(
widget.pane.sharedOwnerName ?? 'Shared harness',
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11),
+ style: terminalTextStyle(),
),
),
const SizedBox(width: 12),
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index d8a564e1c..1989d4c01 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart';
import '../logging/debug_surface.dart';
/// Harness uses Command as a direct prefix for frequent workspace actions.
-/// T opens a tab, P adds a pane, N creates a harness, S opens the Store,
+/// T opens a tab, O opens a harness (also P), N creates a harness, S opens the Store,
/// Shift-L chooses a layout. H/J/K/L and arrows focus panes; B routes a task.
/// The same definitions feed live keys, help and search.
///
diff --git a/desktop/lib/shortcuts/key_cap.dart b/desktop/lib/shortcuts/key_cap.dart
index 220295f88..5bfd1aacd 100644
--- a/desktop/lib/shortcuts/key_cap.dart
+++ b/desktop/lib/shortcuts/key_cap.dart
@@ -1,6 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import 'app_shortcuts.dart';
@@ -62,9 +63,8 @@ class KeyCap extends StatelessWidget {
)
: Text(
label,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 11.5,
height: 1,
// Tabular so ⌘1 – ⌘9 and ⌘W keep the same cap width.
fontFeatures: const [FontFeature.tabularFigures()],
@@ -100,10 +100,7 @@ class KeyChordView extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 2),
child: Text(
'or',
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontSize: 10.5,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
),
for (final key in chords[i]) KeyCap(key),
diff --git a/desktop/lib/shortcuts/keyboard_practice.dart b/desktop/lib/shortcuts/keyboard_practice.dart
index 7aa1fd0d2..a69b7ea4f 100644
--- a/desktop/lib/shortcuts/keyboard_practice.dart
+++ b/desktop/lib/shortcuts/keyboard_practice.dart
@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/harness_file_store.dart';
import '../core/local_key_value_store.dart';
@@ -327,7 +328,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
if (rows.isEmpty) return;
setState(() => _cursor = (_cursor + delta).clamp(0, rows.length - 1));
if (_scroll.hasClients) {
- final height = 54.0 * MediaQuery.textScalerOf(context).scale(13) / 13;
+ final height = 54.0 * terminalTextScaleOf(context);
final top = _cursor * height, bottom = top + height;
final at = _scroll.offset, view = _scroll.position.viewportDimension;
if (top < at || bottom > at + view) {
@@ -481,6 +482,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final lesson = _lesson;
final rows = filtered;
final body = TerminalBox(
@@ -495,17 +497,17 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
spacing: 16,
runSpacing: 6,
children: [
- Text('keyboard practice', style: boxMonoStyle(size: 16)),
+ Text('keyboard practice', style: boxMonoStyle()),
Text(
'${lessons.where((l) => _done.contains(l.id)).length}/${lessons.length} practiced',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
],
),
const SizedBox(height: 8),
Text(
'Practice only · your running agents stay untouched',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
const SizedBox(height: 18),
if (lesson == null) ...[
@@ -536,10 +538,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
: ListView.builder(
controller: _scroll,
shrinkWrap: true,
- itemExtent:
- 54.0 *
- MediaQuery.textScalerOf(context).scale(13) /
- 13,
+ itemExtent: 54.0 * terminalTextScaleOf(context),
itemCount: rows.length,
itemBuilder: (context, i) {
final row = rows[i];
@@ -581,7 +580,6 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: boxMonoStyle(
- size: 11,
color: kBoxFaint,
),
),
@@ -613,7 +611,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
children: [
Text(
'${lesson.group} / ${lesson.label}',
- style: boxMonoStyle(size: 14),
+ style: boxMonoStyle(),
),
const SizedBox(height: 16),
Text(
@@ -622,14 +620,14 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
: lesson.bindings.isEmpty
? 'No shortcut assigned. Find it by name in command search.'
: 'Press ${lesson.keys}',
- style: boxMonoStyle(size: 16),
+ style: boxMonoStyle(),
),
if (!_matched && lesson.bindings.length > 1)
Padding(
padding: const EdgeInsets.only(top: 6),
child: Text(
'Try any of these bindings.',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
if (!_matched && lesson.bindings.isEmpty)
@@ -651,7 +649,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
child: Text(
_matched ? lesson.result : 'scratch workspace\n\n[agent 1] │ [agent 2]\n\n> ready',
key: const ValueKey('practice-preview'),
- style: boxMonoStyle(size: 13),
+ style: boxMonoStyle(),
),
),
if (_feedback != null)
@@ -659,7 +657,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
padding: const EdgeInsets.only(top: 12),
child: Text(
_feedback!,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
if (_matched)
@@ -667,7 +665,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
liveRegion: true,
child: Text(
'Shortcut practiced. Enter continues.',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
],
@@ -684,20 +682,20 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
if (lesson == null)
Text(
'${_hint('picker.accept')} practice ${_hint('picker.previous')}/${_hint('picker.next')} choose',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
if (lesson != null)
TextButton(
onPressed: _next,
child: Text(
_matched ? 'Enter Next' : 'Skip',
- style: boxMonoStyle(size: 12),
+ style: boxMonoStyle(),
),
),
if (lesson != null)
Text(
'pgup/pgdn read',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
TextButton(
key: const ValueKey('practice-back'),
@@ -706,7 +704,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
lesson == null
? '${_hint('picker.cancel')} Close'
: 'esc All shortcuts',
- style: boxMonoStyle(size: 12),
+ style: boxMonoStyle(),
),
),
],
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index 6c880730c..9292ec513 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -285,6 +285,13 @@ final harnessCommands = <HarnessCommand>[
nativeAction: 'findPrevious',
repeatable: true,
),
+ const HarnessCommand(
+ 'agent.open',
+ 'Open Harness',
+ ShortcutGroup.actions,
+ extraKeys: ['cmd+o'],
+ keywords: ['resume', 'existing', 'pane'],
+ ),
const HarnessCommand(
'agent.add',
'New Pane',
diff --git a/desktop/lib/shortcuts/keymap_settings.dart b/desktop/lib/shortcuts/keymap_settings.dart
index 8e3d8d1cd..c37a48faf 100644
--- a/desktop/lib/shortcuts/keymap_settings.dart
+++ b/desktop/lib/shortcuts/keymap_settings.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_select_field.dart';
@@ -36,6 +37,7 @@ class KeymapSettings extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final keymap = KeymapTheme.of(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -49,7 +51,7 @@ class KeymapSettings extends StatelessWidget {
value: contextKind,
// Keep the context readable when the user enlarges text. The
// surrounding Wrap still limits the field to the pane width.
- width: 160 * MediaQuery.textScalerOf(context).scale(13.5) / 13.5,
+ width: 160 * terminalTextScaleOf(context),
options: const [
SelectOption(
value: KeymapContext.workspace,
@@ -82,22 +84,19 @@ class KeymapSettings extends StatelessWidget {
const SizedBox(height: 8),
Text(
'Saves apply automatically. Invalid edits keep your last working shortcuts.',
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 12,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
const SizedBox(height: 4),
SelectableText(
keymap!.path!,
- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 11),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
],
if (keymap?.error != null) ...[
const SizedBox(height: 8),
SelectableText(
keymap!.error!,
- style: const TextStyle(color: Colors.orangeAccent, fontSize: 12),
+ style: terminalTextStyle(color: Colors.orangeAccent),
),
],
const SizedBox(height: 16),
diff --git a/desktop/lib/shortcuts/shortcuts_list.dart b/desktop/lib/shortcuts/shortcuts_list.dart
index ce584005a..53fe8667b 100644
--- a/desktop/lib/shortcuts/shortcuts_list.dart
+++ b/desktop/lib/shortcuts/shortcuts_list.dart
@@ -1,6 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import 'app_shortcuts.dart';
@@ -26,6 +27,7 @@ class ShortcutsList extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final rows = effectiveShortcutRows(context, contextKind);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -88,7 +90,7 @@ class ShortcutsDeck extends StatelessWidget {
final width = math.min(constraints.maxWidth, maxWidth);
// Preserve room for the label as its keycaps grow. Otherwise large
// text keeps three narrow lanes and leaves only a word per line.
- final textScale = MediaQuery.textScalerOf(context).scale(12.5) / 12.5;
+ final textScale = terminalTextScaleOf(context);
final minWidth = minCardWidth * math.max(1.0, textScale);
final columns = ((width + _gap) / (minWidth + _gap)).floor().clamp(
1,
@@ -162,9 +164,8 @@ class _ShortcutCard extends StatelessWidget {
Expanded(child: _CardTitle(title)),
Text(
'${rows.length}',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 10.5,
fontFeatures: const [FontFeature.tabularFigures()],
),
),
@@ -213,9 +214,8 @@ class _TerminalCard extends StatelessWidget {
Expanded(
child: Text(
key.label,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 12.5,
),
),
),
@@ -244,9 +244,8 @@ class _CardTitle extends StatelessWidget {
grid.AppTheme.watch(context);
return Text(
label.toUpperCase(),
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 10.5,
letterSpacing: 0.08 * 10.5,
fontWeight: grid.AppFont.medium,
),
@@ -271,9 +270,8 @@ class ShortcutsNote extends StatelessWidget {
'Harness shortcuts control your workspace. Other input goes to the '
'focused agent, where prompt editing and cancellation follow that '
'coding agent’s behavior.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11.5,
height: 1.5,
),
);
@@ -296,6 +294,7 @@ class _GroupHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Padding(
padding: const EdgeInsets.only(top: 14, bottom: 6),
child: _CardTitle(label),
@@ -335,10 +334,7 @@ class _ShortcutRowView extends StatelessWidget {
Expanded(
child: Text(
row.label,
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 12.5,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
),
const SizedBox(width: _gutter),
@@ -349,9 +345,8 @@ class _ShortcutRowView extends StatelessWidget {
child: row.chords.isEmpty
? Text(
'Unassigned',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 11.5,
),
)
: KeyChordView(chords: row.chords),
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index a09921f4a..48c453e42 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -824,7 +824,7 @@ class AppNotifier extends ChangeNotifier {
await addAgentToSwarm(machineId, agentId, swarmId: activeSwarmId);
}
- // A New Tab remains temporary until it has content or a custom name.
+ // Tabs created for a pending action stay temporary until they have content.
// The return destination is session-local; abandoned drafts are never saved.
final _draftSwarmReturns = <String, String>{};
@@ -846,8 +846,8 @@ class AppNotifier extends ChangeNotifier {
bool newTabPage = false,
}) {
name = Swarm.normalizeName(name);
- // Reuse onboarding for ordinary destinations. Explicit Cmd-T opens a
- // temporary minimal page, removed when the user cancels or leaves it.
+ // Ordinary destinations can reuse an empty tab. Explicit New Tab always
+ // creates its own tab with the same welcome content.
if (name == Swarm.defaultName && !newTabPage) {
final starter = activeSwarm.isEmptyStarter
? activeSwarm
@@ -3066,8 +3066,7 @@ class AppNotifier extends ChangeNotifier {
final updater = _updater;
final staged = await updater.downloadAndStage(info);
if (staged == null) {
- updateError =
- 'Could not download and verify Harness ${info.version}.';
+ updateError = 'Could not download and verify Harness ${info.version}.';
return false;
}
final applied = await updater.applyStaged(staged, selfPid: pid);
diff --git a/desktop/lib/state/first_harness_launch.dart b/desktop/lib/state/first_harness_launch.dart
deleted file mode 100644
index 22fa2cb65..000000000
--- a/desktop/lib/state/first_harness_launch.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-import '../core/local_key_value_store.dart';
-
-/// Remembers that the initial launch prompt was offered or superseded by real
-/// work. Escape is a decision too; reconnecting must never reopen the prompt.
-class FirstHarnessLaunch {
- FirstHarnessLaunch({this.storage});
- final LocalKeyValueStore? storage;
- static const storageKey = 'first_harness_launch_v1';
- bool loaded = false;
- bool handled = false;
- Future<void>? _loading;
- Future<void> _saving = Future.value();
-
- Future<void> load() => _loading ??= _load();
- Future<void> _load() async {
- try {
- handled = await storage?.read(storageKey) == 'handled' || handled;
- } catch (_) {
- // Unavailable preferences never prevent entering the workspace.
- }
- loaded = true;
- }
-
- void handle() {
- if (handled) return;
- handled = true;
- _saving = _saving.then((_) async {
- try {
- await storage?.write(storageKey, 'handled');
- } catch (_) {
- // The decision still holds for this window.
- }
- });
- }
-
- Future<void> flush() => _saving;
-}
diff --git a/desktop/lib/state/new_harness.dart b/desktop/lib/state/new_harness.dart
index 2197b67b1..626f7ae9a 100644
--- a/desktop/lib/state/new_harness.dart
+++ b/desktop/lib/state/new_harness.dart
@@ -203,7 +203,6 @@ class NewHarnessController extends ChangeNotifier {
this.split,
HarnessPlacement? placement,
this.offersStore = false,
- this.firstRun = false,
String? home,
}) : placement =
placement ?? (split == null ? HarnessPlacement.currentTab : null),
@@ -273,11 +272,7 @@ class NewHarnessController extends ChangeNotifier {
);
// What the machine has is asked when the box opens, as the form does: an
// engine installed in a terminal a minute ago is otherwise still "missing".
- if (firstRun) {
- unawaited(_detectInitialAgent(allowSelection: engine == null));
- } else {
- unawaited(app.probeEngines(_machineId, force: true));
- }
+ unawaited(app.probeEngines(_machineId, force: true));
unawaited(app.probeDsh(_machineId, force: true));
unawaited(_ensureHome(_machineId));
unawaited(_refreshGeneratedProject());
@@ -294,11 +289,8 @@ class NewHarnessController extends ChangeNotifier {
? HarnessPlacement.currentTab
: placement;
- final bool firstRun;
final bool _autoProject;
final DateTime Function() _now;
- bool detectingAgent = false;
- bool _agentEdited = false;
final String? _home;
late String _engine;
@@ -323,6 +315,7 @@ class NewHarnessController extends ChangeNotifier {
await _gitFuture;
}
}
+
bool get isGitProject => _gitProject.isGit && !isTerminal;
bool get canUseWorktree => isGitProject && !checkingGit;
bool get worktree => isGitProject && _worktree != false;
@@ -578,29 +571,6 @@ class NewHarnessController extends ChangeNotifier {
String get createLabel => 'Start Harness';
- Future<void> _detectInitialAgent({required bool allowSelection}) async {
- detectingAgent = true;
- final machineId = _machineId;
- await Future.wait([
- app.agentPreference.load(),
- app.probeEngines(machineId, force: true),
- ]);
- if (_disposed) return;
- detectingAgent = false;
- if (allowSelection && !_agentEdited && machineId == _machineId) {
- final installed = [
- for (final identity in allEngines)
- if (_machine?.engines[identity.id]?.installed == true) identity.id,
- ];
- final preferred = app.agentPreference.value;
- final chosen = installed.contains(preferred)
- ? preferred
- : installed.firstOrNull ?? (_known(preferred) ? preferred : null);
- if (chosen != null) _selectEngine(chosen);
- }
- _refresh();
- }
-
String get agentLabel => labelOf(_engine);
String labelOf(String id) => currentHarnessName(
id,
@@ -664,11 +634,6 @@ class NewHarnessController extends ChangeNotifier {
void focusField(NewHarnessField next) {
if (locked || field == next || !_supportsField(next)) return;
- // Discovery may finish while somebody edits. Never change their choice
- // or the rows they are navigating underneath their fingers.
- if (next == NewHarnessField.agent || next == NewHarnessField.machine) {
- _agentEdited = true;
- }
if (next == NewHarnessField.machine) {
_machineOrigin = (
field: field,
@@ -2086,7 +2051,7 @@ class NewHarnessController extends ChangeNotifier {
}
Future<NewHarnessOutcome> create() async {
- if (busy || linkingProfile || detectingAgent) {
+ if (busy || linkingProfile) {
return NewHarnessOutcome.failed;
}
if (needsProject && !checking) {
diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dart
index 2d20aa9c4..28b3c1607 100644
--- a/desktop/lib/state/swarm.dart
+++ b/desktop/lib/state/swarm.dart
@@ -25,7 +25,7 @@ class Swarm {
/// over the New Tab it was opened from, the way a first agent does.
String kind;
- /// A deliberately opened tab has a minimal landing page, separate from onboarding.
+ /// Marks a deliberately opened tab so subsequent actions use its destination.
bool isNewTabPage;
bool get isBlankNewTab =>
isNewTabPage && kind == 'harness' && panes.isEmpty && presets.isEmpty;
diff --git a/desktop/lib/store/store_category.dart b/desktop/lib/store/store_category.dart
index 88f5cbf81..1332772b9 100644
--- a/desktop/lib/store/store_category.dart
+++ b/desktop/lib/store/store_category.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -137,8 +138,7 @@ class _StoreCategoryState extends State<StoreCategory> {
children: [
Text(
'Your next tool is waiting.',
- style: TextStyle(
- fontSize: 20,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -147,8 +147,7 @@ class _StoreCategoryState extends State<StoreCategory> {
Text(
'Explore the harnesses in $name and choose one to try.',
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 14,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -242,115 +241,113 @@ class _DisciplineHero extends StatelessWidget {
final VoidCallback? onOpen;
@override
- Widget build(BuildContext context) => Column(
- key: const ValueKey('store-category-hero'),
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- name,
- style: TextStyle(
- fontSize: 34,
- height: 1.15,
- letterSpacing: -1,
- fontWeight: FontWeight.w700,
- color: grid.AppPalette.textPrimary,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Column(
+ key: const ValueKey('store-category-hero'),
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(
+ name,
+ style: terminalTextStyle(
+ height: 1.15,
+ letterSpacing: -1,
+ fontWeight: FontWeight.w700,
+ color: grid.AppPalette.textPrimary,
+ ),
),
- ),
- const SizedBox(height: 20),
- LayoutBuilder(
- builder: (context, box) {
- final compact =
- box.maxWidth < 740 ||
- MediaQuery.textScalerOf(context).scale(14) > 20;
- final copy = Padding(
- padding: const EdgeInsets.all(26),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'GET STARTED',
- style: TextStyle(
- fontSize: 10,
- letterSpacing: 1.2,
- fontWeight: FontWeight.w700,
- color: grid.AppPalette.accentOnSurface,
+ const SizedBox(height: 20),
+ LayoutBuilder(
+ builder: (context, box) {
+ final compact =
+ box.maxWidth < 740 ||
+ MediaQuery.textScalerOf(context).scale(14) > 20;
+ final copy = Padding(
+ padding: const EdgeInsets.all(26),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'GET STARTED',
+ style: terminalTextStyle(
+ letterSpacing: 1.2,
+ fontWeight: FontWeight.w700,
+ color: grid.AppPalette.accentOnSurface,
+ ),
),
- ),
- const SizedBox(height: 12),
- Text(
- headline.replaceAll('\n', ' '),
- style: TextStyle(
- fontSize: 27,
- height: 1.15,
- letterSpacing: -.5,
- fontWeight: FontWeight.w700,
- color: grid.AppPalette.textPrimary,
+ const SizedBox(height: 12),
+ Text(
+ headline.replaceAll('\n', ' '),
+ style: terminalTextStyle(
+ height: 1.15,
+ letterSpacing: -.5,
+ fontWeight: FontWeight.w700,
+ color: grid.AppPalette.textPrimary,
+ ),
),
- ),
- const SizedBox(height: 12),
- Text(
- description,
- style: TextStyle(
- fontSize: 14,
- height: 1.5,
- color: grid.AppPalette.textSecondary,
+ const SizedBox(height: 12),
+ Text(
+ description,
+ style: terminalTextStyle(
+ height: 1.5,
+ color: grid.AppPalette.textSecondary,
+ ),
),
- ),
- if (entry != null) ...[
- const SizedBox(height: 20),
- Row(
- children: [
- StoreAppIcon(entry: entry!, size: 30),
- const SizedBox(width: 10),
- Expanded(
- child: Text(
- 'Explore ${entry!.name}',
- style: TextStyle(
- fontSize: 13,
- fontWeight: FontWeight.w600,
- color: grid.AppPalette.textPrimary,
+ if (entry != null) ...[
+ const SizedBox(height: 20),
+ Row(
+ children: [
+ StoreAppIcon(entry: entry!, size: 30),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Text(
+ 'Explore ${entry!.name}',
+ style: terminalTextStyle(
+ fontWeight: FontWeight.w600,
+ color: grid.AppPalette.textPrimary,
+ ),
),
),
- ),
- Icon(
- LucideIcons.arrowRight300,
- size: 16,
- color: grid.AppPalette.textSecondary,
- ),
- ],
- ),
- ],
- ],
- ),
- );
- final art = entry == null
- ? null
- : AspectRatio(
- aspectRatio: 2,
- child: StoreFeaturedArt(category: name, entry: entry!),
- );
- final body = compact || art == null
- ? Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [copy, ?art],
- )
- : Row(
- children: [
- Expanded(child: copy),
- Expanded(child: art),
+ Icon(
+ LucideIcons.arrowRight300,
+ size: 16,
+ color: grid.AppPalette.textSecondary,
+ ),
+ ],
+ ),
],
- );
- return entry == null
- ? body
- : StoreExploreCard(
- key: const ValueKey('store-category-feature'),
- color: storeDiscipline(name).color,
- onTap: onOpen!,
- semanticLabel: 'Explore ${entry!.name}',
- child: body,
- );
- },
- ),
- ],
- );
+ ],
+ ),
+ );
+ final art = entry == null
+ ? null
+ : AspectRatio(
+ aspectRatio: 2,
+ child: StoreFeaturedArt(category: name, entry: entry!),
+ );
+ final body = compact || art == null
+ ? Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [copy, ?art],
+ )
+ : Row(
+ children: [
+ Expanded(child: copy),
+ Expanded(child: art),
+ ],
+ );
+ return entry == null
+ ? body
+ : StoreExploreCard(
+ key: const ValueKey('store-category-feature'),
+ color: storeDiscipline(name).color,
+ onTap: onOpen!,
+ semanticLabel: 'Explore ${entry!.name}',
+ child: body,
+ );
+ },
+ ),
+ ],
+ );
+ }
}
diff --git a/desktop/lib/store/store_discover.dart b/desktop/lib/store/store_discover.dart
index c1a5976f0..6c9f68f44 100644
--- a/desktop/lib/store/store_discover.dart
+++ b/desktop/lib/store/store_discover.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -86,8 +87,7 @@ class StoreDiscover extends StatelessWidget {
Text(
'Follow your curiosity.',
key: const ValueKey('store-curiosity-hero'),
- style: TextStyle(
- fontSize: 34,
+ style: terminalTextStyle(
height: 1.15,
letterSpacing: -1.1,
fontWeight: FontWeight.w700,
@@ -98,8 +98,7 @@ class StoreDiscover extends StatelessWidget {
const SizedBox(height: 24),
LayoutBuilder(
builder: (context, constraints) {
- final scale =
- MediaQuery.textScalerOf(context).scale(14) / 14;
+ final scale = terminalTextScaleOf(context);
final wide =
constraints.maxWidth >= 980 &&
scale <= 1.25 &&
@@ -200,8 +199,7 @@ class StoreDiscover extends StatelessWidget {
const SizedBox(height: 16),
LayoutBuilder(
builder: (context, constraints) {
- final scale =
- MediaQuery.textScalerOf(context).scale(14) / 14;
+ final scale = terminalTextScaleOf(context);
final columns = (constraints.maxWidth / (320 * scale))
.floor()
.clamp(1, 3);
@@ -234,8 +232,7 @@ class StoreDiscover extends StatelessWidget {
const SizedBox(height: 32),
Text(
'For polymaths in the making.',
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -243,8 +240,7 @@ class StoreDiscover extends StatelessWidget {
const SizedBox(height: 6),
Text(
'Learn the next craft through the things you build.',
- style: TextStyle(
- fontSize: 14,
+ style: terminalTextStyle(
height: 1.5,
color: grid.AppPalette.textSecondary,
),
@@ -258,8 +254,7 @@ class StoreDiscover extends StatelessWidget {
const SizedBox(height: 32),
Text(
'Start with a coding agent. More disciplines will appear here as harnesses become available.',
- style: TextStyle(
- fontSize: 14,
+ style: terminalTextStyle(
height: 1.5,
color: grid.AppPalette.textSecondary,
),
@@ -282,6 +277,7 @@ class _FeaturedStory extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final category = entry.isEngine
? 'Coding'
: entry.id == 'autonomous/blender'
@@ -292,7 +288,7 @@ class _FeaturedStory extends StatelessWidget {
'Design' => 'Give your ideas shape.',
_ => 'Build something real.',
};
- final scale = MediaQuery.textScalerOf(context).scale(14) / 14;
+ final scale = terminalTextScaleOf(context);
return StoreExploreCard(
key: ValueKey('store-feature:${entry.id}'),
color: storeDiscipline(category).color,
@@ -308,8 +304,7 @@ class _FeaturedStory extends StatelessWidget {
children: [
Text(
category.toUpperCase(),
- style: TextStyle(
- fontSize: 10,
+ style: terminalTextStyle(
letterSpacing: 1.1,
fontWeight: FontWeight.w700,
color: grid.AppPalette.accentOnSurface,
@@ -320,8 +315,7 @@ class _FeaturedStory extends StatelessWidget {
height: 50 * scale,
child: Text(
headline,
- style: TextStyle(
- fontSize: 21,
+ style: terminalTextStyle(
height: 1.15,
letterSpacing: -.4,
fontWeight: FontWeight.w700,
@@ -338,8 +332,7 @@ class _FeaturedStory extends StatelessWidget {
'Explore ${entry.name}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -381,6 +374,7 @@ class _DisciplineLink extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final discipline = storeDiscipline(name);
final example = discipline.example(entries)!;
return StoreExploreCard(
@@ -399,8 +393,7 @@ class _DisciplineLink extends StatelessWidget {
children: [
Text(
name,
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -408,8 +401,7 @@ class _DisciplineLink extends StatelessWidget {
const SizedBox(height: 5),
Text(
'${entries.length} ${entries.length == 1 ? 'harness' : 'harnesses'}',
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
diff --git a/desktop/lib/store/store_explore_widgets.dart b/desktop/lib/store/store_explore_widgets.dart
index 050ed2fe5..535a12f34 100644
--- a/desktop/lib/store/store_explore_widgets.dart
+++ b/desktop/lib/store/store_explore_widgets.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -23,43 +24,44 @@ class StoreExploreHeading extends StatelessWidget {
final VoidCallback? onAction;
@override
- Widget build(BuildContext context) => Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- title,
- style: TextStyle(
- fontSize: 21,
- height: 1.15,
- fontWeight: FontWeight.w700,
- letterSpacing: -.4,
- color: grid.AppPalette.textPrimary,
- ),
- ),
- if (subtitle != null) ...[
- const SizedBox(height: 8),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
Text(
- subtitle!,
- style: TextStyle(
- fontSize: 14,
- height: 1.5,
- color: grid.AppPalette.textSecondary,
+ title,
+ style: terminalTextStyle(
+ height: 1.15,
+ fontWeight: FontWeight.w700,
+ letterSpacing: -.4,
+ color: grid.AppPalette.textPrimary,
),
),
+ if (subtitle != null) ...[
+ const SizedBox(height: 8),
+ Text(
+ subtitle!,
+ style: terminalTextStyle(
+ height: 1.5,
+ color: grid.AppPalette.textSecondary,
+ ),
+ ),
+ ],
],
- ],
+ ),
),
- ),
- if (onAction != null) ...[
- const SizedBox(width: 16),
- TextButton(onPressed: onAction, child: Text(action!)),
+ if (onAction != null) ...[
+ const SizedBox(width: 16),
+ TextButton(onPressed: onAction, child: Text(action!)),
+ ],
],
- ],
- );
+ );
+ }
}
/// Curated covers for browsing; actual output images for prompt examples.
@@ -77,6 +79,7 @@ class StoreProjectArt extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final color = storeDiscipline(storeCategoryFor(entry)).color;
final fallback = DecoratedBox(
decoration: BoxDecoration(
@@ -181,43 +184,49 @@ class _CoverCredit extends StatelessWidget {
final StoreCoverArt cover;
@override
- Widget build(BuildContext context) => Tooltip(
- message:
- '${cover.description}\n${cover.credit} · ${cover.license}\nView source',
- child: Material(
- color: const Color(0xc91a1b1e),
- borderRadius: BorderRadius.circular(16),
- child: InkWell(
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Tooltip(
+ message:
+ '${cover.description}\n${cover.credit} · ${cover.license}\nView source',
+ child: Material(
+ color: const Color(0xc91a1b1e),
borderRadius: BorderRadius.circular(16),
- onTap: () async {
- final messenger = ScaffoldMessenger.maybeOf(context);
- try {
- if (await launchUrl(
- Uri.parse(cover.source!),
- mode: LaunchMode.externalApplication,
- )) {
- return;
+ child: InkWell(
+ borderRadius: BorderRadius.circular(16),
+ onTap: () async {
+ final messenger = ScaffoldMessenger.maybeOf(context);
+ try {
+ if (await launchUrl(
+ Uri.parse(cover.source!),
+ mode: LaunchMode.externalApplication,
+ )) {
+ return;
+ }
+ } catch (_) {
+ // Keep the card usable if an external browser is unavailable.
}
- } catch (_) {
- // Keep the card usable if an external browser is unavailable.
- }
- if (messenger?.mounted == true) {
- messenger!.showSnackBar(
- const SnackBar(content: Text('Could not open the image source')),
- );
- }
- },
- child: Semantics(
- label: 'Image credit: ${cover.credit}. ${cover.license}. View source',
- button: true,
- child: const Padding(
- padding: EdgeInsets.all(9),
- child: Icon(LucideIcons.info300, size: 14, color: Colors.white),
+ if (messenger?.mounted == true) {
+ messenger!.showSnackBar(
+ const SnackBar(
+ content: Text('Could not open the image source'),
+ ),
+ );
+ }
+ },
+ child: Semantics(
+ label:
+ 'Image credit: ${cover.credit}. ${cover.license}. View source',
+ button: true,
+ child: const Padding(
+ padding: EdgeInsets.all(9),
+ child: Icon(LucideIcons.info300, size: 14, color: Colors.white),
+ ),
),
),
),
- ),
- );
+ );
+ }
}
class StoreExploreCard extends StatefulWidget {
@@ -243,6 +252,7 @@ class _StoreExploreCardState extends State<StoreExploreCard> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final active = _hovered || _focused;
final radius = BorderRadius.circular(16);
return AnimatedContainer(
diff --git a/desktop/lib/store/store_harness_actions.dart b/desktop/lib/store/store_harness_actions.dart
index be9ece8ce..7cb923cb0 100644
--- a/desktop/lib/store/store_harness_actions.dart
+++ b/desktop/lib/store/store_harness_actions.dart
@@ -4,6 +4,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../core/harness_catalog.dart';
@@ -187,18 +188,12 @@ class _StoreHarnessActionsState extends State<StoreHarnessActions> {
recent: widget.recent,
);
final multiple = targets.length > 1;
- final size = widget.prominent ? 15.0 : 12.0;
final height = widget.prominent ? 46.0 : 34.0;
final padding = EdgeInsets.symmetric(
horizontal: widget.prominent ? 20 : 12,
vertical: 8,
);
- final textStyle = TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: size,
- fontWeight: FontWeight.w600,
- );
+ final textStyle = terminalTextStyle(fontWeight: FontWeight.w600);
final tooltip = multiple
? 'Choose a harness to resume'
: targets.firstOrNull?.tooltip ?? '';
@@ -240,8 +235,7 @@ class _StoreHarnessActionsState extends State<StoreHarnessActions> {
padding: const EdgeInsets.fromLTRB(18, 12, 18, 8),
child: Text(
'Recent harnesses',
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textSecondary,
),
diff --git a/desktop/lib/store/store_listing.dart b/desktop/lib/store/store_listing.dart
index 9e8aa9607..ebebeca16 100644
--- a/desktop/lib/store/store_listing.dart
+++ b/desktop/lib/store/store_listing.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -14,21 +15,24 @@ class StoreAppIcon extends StatelessWidget {
final double size;
@override
- Widget build(BuildContext context) => Container(
- width: size,
- height: size,
- padding: EdgeInsets.all(size * .12),
- decoration: BoxDecoration(
- color: grid.AppSurface.recess,
- borderRadius: BorderRadius.circular(size * .23),
- border: Border.all(color: grid.AppPalette.divider),
- ),
- child: EngineMark(
- engine: entry.id,
- displayName: entry.name,
- size: size * .76,
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Container(
+ width: size,
+ height: size,
+ padding: EdgeInsets.all(size * .12),
+ decoration: BoxDecoration(
+ color: grid.AppSurface.recess,
+ borderRadius: BorderRadius.circular(size * .23),
+ border: Border.all(color: grid.AppPalette.divider),
+ ),
+ child: EngineMark(
+ engine: entry.id,
+ displayName: entry.name,
+ size: size * .76,
+ ),
+ );
+ }
}
/// Icon rows are the default catalog presentation. Reserve large imagery for
@@ -49,33 +53,36 @@ class StoreListing extends StatelessWidget {
final bool showRanks;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, box) {
- final scale = MediaQuery.textScalerOf(context).scale(14) / 14;
- final columns = (box.maxWidth / (340 * scale)).floor().clamp(1, 3);
- final width = (box.maxWidth - (columns - 1) * 28) / columns;
- final reserveRating = entries.any((entry) => !ratingFor(entry).isEmpty);
- final reserveUpdate = entries.any((entry) => entry.hasUpdate);
- return Wrap(
- spacing: 28,
- children: [
- for (final entry in entries)
- SizedBox(
- width: width,
- child: _ProductRow(
- key: ValueKey('$rowKeyPrefix:${entry.id}'),
- rank: showRanks ? entries.indexOf(entry) + 1 : null,
- entry: entry,
- rating: ratingFor(entry),
- reserveRating: reserveRating,
- reserveUpdate: reserveUpdate,
- onOpen: () => onOpen(entry.id),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, box) {
+ final scale = terminalTextScaleOf(context);
+ final columns = (box.maxWidth / (340 * scale)).floor().clamp(1, 3);
+ final width = (box.maxWidth - (columns - 1) * 28) / columns;
+ final reserveRating = entries.any((entry) => !ratingFor(entry).isEmpty);
+ final reserveUpdate = entries.any((entry) => entry.hasUpdate);
+ return Wrap(
+ spacing: 28,
+ children: [
+ for (final entry in entries)
+ SizedBox(
+ width: width,
+ child: _ProductRow(
+ key: ValueKey('$rowKeyPrefix:${entry.id}'),
+ rank: showRanks ? entries.indexOf(entry) + 1 : null,
+ entry: entry,
+ rating: ratingFor(entry),
+ reserveRating: reserveRating,
+ reserveUpdate: reserveUpdate,
+ onOpen: () => onOpen(entry.id),
+ ),
),
- ),
- ],
- );
- },
- );
+ ],
+ );
+ },
+ );
+ }
}
class _ProductRow extends StatelessWidget {
@@ -97,7 +104,8 @@ class _ProductRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final scale = MediaQuery.textScalerOf(context).scale(12) / 12;
+ TerminalFontScope.watch(context);
+ final scale = terminalTextScaleOf(context);
final benefit = entry.isEngine
? entry.tagline ??
engineIdentity(entry.id).tagline ??
@@ -121,8 +129,7 @@ class _ProductRow extends StatelessWidget {
width: 18,
child: Text(
'$rank',
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textSecondary,
),
@@ -142,8 +149,7 @@ class _ProductRow extends StatelessWidget {
entry.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -156,8 +162,7 @@ class _ProductRow extends StatelessWidget {
benefit,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.3,
color: grid.AppPalette.textSecondary,
),
@@ -167,8 +172,7 @@ class _ProductRow extends StatelessWidget {
const SizedBox(height: 4),
Text(
entry.hasUpdate ? 'Update available' : ' ',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.accentOnSurface,
),
),
@@ -189,8 +193,7 @@ class _ProductRow extends StatelessWidget {
const SizedBox(width: 3),
Text(
'${rating.average.toStringAsFixed(1)} · ${rating.count}',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dart
index ecd4d10cb..80f31c8f0 100644
--- a/desktop/lib/store/store_screen.dart
+++ b/desktop/lib/store/store_screen.dart
@@ -1,8 +1,11 @@
import 'dart:async';
+import '../shared/widgets/labeled_field.dart';
+
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../analytics/analytics.dart';
import '../core/dsh_catalog.dart';
@@ -585,11 +588,9 @@ class _StoreNav extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final shelf = this.shelf;
- final textScale = (MediaQuery.textScalerOf(context).scale(14) / 14).clamp(
- 1.0,
- 1.5,
- );
+ final textScale = (terminalTextScaleOf(context)).clamp(1.0, 1.5);
return Container(
width:
(MediaQuery.sizeOf(context).width < 1000 ? 184 : 216) +
@@ -620,8 +621,7 @@ class _StoreNav extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(10, 0, 10, 10),
child: Text(
'DISCIPLINES',
- style: TextStyle(
- fontSize: 10,
+ style: terminalTextStyle(
letterSpacing: 1.4,
fontWeight: FontWeight.w600,
color: grid.AppPalette.textFaint,
@@ -641,8 +641,7 @@ class _StoreNav extends StatelessWidget {
? null
: Text(
'${counts[name]}',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -726,6 +725,7 @@ class _Shelf$View extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
if (shelf is _Category) {
return StoreCategory(
name: _title,
@@ -750,8 +750,7 @@ class _Shelf$View extends StatelessWidget {
children: [
Text(
_title,
- style: TextStyle(
- fontSize: 28,
+ style: terminalTextStyle(
fontWeight: FontWeight.w700,
letterSpacing: -.6,
color: grid.AppPalette.textPrimary,
@@ -760,10 +759,7 @@ class _Shelf$View extends StatelessWidget {
const SizedBox(height: 8),
Text(
_subtitle,
- style: TextStyle(
- fontSize: 13,
- color: grid.AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
const SizedBox(height: 24),
if (entries.isEmpty)
@@ -775,8 +771,7 @@ class _Shelf$View extends StatelessWidget {
: loaded
? 'Nothing here yet.'
: 'Asking this computer…',
- style: TextStyle(
- fontSize: 14,
+ style: terminalTextStyle(
height: 1.5,
color: grid.AppPalette.textSecondary,
),
@@ -824,6 +819,7 @@ class _Stars extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -1159,8 +1155,7 @@ class _ProductPageState extends State<_ProductPage> {
Text(
entry.name,
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: wide ? 64 : 42,
+ style: terminalTextStyle(
height: 1.02,
fontWeight: FontWeight.w700,
letterSpacing: wide ? -2.2 : -1.2,
@@ -1175,8 +1170,7 @@ class _ProductPageState extends State<_ProductPage> {
child: Text(
description,
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: wide ? 19 : 16,
+ style: terminalTextStyle(
height: 1.45,
color: grid.AppPalette.textSecondary,
),
@@ -1197,8 +1191,7 @@ class _ProductPageState extends State<_ProductPage> {
'Runs on $baseLabel',
].join(' · '),
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -1264,10 +1257,7 @@ class _ProductPageState extends State<_ProductPage> {
foregroundColor: grid.AppPalette.windowBg,
minimumSize: const Size(148, 50),
padding: const EdgeInsets.symmetric(horizontal: 30),
- textStyle: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 16,
+ textStyle: terminalTextStyle(
fontWeight: FontWeight.w600,
),
shape: const StadiumBorder(),
@@ -1288,8 +1278,7 @@ class _ProductPageState extends State<_ProductPage> {
Text(
'Your projects and files are kept.',
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -1313,8 +1302,7 @@ class _ProductPageState extends State<_ProductPage> {
child: local == null
? Text(
'Connecting to this computer…',
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
)
@@ -1374,8 +1362,7 @@ class _ProductPageState extends State<_ProductPage> {
Text(
'Ratings and reviews',
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 28,
+ style: terminalTextStyle(
fontWeight: FontWeight.w700,
letterSpacing: -0.6,
color: grid.AppPalette.textPrimary,
@@ -1400,8 +1387,7 @@ class _ProductPageState extends State<_ProductPage> {
Text(
'Reviews are unavailable right now.',
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -1411,8 +1397,7 @@ class _ProductPageState extends State<_ProductPage> {
Text(
'No reviews yet. Be the first.',
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -1527,7 +1512,7 @@ class _InstallLine extends StatelessWidget {
} else {
status = 'Not installed';
}
- final faint = TextStyle(fontSize: 12.5, color: grid.AppPalette.textFaint);
+ final faint = terminalTextStyle(color: grid.AppPalette.textFaint);
return Wrap(
alignment: WrapAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
@@ -1547,8 +1532,7 @@ class _InstallLine extends StatelessWidget {
Text(
status,
key: const ValueKey('store-install-status'),
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
color: run?.failed == true
? grid.AppPalette.warn
: grid.AppPalette.textSecondary,
@@ -1617,7 +1601,7 @@ class _QuietLinkState extends State<_QuietLink> {
? grid.AppPalette.textPrimary
: grid.AppPalette.textSecondary;
final content = DefaultTextStyle.merge(
- style: TextStyle(fontSize: 13, color: color),
+ style: terminalTextStyle(color: color),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -1650,6 +1634,7 @@ class _RatingSummary extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final max = rating.histogram.fold<int>(0, (a, b) => a > b ? a : b);
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -1659,8 +1644,7 @@ class _RatingSummary extends StatelessWidget {
children: [
Text(
rating.average.toStringAsFixed(1),
- style: TextStyle(
- fontSize: 40,
+ style: terminalTextStyle(
fontWeight: FontWeight.w700,
height: 1,
color: grid.AppPalette.textPrimary,
@@ -1669,7 +1653,7 @@ class _RatingSummary extends StatelessWidget {
const SizedBox(height: 6),
Text(
'out of 5 · ${rating.count} rating${rating.count == 1 ? '' : 's'}',
- style: TextStyle(fontSize: 12, color: grid.AppPalette.textFaint),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
],
),
@@ -1687,8 +1671,7 @@ class _RatingSummary extends StatelessWidget {
child: Text(
'$stars',
textAlign: TextAlign.right,
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -1736,6 +1719,7 @@ class _ReviewCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
@@ -1756,8 +1740,7 @@ class _ReviewCard extends StatelessWidget {
review.title!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 13.5,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -1780,14 +1763,13 @@ class _ReviewCard extends StatelessWidget {
const SizedBox(height: 4),
Text(
'${review.mine ? 'You' : review.authorName} · ${_when(review.updatedAt)}',
- style: TextStyle(fontSize: 11.5, color: grid.AppPalette.textFaint),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
if (review.body != null) ...[
const SizedBox(height: 8),
Text(
review.body!,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.45,
color: grid.AppPalette.textPrimary,
),
@@ -1837,6 +1819,7 @@ class _ReviewDialogState extends State<_ReviewDialog> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return _DialogCard(
width: 460,
child: Column(
@@ -1847,8 +1830,7 @@ class _ReviewDialogState extends State<_ReviewDialog> {
widget.existing == null
? 'Rate ${widget.name}'
: 'Your review of ${widget.name}',
- style: TextStyle(
- fontSize: 17,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -1861,27 +1843,22 @@ class _ReviewDialogState extends State<_ReviewDialog> {
onPick: (n) => setState(() => _rating = n),
),
const SizedBox(height: 14),
+ const FieldLabel('Title (optional)'),
TextField(
key: const ValueKey('store-review-title'),
controller: _title,
maxLength: 80,
- decoration: const InputDecoration(
- labelText: 'Title (optional)',
- counterText: '',
- ),
+ decoration: const InputDecoration(counterText: ''),
),
const SizedBox(height: 10),
+ const FieldLabel('What was it like?'),
TextField(
key: const ValueKey('store-review-body'),
controller: _body,
maxLength: 2000,
minLines: 3,
maxLines: 8,
- decoration: const InputDecoration(
- labelText: 'What was it like?',
- counterText: '',
- alignLabelWithHint: true,
- ),
+ decoration: const InputDecoration(counterText: ''),
),
const SizedBox(height: 16),
Row(
@@ -1936,6 +1913,7 @@ class _ConfirmCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return _DialogCard(
width: 420,
child: Column(
@@ -1944,8 +1922,7 @@ class _ConfirmCard extends StatelessWidget {
children: [
Text(
title,
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -1953,8 +1930,7 @@ class _ConfirmCard extends StatelessWidget {
const SizedBox(height: 8),
Text(
detail,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.4,
color: grid.AppPalette.textSecondary,
),
@@ -1991,6 +1967,7 @@ class _DialogCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Center(
child: Material(
color: grid.AppPalette.panelBg,
diff --git a/desktop/lib/store/store_search.dart b/desktop/lib/store/store_search.dart
index 8d94b8b22..961bfd7f6 100644
--- a/desktop/lib/store/store_search.dart
+++ b/desktop/lib/store/store_search.dart
@@ -4,6 +4,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_icon_button.dart';
@@ -39,55 +40,58 @@ class StoreSearch extends StatelessWidget {
final VoidCallback? onForward;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, box) {
- final padding = box.maxWidth < 680 ? 20.0 : 36.0;
- // A control's height, grown with the text so a scaled label still has air.
- final height = math.max(
- grid.AppControl.height,
- MediaQuery.textScalerOf(context).scale(13) + 18,
- );
- return Container(
- key: const ValueKey('store-search-header'),
- color: grid.AppPalette.windowBg,
- padding: EdgeInsets.fromLTRB(padding, 14, padding, 6),
- child: Center(
- child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 1440),
- child: SizedBox(
- height: height,
- child: CustomMultiChildLayout(
- delegate: _ToolbarLayout(),
- children: [
- LayoutId(
- id: _Slot.history,
- child: _History(onBack: onBack, onForward: onForward),
- ),
- LayoutId(
- id: _Slot.search,
- child: _Field(
- controller: controller,
- focusNode: focusNode,
- onChanged: onChanged,
- autofocus: autofocus,
- onClear: onClear,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, box) {
+ final padding = box.maxWidth < 680 ? 20.0 : 36.0;
+ // A control's height, grown with the text so a scaled label still has air.
+ final height = math.max(
+ grid.AppControl.height,
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) + 18,
+ );
+ return Container(
+ key: const ValueKey('store-search-header'),
+ color: grid.AppPalette.windowBg,
+ padding: EdgeInsets.fromLTRB(padding, 14, padding, 6),
+ child: Center(
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 1440),
+ child: SizedBox(
+ height: height,
+ child: CustomMultiChildLayout(
+ delegate: _ToolbarLayout(),
+ children: [
+ LayoutId(
+ id: _Slot.history,
+ child: _History(onBack: onBack, onForward: onForward),
),
- ),
- LayoutId(
- id: _Slot.create,
- child: _CreateHarness(
- height: height,
- labelled: box.maxWidth >= 520,
+ LayoutId(
+ id: _Slot.search,
+ child: _Field(
+ controller: controller,
+ focusNode: focusNode,
+ onChanged: onChanged,
+ autofocus: autofocus,
+ onClear: onClear,
+ ),
),
- ),
- ],
+ LayoutId(
+ id: _Slot.create,
+ child: _CreateHarness(
+ height: height,
+ labelled: box.maxWidth >= 520,
+ ),
+ ),
+ ],
+ ),
),
),
),
- ),
- );
- },
- );
+ );
+ },
+ );
+ }
}
enum _Slot { history, search, create }
@@ -138,6 +142,7 @@ class _History extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final back = effectiveCommandHint(context, 'navigation.back');
final forward = effectiveCommandHint(context, 'navigation.forward');
return Container(
@@ -194,6 +199,7 @@ class _Field extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final shortcut = effectiveCommandHint(context, 'terminal.find');
return ListenableBuilder(
listenable: Listenable.merge([focusNode, controller]),
@@ -247,16 +253,14 @@ class _Field extends StatelessWidget {
onChanged: onChanged,
textInputAction: TextInputAction.search,
textAlignVertical: TextAlignVertical.center,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
),
// Bare: the outline around it is this field's border,
// so none of the theme's own may draw inside it.
decoration: InputDecoration(
hintText: 'Search harnesses',
- hintStyle: TextStyle(
- fontSize: 13,
+ hintStyle: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
isCollapsed: true,
@@ -285,8 +289,7 @@ class _Field extends StatelessWidget {
padding: const EdgeInsets.only(right: 5),
child: Text(
shortcut,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -313,34 +316,32 @@ class _CreateHarness extends StatelessWidget {
final bool labelled;
@override
- Widget build(BuildContext context) => Tooltip(
- message: 'Your first harness in ten minutes, on GitHub',
- child: FilledButton(
- key: const ValueKey('store-create-harness'),
- onPressed: () => unawaited(
- launchUrl(
- Uri.parse(kCreateHarnessGuide),
- mode: LaunchMode.externalApplication,
- ),
- ),
- style: FilledButton.styleFrom(
- minimumSize: Size(height, height),
- padding: EdgeInsets.symmetric(horizontal: labelled ? 14 : 0),
- backgroundColor: grid.AppPalette.textPrimary,
- foregroundColor: grid.AppPalette.windowBg,
- textStyle: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 13,
- fontWeight: FontWeight.w600,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Tooltip(
+ message: 'Your first harness in ten minutes, on GitHub',
+ child: FilledButton(
+ key: const ValueKey('store-create-harness'),
+ onPressed: () => unawaited(
+ launchUrl(
+ Uri.parse(kCreateHarnessGuide),
+ mode: LaunchMode.externalApplication,
+ ),
),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ style: FilledButton.styleFrom(
+ minimumSize: Size(height, height),
+ padding: EdgeInsets.symmetric(horizontal: labelled ? 14 : 0),
+ backgroundColor: grid.AppPalette.textPrimary,
+ foregroundColor: grid.AppPalette.windowBg,
+ textStyle: terminalTextStyle(fontWeight: FontWeight.w600),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ ),
),
+ child: labelled
+ ? const Text('Create Harness')
+ : const Icon(LucideIcons.plus300, size: 16),
),
- child: labelled
- ? const Text('Create Harness')
- : const Icon(LucideIcons.plus300, size: 16),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/store/store_showcase.dart b/desktop/lib/store/store_showcase.dart
index 0dd7d3953..2fde33b17 100644
--- a/desktop/lib/store/store_showcase.dart
+++ b/desktop/lib/store/store_showcase.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../core/test_run.dart';
@@ -97,9 +98,7 @@ class _ExampleBlockState extends State<_ExampleBlock> {
children: [
Text(
'${(i + 1).toString().padLeft(2, '0')} / ${widget.count.toString().padLeft(2, '0')}',
- style: TextStyle(
- fontFamily: grid.AppFont.mono,
- fontSize: 12,
+ style: terminalTextStyle(
letterSpacing: 2,
color: grid.AppPalette.accentOnSurface,
),
@@ -111,8 +110,7 @@ class _ExampleBlockState extends State<_ExampleBlock> {
'“${example.prompt}”',
key: ValueKey('store-example-prompt:$i'),
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: wide ? 34 : 24,
+ style: terminalTextStyle(
height: 1.24,
fontWeight: FontWeight.w600,
letterSpacing: wide ? -0.8 : -0.4,
@@ -136,10 +134,7 @@ class _ExampleBlockState extends State<_ExampleBlock> {
foregroundColor: Colors.white,
minimumSize: const Size(0, 46),
padding: const EdgeInsets.symmetric(horizontal: 22),
- textStyle: const TextStyle(
- fontSize: 15,
- fontWeight: FontWeight.w600,
- ),
+ textStyle: terminalTextStyle(fontWeight: FontWeight.w600),
shape: const StadiumBorder(),
),
),
@@ -225,8 +220,7 @@ class _ExampleBlockState extends State<_ExampleBlock> {
Text(
example.caption!,
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.4,
color: grid.AppPalette.textSecondary,
),
@@ -247,6 +241,7 @@ class _Output extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final placeholder = Center(
child: Opacity(
opacity: 0.5,
@@ -331,18 +326,21 @@ class _RevealState extends State<_Reveal> with SingleTickerProviderStateMixin {
}
@override
- Widget build(BuildContext context) => AnimatedBuilder(
- animation: _controller,
- builder: (context, child) {
- final t = Curves.easeOutCubic.transform(_controller.value);
- return Opacity(
- opacity: t,
- child: Transform.translate(
- offset: Offset(0, 36 * (1 - t)),
- child: child,
- ),
- );
- },
- child: widget.child,
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return AnimatedBuilder(
+ animation: _controller,
+ builder: (context, child) {
+ final t = Curves.easeOutCubic.transform(_controller.value);
+ return Opacity(
+ opacity: t,
+ child: Transform.translate(
+ offset: Offset(0, 36 * (1 - t)),
+ child: child,
+ ),
+ );
+ },
+ child: widget.child,
+ );
+ }
}
diff --git a/desktop/lib/store/store_viewers.dart b/desktop/lib/store/store_viewers.dart
index 03c231fdc..61dae9f7b 100644
--- a/desktop/lib/store/store_viewers.dart
+++ b/desktop/lib/store/store_viewers.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -22,34 +23,36 @@ class StoreViewers extends StatelessWidget {
final bool loaded;
@override
- Widget build(BuildContext context) => ListView(
- key: const ValueKey('store-viewers'),
- padding: const EdgeInsets.all(28),
- children: [
- Text(
- 'Viewers',
- style: TextStyle(
- fontSize: 28,
- fontWeight: FontWeight.w700,
- color: grid.AppPalette.textPrimary,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListView(
+ key: const ValueKey('store-viewers'),
+ padding: const EdgeInsets.all(28),
+ children: [
+ Text(
+ 'Viewers',
+ style: terminalTextStyle(
+ fontWeight: FontWeight.w700,
+ color: grid.AppPalette.textPrimary,
+ ),
),
- ),
- const SizedBox(height: 8),
- Text(
- 'Shared previews and the agents that use them.',
- style: TextStyle(fontSize: 13, color: grid.AppPalette.textSecondary),
- ),
- const SizedBox(height: 24),
- if (viewers.isEmpty)
+ const SizedBox(height: 8),
Text(
- loaded
- ? 'No viewers reported by this computer.'
- : 'Asking this computer…',
- style: TextStyle(color: grid.AppPalette.textSecondary),
+ 'Shared previews and the agents that use them.',
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
- for (final viewer in viewers) _viewer(context, viewer),
- ],
- );
+ const SizedBox(height: 24),
+ if (viewers.isEmpty)
+ Text(
+ loaded
+ ? 'No viewers reported by this computer.'
+ : 'Asking this computer…',
+ style: TextStyle(color: grid.AppPalette.textSecondary),
+ ),
+ for (final viewer in viewers) _viewer(context, viewer),
+ ],
+ );
+ }
Widget _viewer(BuildContext context, DshEntry viewer) {
final machines = installedOn(viewer.id);
@@ -84,8 +87,7 @@ class StoreViewers extends StatelessWidget {
Expanded(
child: Text(
viewer.name,
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textPrimary,
),
@@ -102,8 +104,7 @@ class StoreViewers extends StatelessWidget {
const SizedBox(height: 8),
Text(
viewer.description!,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.4,
color: grid.AppPalette.textSecondary,
),
@@ -114,16 +115,12 @@ class StoreViewers extends StatelessWidget {
machines.isEmpty
? 'Not installed'
: 'Installed on ${machines.join(', ')}',
- style: TextStyle(
- fontSize: 12,
- color: grid.AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
const SizedBox(height: 14),
Text(
'Used by',
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textSecondary,
),
@@ -132,10 +129,7 @@ class StoreViewers extends StatelessWidget {
if (uses.isEmpty)
Text(
'No agents reported in this catalog.',
- style: TextStyle(
- fontSize: 13,
- color: grid.AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
)
else
Wrap(
diff --git a/desktop/lib/terminal/terminal_text.dart b/desktop/lib/terminal/terminal_text.dart
new file mode 100644
index 000000000..72803b65b
--- /dev/null
+++ b/desktop/lib/terminal/terminal_text.dart
@@ -0,0 +1,44 @@
+import 'package:flutter/widgets.dart';
+
+import 'terminal_font_store.dart';
+import 'terminal_typography.dart';
+export 'terminal_font_store.dart';
+export 'terminal_typography.dart' show terminalFontSize;
+
+/// One face and size for terminal output and every app control. Color, weight,
+/// and spacing can distinguish roles without introducing a second type scale.
+TextStyle terminalTextStyle({
+ Color? color,
+ FontWeight? fontWeight,
+ FontStyle? fontStyle,
+ double? height,
+ double? letterSpacing,
+ List<FontFeature>? fontFeatures,
+}) => TextStyle(
+ fontFamily: terminalFontStore.value.fontFamily,
+ fontFamilyFallback: terminalFontStore.value.fontFamilyFallback,
+ fontSize: terminalFontStore.size,
+ color: color,
+ fontWeight: fontWeight,
+ fontStyle: fontStyle,
+ height: height,
+ letterSpacing: letterSpacing,
+ fontFeatures: fontFeatures,
+);
+
+/// Keeps retained widgets and open overlays on the same live typography.
+class TerminalFontScope extends InheritedNotifier<TerminalFontStore> {
+ TerminalFontScope({super.key, required super.child})
+ : super(notifier: terminalFontStore);
+
+ static void watch(BuildContext context) {
+ context.dependOnInheritedWidgetOfExactType<TerminalFontScope>();
+ }
+}
+
+/// Scale control geometry with the font, without scaling the text a second time.
+double terminalTextScaleOf(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return MediaQuery.textScalerOf(context).scale(terminalFontStore.size) /
+ terminalFontSize;
+}
diff --git a/desktop/lib/theme/app_theme.dart b/desktop/lib/theme/app_theme.dart
index 244f6367f..c6f273a3d 100644
--- a/desktop/lib/theme/app_theme.dart
+++ b/desktop/lib/theme/app_theme.dart
@@ -58,44 +58,10 @@ abstract final class AppColors {
grid.AppTheme.pick(const Color(0xFFB3261E), const Color(0xFFF2544B));
}
-/// The app's two font stacks — adapters over the design system's, exactly like
-/// [AppColors] above.
-///
-/// Mono is for strings the user copies (a token, a path, terminal output);
-/// everything else is read, not copied, and reads faster in the system's own UI
-/// face. Which face that is belongs to `grid.AppFont`, which answers per
-/// platform — these used to re-declare the macOS names as `const`, which is how
-/// the whole app came to be drawn in Noto Sans on Ubuntu (nothing in the Apple
-/// stack resolves there) and how `mono` here drifted to `'Menlo'` while the
-/// token said `.AppleSystemUIFontMonospaced`. Nothing is `const` for the same
-/// reason nothing in [AppColors] is: freezing the value is what breaks the
-/// second platform.
+/// Legacy names resolve to the single Terminal font preference.
abstract final class AppFonts {
static String get sans => grid.AppFont.sans;
static List<String> get sansFallback => grid.AppFont.sansFallback;
static String get mono => grid.AppFont.mono;
static List<String> get monoFallback => grid.AppFont.monoFallback;
}
-
-/// The app's ThemeData now comes from `grid.buildAppTheme` — see `main.dart`.
-///
-/// ⚠️ DO NOT REBUILD ONE HERE. What used to live at this spot was a second,
-/// hand-written `ThemeData` (`AppTheme.terminalLight/terminalDark`), and it was
-/// the one the app actually wore: `grid.buildAppTheme` had ZERO call sites in
-/// `lib/` and was reached only from two tests. Everything the design system
-/// defines was therefore dead at runtime —
-///
-/// * all ten `TextTheme` steps were assigned the SAME style (family and colour
-/// only), so size, weight and `AppFont.trackingFor` fell through to
-/// Material's Roboto metrics. That is why ~150 call sites hand-type
-/// `fontSize:` across 14 different values: the theme gave them nothing, so
-/// each screen re-measured the ramp by eye.
-/// * `AppControl` had 0 references outside the token file — no call site could
-/// see the 32/28/36 control heights or the radius ladder.
-/// * `menuTheme` was null, so a `MenuAnchor` that passed no style of its own
-/// opened Material's raw default.
-///
-/// [AppColors] and [AppFonts] above stay: they are thin aliases onto
-/// `grid.AppPalette`, which is what let the swap be two lines in `main.dart`
-/// instead of renaming 500 call sites. Adding chrome back here would recreate
-/// exactly the split this deletion closed.
diff --git a/desktop/lib/widgets/account_footer.dart b/desktop/lib/widgets/account_footer.dart
index 4bdc42238..b54039f13 100644
--- a/desktop/lib/widgets/account_footer.dart
+++ b/desktop/lib/widgets/account_footer.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../state/app_state.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -220,21 +221,16 @@ class _AccountPillState extends State<_AccountPill> {
widget.primary,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 13,
fontWeight: grid.AppFont.medium,
),
),
if (widget.secondary != null)
Text(
widget.secondary!,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 11,
fontWeight: grid.AppFont.medium,
),
),
@@ -288,11 +284,8 @@ class _AccountSummary extends StatelessWidget {
// Semibold, not w700: the weight ladder has three steps and
// this is the top one. A fourth weight for one line makes it
// shout at the rows it is introducing.
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 13.5,
// 1.25, not the 1.2 a row uses: this line has a second line
// under it, and a name and its address set solid read as one
// block of text rather than as a heading and its subtitle.
@@ -310,11 +303,8 @@ class _AccountSummary extends StatelessWidget {
(isLocal ? 'loopback backend' : 'profile unavailable'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 12,
height: 1.25,
letterSpacing: grid.AppFont.trackingFor(12),
),
@@ -355,11 +345,10 @@ class _Avatar extends StatelessWidget {
),
child: Text(
initials,
- style: TextStyle(
+ style: terminalTextStyle(
// White on the accent disc — the token pair the palette is built for
// (5.5:1). The page ink would be near-black in Light and vanish.
color: Colors.white,
- fontSize: large ? 12 : 11,
fontWeight: FontWeight.w700,
),
),
diff --git a/desktop/lib/widgets/agent_picker.dart b/desktop/lib/widgets/agent_picker.dart
index 0477b1632..2e607f4c5 100644
--- a/desktop/lib/widgets/agent_picker.dart
+++ b/desktop/lib/widgets/agent_picker.dart
@@ -2,6 +2,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shortcuts/app_keymap.dart';
@@ -316,7 +317,12 @@ class _AgentPickerState extends State<AgentPicker> {
}
double _rowHeight(TextScaler scaler) => widget.terminalStyle
- ? math.max(46, scaler.scale(13) * 1.35 + scaler.scale(12) * 1.35 + 12)
+ ? math.max(
+ 46,
+ scaler.scale(terminalFontStore.size) * 1.35 +
+ scaler.scale(terminalFontStore.size) * 1.35 +
+ 12,
+ )
: swarmSearchRowHeight(scaler, commands: false);
/// The closed bar opens on the keys that start a search: Return, Space,
@@ -360,8 +366,7 @@ class _AgentPickerState extends State<AgentPicker> {
overflow: TextOverflow.ellipsis,
style: widget.terminalStyle
? boxMonoStyle()
- : TextStyle(
- fontSize: _fontSize,
+ : terminalTextStyle(
fontWeight: FontWeight.w500,
color: choice == null ? Colors.white60 : Colors.white,
),
@@ -604,7 +609,7 @@ class _AgentPickerState extends State<AgentPicker> {
'No agents match “${_query.text.trim()}”.',
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 14, color: Colors.white60),
+ style: terminalTextStyle(color: Colors.white60),
),
),
)
@@ -655,7 +660,6 @@ class _AgentPickerState extends State<AgentPicker> {
prominent: !widget.terminalStyle,
prompt: widget.terminalStyle ? '>' : null,
height: widget.height,
- fontSize: _fontSize,
),
),
),
@@ -751,7 +755,7 @@ class _AgentPickerState extends State<AgentPicker> {
final compactAction =
(panelWidth >= 760 ? panelWidth / 2 : panelWidth) <
- 380 * scaler.scale(14) / 14;
+ 380 * scaler.scale(terminalFontStore.size) / terminalFontSize;
return MouseRegion(
onHover: (event) {
if (_pointer.moved(event) && _cursor != index) {
@@ -794,8 +798,7 @@ class _AgentPickerState extends State<AgentPicker> {
matches: matches(choice.label, title: true),
style: widget.terminalStyle
? boxMonoStyle()
- : const TextStyle(
- fontSize: 14,
+ : terminalTextStyle(
fontWeight: FontWeight.w600,
color: Colors.white,
),
@@ -810,8 +813,8 @@ class _AgentPickerState extends State<AgentPicker> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: widget.terminalStyle
- ? boxMonoStyle(size: 12, color: kBoxFaint)
- : const TextStyle(fontSize: 13, color: Colors.white54),
+ ? boxMonoStyle(color: kBoxFaint)
+ : terminalTextStyle(color: Colors.white54),
),
),
],
@@ -823,15 +826,18 @@ class _AgentPickerState extends State<AgentPicker> {
choice.detail!,
matches: matches(choice.detail, title: false),
style: widget.terminalStyle
- ? boxMonoStyle(size: 12, color: Colors.white60)
- : const TextStyle(fontSize: 12, color: Colors.white60),
+ ? boxMonoStyle(color: Colors.white60)
+ : terminalTextStyle(color: Colors.white60),
),
trailing: widget.terminalStyle && highlighted
? Text('↵', style: boxMonoStyle(color: kBoxFaint))
: highlighted
? ConstrainedBox(
constraints: BoxConstraints(
- maxWidth: 170 * scaler.scale(11) / 11,
+ maxWidth:
+ 170 *
+ scaler.scale(terminalFontStore.size) /
+ terminalFontSize,
),
child: TextButton(
key: const ValueKey('new-agent-agent-row-action'),
@@ -923,19 +929,14 @@ class _AgentPreview extends StatelessWidget {
final ScrollController? controller;
final bool terminalStyle;
- static const _muted = TextStyle(
- fontSize: 12,
- height: 1.5,
- color: Colors.white54,
- );
- static const _body = TextStyle(
- fontSize: 14,
- height: 1.6,
- color: Color(0xffe1e1e4),
- );
+ static TextStyle get _muted =>
+ terminalTextStyle(height: 1.5, color: Colors.white54);
+ static TextStyle get _body =>
+ terminalTextStyle(height: 1.6, color: Color(0xffe1e1e4));
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final description = choice.description;
final chips = [if (current) 'Chosen', ?status];
return Semantics(
@@ -963,8 +964,7 @@ class _AgentPreview extends StatelessWidget {
text: choice.label,
style: terminalStyle
? boxMonoStyle()
- : const TextStyle(
- fontSize: 20,
+ : terminalTextStyle(
fontWeight: FontWeight.w600,
color: Colors.white,
),
@@ -973,11 +973,8 @@ class _AgentPreview extends StatelessWidget {
TextSpan(
text: ' by $creator',
style: terminalStyle
- ? boxMonoStyle(size: 12, color: kBoxFaint)
- : const TextStyle(
- fontSize: 14,
- color: Colors.white54,
- ),
+ ? boxMonoStyle(color: kBoxFaint)
+ : terminalTextStyle(color: Colors.white54),
),
],
),
@@ -992,21 +989,14 @@ class _AgentPreview extends StatelessWidget {
Text(
detail,
style: terminalStyle
- ? boxMonoStyle(size: 12, color: Colors.white70)
- : const TextStyle(
- fontSize: 14,
- height: 1.4,
- color: Colors.white70,
- ),
+ ? boxMonoStyle(color: Colors.white70)
+ : terminalTextStyle(height: 1.4, color: Colors.white70),
),
],
if (chips.isNotEmpty) ...[
const SizedBox(height: 12),
if (terminalStyle)
- Text(
- chips.join(' · '),
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- )
+ Text(chips.join(' · '), style: boxMonoStyle(color: kBoxFaint))
else
Wrap(
spacing: 8,
@@ -1025,10 +1015,7 @@ class _AgentPreview extends StatelessWidget {
),
child: Text(
chip,
- style: const TextStyle(
- fontSize: 12,
- color: Colors.white70,
- ),
+ style: terminalTextStyle(color: Colors.white70),
),
),
),
@@ -1039,9 +1026,7 @@ class _AgentPreview extends StatelessWidget {
SizedBox(height: terminalStyle ? 16 : 24),
Text(
'About',
- style: terminalStyle
- ? boxMonoStyle(size: 12, color: kBoxFaint)
- : _muted,
+ style: terminalStyle ? boxMonoStyle(color: kBoxFaint) : _muted,
),
const SizedBox(height: 6),
Text(
diff --git a/desktop/lib/widgets/agent_switcher.dart b/desktop/lib/widgets/agent_switcher.dart
index 47e5b6170..c22bea190 100644
--- a/desktop/lib/widgets/agent_switcher.dart
+++ b/desktop/lib/widgets/agent_switcher.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../core/fuzzy_match.dart';
@@ -245,16 +246,14 @@ class _AgentSwitcherState extends State<_AgentSwitcher> {
controller: _query,
focusNode: _field,
autofocus: true,
- style: TextStyle(
- fontSize: 17,
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
),
decoration: InputDecoration(
border: InputBorder.none,
isDense: true,
hintText: 'Find a harness',
- hintStyle: TextStyle(
- fontSize: 17,
+ hintStyle: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -271,8 +270,7 @@ class _AgentSwitcherState extends State<_AgentSwitcher> {
padding: const EdgeInsets.fromLTRB(16, 18, 16, 20),
child: Text(
'No agent matches that.',
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -295,8 +293,7 @@ class _AgentSwitcherState extends State<_AgentSwitcher> {
padding: const EdgeInsets.fromLTRB(16, 9, 16, 10),
child: Text(
'↑↓ or ⌃n ⌃p to move · ⏎ to go · ⇧⏎ in a new tile · esc',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -339,10 +336,7 @@ class _Row extends StatelessWidget {
entry.agent.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 13.5,
- color: grid.AppPalette.textPrimary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textPrimary),
),
),
const SizedBox(width: 12),
@@ -350,7 +344,7 @@ class _Row extends StatelessWidget {
entry.machineName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(fontSize: 12, color: grid.AppPalette.textFaint),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
// A dot, not the word "open": the list is read at a glance and a
// second column of text would compete with the machine's name.
diff --git a/desktop/lib/widgets/box_chrome.dart b/desktop/lib/widgets/box_chrome.dart
index 2e51658fa..5ce53153f 100644
--- a/desktop/lib/widgets/box_chrome.dart
+++ b/desktop/lib/widgets/box_chrome.dart
@@ -3,7 +3,7 @@ import 'package:flutter/semantics.dart';
import 'package:flutter/services.dart';
import '../shared/theme/app_theme.dart' as grid;
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
const double kTerminalCornerRadius = 3;
const double kWorkspaceInset = 6;
@@ -67,57 +67,57 @@ class CommandDock extends StatelessWidget {
final bool expanded;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, constraints) {
- final available =
- (constraints.maxHeight - topClearance - 2 * kWorkspaceInset).clamp(
- 0.0,
- double.infinity,
- );
- final scale = MediaQuery.textScalerOf(context).scale(13) / 13;
- // A shallow dock at ordinary sizes, with room for readable defaults and
- // key hints when accessibility text or a narrow window needs more rows.
- final minimum = constraints.maxWidth < 800 * scale ? 320.0 : 280.0;
- final maxHeight =
- (expanded
- ? 520.0 * scale
- : (available * .4).clamp(minimum * scale, 400.0 * scale))
- .clamp(0.0, available);
- return Align(
- alignment: Alignment.bottomCenter,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(
- kWorkspaceInset,
- 0,
- kWorkspaceInset,
- kWorkspaceInset,
- ),
- child: ConstrainedBox(
- constraints: BoxConstraints(
- minWidth: (constraints.maxWidth - 2 * kWorkspaceInset).clamp(
- 0.0,
- double.infinity,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final available =
+ (constraints.maxHeight - topClearance - 2 * kWorkspaceInset).clamp(
+ 0.0,
+ double.infinity,
+ );
+ final scale =
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) / 13;
+ // A shallow dock at ordinary sizes, with room for readable defaults and
+ // key hints when accessibility text or a narrow window needs more rows.
+ final minimum = constraints.maxWidth < 800 * scale ? 320.0 : 280.0;
+ final maxHeight =
+ (expanded
+ ? 520.0 * scale
+ : (available * .4).clamp(minimum * scale, 400.0 * scale))
+ .clamp(0.0, available);
+ return Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(
+ kWorkspaceInset,
+ 0,
+ kWorkspaceInset,
+ kWorkspaceInset,
+ ),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minWidth: (constraints.maxWidth - 2 * kWorkspaceInset).clamp(
+ 0.0,
+ double.infinity,
+ ),
+ maxHeight: maxHeight,
),
- maxHeight: maxHeight,
+ child: FocusScope(child: child),
),
- child: FocusScope(child: child),
),
- ),
- );
- },
- );
+ );
+ },
+ );
+ }
}
/// Shared typography and frame for prompts that sit over the terminals.
-TextStyle boxMonoStyle({double size = 13, Color? color, FontWeight? weight}) =>
- TextStyle(
- fontFamily: terminalFontStore.value.fontFamily,
- fontFamilyFallback: terminalFontStore.value.fontFamilyFallback,
- fontSize: size,
- height: 1.35,
- color: color ?? Colors.white,
- fontWeight: weight ?? FontWeight.w400,
- );
+TextStyle boxMonoStyle({Color? color, FontWeight? weight}) => terminalTextStyle(
+ height: 1.35,
+ color: color ?? Colors.white,
+ fontWeight: weight ?? FontWeight.w400,
+);
class TerminalBox extends StatelessWidget {
const TerminalBox({super.key, required this.child, this.docked = false});
@@ -125,32 +125,36 @@ class TerminalBox extends StatelessWidget {
final bool docked;
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => Material(
- elevation: 0,
- color: grid.AppPalette.swarmField,
- surfaceTintColor: Colors.transparent,
- shape: docked
- ? Border(top: BorderSide(color: Colors.white.withValues(alpha: .24)))
- : RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(kTerminalCornerRadius),
- side: BorderSide(color: Colors.white.withValues(alpha: .24)),
- ),
- clipBehavior: Clip.antiAlias,
- child: DefaultTextStyle.merge(style: boxMonoStyle(), child: child),
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => Material(
+ elevation: 0,
+ color: grid.AppPalette.swarmField,
+ surfaceTintColor: Colors.transparent,
+ shape: docked
+ ? Border(
+ top: BorderSide(color: Colors.white.withValues(alpha: .24)),
+ )
+ : RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(kTerminalCornerRadius),
+ side: BorderSide(color: Colors.white.withValues(alpha: .24)),
+ ),
+ clipBehavior: Clip.antiAlias,
+ child: DefaultTextStyle.merge(style: boxMonoStyle(), child: child),
+ ),
+ );
+ }
}
/// A compact text row that grows with the user's accessibility text size.
double boxRowHeight(TextScaler scale) =>
- (scale.scale(13) * 1.35 + 8).clamp(26, double.infinity);
+ (scale.scale(terminalFontStore.size) * 1.35 + 8).clamp(26, double.infinity);
-/// Small print on the box's surface. 54% white is the floor that still reads
-/// (about 5.5:1 on the surface); 38% at 11px did not pass AA.
+/// Secondary text keeps the same typography, with a quieter color.
const kBoxFaint = Colors.white54;
-const kBoxFaintStyle = TextStyle(fontSize: 11, color: kBoxFaint);
+TextStyle get kBoxFaintStyle => terminalTextStyle(color: kBoxFaint);
/// Keep the user's actual binding, printed like a terminal's local key guide.
String boxKeyLabel(String hint) => hint
@@ -181,32 +185,35 @@ class BoxRowHighlight extends StatelessWidget {
// A Material, not a coloured box: a ListTile paints its ink on the nearest
// Material, and a plain fill between the two hides it (Flutter asserts so).
@override
- Widget build(BuildContext context) => Material(
- color: highlighted
- ? Colors.white.withValues(alpha: .10)
- : Colors.transparent,
- borderRadius: BorderRadius.circular(terminal ? 0 : 6),
- // No clip: nothing in a row overflows it, and an antialiased rounded clip
- // per row was paid again on every arrow key.
- child: Stack(
- children: [
- child,
- if (highlighted && !terminal)
- Positioned(
- left: 0,
- top: 7,
- bottom: 7,
- child: Container(
- width: 3,
- decoration: BoxDecoration(
- color: accent,
- borderRadius: BorderRadius.circular(2),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Material(
+ color: highlighted
+ ? Colors.white.withValues(alpha: .10)
+ : Colors.transparent,
+ borderRadius: BorderRadius.circular(terminal ? 0 : 6),
+ // No clip: nothing in a row overflows it, and an antialiased rounded clip
+ // per row was paid again on every arrow key.
+ child: Stack(
+ children: [
+ child,
+ if (highlighted && !terminal)
+ Positioned(
+ left: 0,
+ top: 7,
+ bottom: 7,
+ child: Container(
+ width: 3,
+ decoration: BoxDecoration(
+ color: accent,
+ borderRadius: BorderRadius.circular(2),
+ ),
),
),
- ),
- ],
- ),
- );
+ ],
+ ),
+ );
+ }
}
/// One entry of the bottom line: the key, what it does, and — because a key
@@ -253,6 +260,7 @@ class BoxHintStrip extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
Widget? notice;
if (message case final message?) {
notice = Padding(
@@ -274,7 +282,6 @@ class BoxHintStrip extends StatelessWidget {
maxLines: 3,
minLines: 1,
style: boxMonoStyle(
- size: 12,
color: isError ? Colors.orangeAccent : Colors.white70,
),
),
@@ -299,7 +306,7 @@ class BoxHintStrip extends StatelessWidget {
borderRadius: BorderRadius.circular(5),
onTap: hint.onTap,
child: Padding(
- // 11px text + 2×7 = a target a hand can hit (≥24px).
+ // Keep a useful pointer target even at the smallest font setting.
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 7,
@@ -465,19 +472,24 @@ class _ReadlineKeysState extends State<ReadlineKeys> {
}
@override
- Widget build(BuildContext context) => CallbackShortcuts(
- bindings: {
- const SingleActivator(LogicalKeyboardKey.keyW, control: true): _killWord,
- const SingleActivator(LogicalKeyboardKey.keyU, control: true): _killLine,
- const SingleActivator(LogicalKeyboardKey.keyH, control: true): () =>
- _deleteCharacter(backwards: true),
- const SingleActivator(LogicalKeyboardKey.keyD, control: true): () =>
- _deleteCharacter(backwards: false),
- const SingleActivator(LogicalKeyboardKey.keyY, control: true): () {
- final (start, end) = _span;
- if (_killed.isNotEmpty) _edit(start, end, insert: _killed);
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return CallbackShortcuts(
+ bindings: {
+ const SingleActivator(LogicalKeyboardKey.keyW, control: true):
+ _killWord,
+ const SingleActivator(LogicalKeyboardKey.keyU, control: true):
+ _killLine,
+ const SingleActivator(LogicalKeyboardKey.keyH, control: true): () =>
+ _deleteCharacter(backwards: true),
+ const SingleActivator(LogicalKeyboardKey.keyD, control: true): () =>
+ _deleteCharacter(backwards: false),
+ const SingleActivator(LogicalKeyboardKey.keyY, control: true): () {
+ final (start, end) = _span;
+ if (_killed.isNotEmpty) _edit(start, end, insert: _killed);
+ },
},
- },
- child: widget.child,
- );
+ child: widget.child,
+ );
+ }
}
diff --git a/desktop/lib/widgets/codex_profile_field.dart b/desktop/lib/widgets/codex_profile_field.dart
index cccd62f9f..bb7d8dc27 100644
--- a/desktop/lib/widgets/codex_profile_field.dart
+++ b/desktop/lib/widgets/codex_profile_field.dart
@@ -4,6 +4,7 @@ import 'package:file_selector/file_selector.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/codex_profiles.dart';
import '../state/app_state.dart';
@@ -184,6 +185,7 @@ class _CodexProfileFieldState extends State<CodexProfileField> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
// Default is launch behavior, not another discovered account folder.
final choices = {
for (final profile in _profiles) profile.path: profile,
@@ -192,7 +194,8 @@ class _CodexProfileFieldState extends State<CodexProfileField> {
const refreshValue = '__refresh_profiles__';
final height = math.max(
34.0,
- MediaQuery.textScalerOf(context).scale(13) * 1.35 + 14,
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) * 1.35 +
+ 14,
);
return Wrap(
spacing: 8,
@@ -200,9 +203,7 @@ class _CodexProfileFieldState extends State<CodexProfileField> {
crossAxisAlignment: WrapCrossAlignment.center,
children: [
SizedBox(
- width:
- 252 *
- math.min(1.4, MediaQuery.textScalerOf(context).scale(13) / 13),
+ width: 252 * math.min(1.4, terminalTextScaleOf(context)),
height: height,
child: AppSelectField<String>(
key: const Key('new-agent-codex-profile-field'),
@@ -240,10 +241,7 @@ class _CodexProfileFieldState extends State<CodexProfileField> {
overflow: TextOverflow.ellipsis,
style:
widget.textStyle ??
- TextStyle(
- fontSize: 13,
- color: grid.AppPalette.textPrimary,
- ),
+ terminalTextStyle(color: grid.AppPalette.textPrimary),
),
),
const SizedBox(width: 8),
@@ -262,22 +260,15 @@ class _CodexProfileFieldState extends State<CodexProfileField> {
foregroundColor: grid.AppPalette.textSecondary,
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
minimumSize: const Size(0, 32),
- textStyle:
- widget.textStyle ??
- TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 13,
- ),
+ textStyle: widget.textStyle ?? terminalTextStyle(),
),
child: Text(_linking ? 'Adding…' : 'Add'),
),
if (_error != null)
Text(
_error!,
- style: TextStyle(
+ style: terminalTextStyle(
color: Theme.of(context).colorScheme.error,
- fontSize: 12,
),
),
],
diff --git a/desktop/lib/widgets/delete_agent_dialog.dart b/desktop/lib/widgets/delete_agent_dialog.dart
index e9db57f64..d9892980b 100644
--- a/desktop/lib/widgets/delete_agent_dialog.dart
+++ b/desktop/lib/widgets/delete_agent_dialog.dart
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import '../shortcuts/app_keymap.dart';
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'engine_identity.dart';
import 'terminal_prompt.dart';
@@ -134,108 +134,112 @@ class _StopAgentPromptState extends State<_StopAgentPrompt> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => TerminalPromptKeys(
- focusNode: _promptFocus,
- cancel: _close,
- pageDown: () => _page(1),
- pageUp: () => _page(-1),
- child: TerminalPrompt(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: SingleChildScrollView(
- controller: _body,
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- widget.terminal ? 'Stop Terminal' : 'Stop Harness',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- const SizedBox(height: 12),
- Text(
- widget.name,
- style: boxMonoStyle(weight: FontWeight.w600),
- ),
- if (widget.notifier
- .stateOf(widget.machineId)
- ?.machine
- .displayName
- case final machine?) ...[
- const SizedBox(height: 4),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => TerminalPromptKeys(
+ focusNode: _promptFocus,
+ cancel: _close,
+ pageDown: () => _page(1),
+ pageUp: () => _page(-1),
+ child: TerminalPrompt(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: SingleChildScrollView(
+ controller: _body,
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
Text(
- machine,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ widget.terminal ? 'Stop Terminal' : 'Stop Harness',
+ style: boxMonoStyle(color: kBoxFaint),
),
- ],
- const SizedBox(height: 10),
- Text(
- widget.terminal
- ? 'End this shell and anything running in it? Files are kept.'
- : 'Stop this harness? Project files and saved conversation history are kept.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
- ),
- const SizedBox(height: 8),
- Text(
- 'Its panes close across tabs. Close Pane keeps it running.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- if (_stopping) ...[
const SizedBox(height: 12),
Text(
- 'Stopping continues if you close this prompt.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ widget.name,
+ style: boxMonoStyle(weight: FontWeight.w600),
+ ),
+ if (widget.notifier
+ .stateOf(widget.machineId)
+ ?.machine
+ .displayName
+ case final machine?) ...[
+ const SizedBox(height: 4),
+ Text(machine, style: boxMonoStyle(color: kBoxFaint)),
+ ],
+ const SizedBox(height: 10),
+ Text(
+ widget.terminal
+ ? 'End this shell and anything running in it? Files are kept.'
+ : 'Stop this harness? Project files and saved conversation history are kept.',
+ style: boxMonoStyle(color: Colors.white70),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ 'Its panes close across tabs. Close Pane keeps it running.',
+ style: boxMonoStyle(color: kBoxFaint),
),
+ if (_stopping) ...[
+ const SizedBox(height: 12),
+ Text(
+ 'Stopping continues if you close this prompt.',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
],
- ],
- ),
- ),
- ),
- if (!_stopping)
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 0, 14, 10),
- child: Wrap(
- spacing: 12,
- children: [
- terminalPromptButton('Cancel', _close, focusNode: _cancel),
- terminalPromptButton(
- 'Stop',
- _stop,
- danger: true,
- key: const Key('agent-stop-confirm'),
- ),
- ],
+ ),
),
),
- BoxHintStrip(
- message: _error ?? (_stopping ? 'Stopping…' : null),
- isError: _error != null,
- hints: [
- if (!_stopping)
- BoxHint(
- terminalPromptHint(context, 'picker.accept', 'enter'),
- 'select',
+ if (!_stopping)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 0, 14, 10),
+ child: Wrap(
+ spacing: 12,
+ children: [
+ terminalPromptButton(
+ 'Cancel',
+ _close,
+ focusNode: _cancel,
+ ),
+ terminalPromptButton(
+ 'Stop',
+ _stop,
+ danger: true,
+ key: const Key('agent-stop-confirm'),
+ ),
+ ],
),
- if (!_stopping)
+ ),
+ BoxHintStrip(
+ message: _error ?? (_stopping ? 'Stopping…' : null),
+ isError: _error != null,
+ hints: [
+ if (!_stopping)
+ BoxHint(
+ terminalPromptHint(context, 'picker.accept', 'enter'),
+ 'select',
+ ),
+ if (!_stopping)
+ BoxHint(
+ terminalPromptHint(context, 'picker.complete', 'tab'),
+ 'controls',
+ ),
BoxHint(
- terminalPromptHint(context, 'picker.complete', 'tab'),
- 'controls',
+ terminalPromptHint(context, 'picker.cancel', 'esc'),
+ 'close',
+ onTap: _close,
),
- BoxHint(
- terminalPromptHint(context, 'picker.cancel', 'esc'),
- 'close',
- onTap: _close,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/device_row.dart b/desktop/lib/widgets/device_row.dart
index 05b7bcc83..a51ceda6d 100644
--- a/desktop/lib/widgets/device_row.dart
+++ b/desktop/lib/widgets/device_row.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
@@ -86,11 +87,8 @@ class _DeviceRowState extends State<DeviceRow> {
children: [
Text(
'DEVICE',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 9.5,
fontWeight: grid.AppFont.semibold,
letterSpacing: 0.7,
),
@@ -118,12 +116,7 @@ class _DeviceRowState extends State<DeviceRow> {
/// The value line, in its three readings.
Widget _line(DialStatus status, bool invite) {
- final base = TextStyle(
- color: grid.AppPalette.textSecondary,
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 12.5,
- );
+ final base = terminalTextStyle(color: grid.AppPalette.textSecondary);
if (invite) {
return Text.rich(
TextSpan(
@@ -185,6 +178,7 @@ class _Dot extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final color = live ? grid.AppPalette.online : grid.AppPalette.textFaint;
return SizedBox(
width: 32,
@@ -229,10 +223,8 @@ class _DeviceStatusCard extends StatelessWidget {
builder: (context, _) {
final status = notifier.dial.status;
final updating = status.updating;
- final sub = TextStyle(
+ final sub = terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontFamily: grid.AppFont.sans,
- fontSize: 12.5,
height: 1.45,
);
return Dialog(
@@ -259,10 +251,8 @@ class _DeviceStatusCard extends StatelessWidget {
children: [
Text(
'Harness device',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontFamily: grid.AppFont.sans,
- fontSize: 15,
fontWeight: grid.AppFont.semibold,
),
),
@@ -318,10 +308,8 @@ class _DeviceStatusCard extends StatelessWidget {
updating != null
? 'Keep it plugged in'
: 'Settings are on the device',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontFamily: grid.AppFont.sans,
- fontSize: 13.5,
),
),
const SizedBox(height: 2),
@@ -329,10 +317,8 @@ class _DeviceStatusCard extends StatelessWidget {
updating != null
? 'The update goes over the cable and takes about a minute.'
: 'Swipe to its last screen: brightness, voice language, reset.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 11.5,
height: 1.4,
),
),
@@ -352,10 +338,8 @@ class _DeviceStatusCard extends StatelessWidget {
status.attached
? 'Want one for another desk?'
: 'Plug it into this Mac to use it.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 12,
),
),
),
@@ -368,10 +352,8 @@ class _DeviceStatusCard extends StatelessWidget {
),
child: Text(
'Get the device →',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.accentOnSurface,
- fontFamily: grid.AppFont.sans,
- fontSize: 12.5,
fontWeight: grid.AppFont.medium,
),
),
@@ -396,6 +378,7 @@ class _Dial extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Container(
width: 56,
height: 56,
diff --git a/desktop/lib/widgets/dsh_install_panel.dart b/desktop/lib/widgets/dsh_install_panel.dart
index accff5080..ea808d9b6 100644
--- a/desktop/lib/widgets/dsh_install_panel.dart
+++ b/desktop/lib/widgets/dsh_install_panel.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/dsh_catalog.dart';
import '../core/test_run.dart';
@@ -106,8 +107,7 @@ class _DshInstallPanelState extends State<DshInstallPanel> {
run.done
? '${widget.harnessName} installed on ${widget.machineName}'
: 'Installing ${widget.harnessName} on ${widget.machineName}',
- style: TextStyle(
- fontSize: 13.5,
+ style: terminalTextStyle(
fontWeight: grid.AppFont.semibold,
color: grid.AppPalette.textPrimary,
),
@@ -115,8 +115,7 @@ class _DshInstallPanelState extends State<DshInstallPanel> {
),
Text(
_clock(elapsed),
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
fontFeatures: const [FontFeature.tabularFigures()],
),
@@ -163,10 +162,7 @@ class _DshInstallPanelState extends State<DshInstallPanel> {
: run.done
? 'Starting the harness…'
: 'The first install takes a few minutes. You can keep using Harness.',
- style: TextStyle(
- fontSize: 12,
- color: grid.AppPalette.textFaint,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
),
],
@@ -413,6 +409,7 @@ class _StepRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final muted = state == _StepState.pending;
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -464,8 +461,7 @@ class _StepRow extends StatelessWidget {
children: [
Text(
step.name,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
fontWeight: grid.AppFont.medium,
color: muted
? grid.AppPalette.textFaint
@@ -479,8 +475,7 @@ class _StepRow extends StatelessWidget {
sub!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: state == _StepState.active
? grid.AppPalette.textSecondary
: grid.AppPalette.textFaint,
@@ -494,8 +489,7 @@ class _StepRow extends StatelessWidget {
const SizedBox(width: 10),
Text(
_DshInstallPanelState._short(took!),
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
fontFeatures: const [FontFeature.tabularFigures()],
),
@@ -512,6 +506,7 @@ class _LogTail extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final tail = lines.length > 6 ? lines.sublist(lines.length - 6) : lines;
return Container(
width: double.infinity,
@@ -532,10 +527,7 @@ class _LogTail extends StatelessWidget {
tail[i],
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
- fontSize: 11.5,
+ style: terminalTextStyle(
height: 1.5,
color: i == tail.length - 1
? grid.AppPalette.textSecondary
@@ -554,6 +546,7 @@ class _FailureCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final danger = grid.AppPalette.dangerFill;
return Container(
key: const Key('dsh-install-failure'),
@@ -569,8 +562,7 @@ class _FailureCard extends StatelessWidget {
children: [
Text(
failure.title,
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
fontWeight: grid.AppFont.semibold,
color: grid.AppPalette.textPrimary,
),
@@ -581,8 +573,7 @@ class _FailureCard extends StatelessWidget {
padding: const EdgeInsets.only(top: 2),
child: Text(
line,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -592,12 +583,7 @@ class _FailureCard extends StatelessWidget {
padding: const EdgeInsets.only(top: 6),
child: SelectableText(
failure.command!,
- style: TextStyle(
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
- fontSize: 11.5,
- color: grid.AppPalette.textPrimary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textPrimary),
),
),
],
diff --git a/desktop/lib/widgets/engine_identity.dart b/desktop/lib/widgets/engine_identity.dart
index 639b00f4b..87af9ca1a 100644
--- a/desktop/lib/widgets/engine_identity.dart
+++ b/desktop/lib/widgets/engine_identity.dart
@@ -2,6 +2,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/harness_catalog.dart';
import '../core/models.dart';
@@ -932,6 +933,7 @@ class EngineMark extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final identity = engineIdentity(engine, displayName: displayName);
final mark = identity.asset != null
? Image.asset(
@@ -1001,6 +1003,7 @@ class _InitialMark extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return SizedBox.square(
dimension: size,
child: Center(
@@ -1011,14 +1014,11 @@ class _InitialMark extends StatelessWidget {
// glyph would grow while its 17px square did not, and the letter would
// clip out of its own mark.
textScaler: TextScaler.noScaling,
- style: TextStyle(
+ style: terminalTextStyle(
color: identity.color,
// The app's mono stack, not a literal: `Menlo` names nothing on
// Linux, so this initial was drawn in the proportional default
// while every mark beside it was monospaced.
- fontFamily: AppFonts.mono,
- fontFamilyFallback: AppFonts.monoFallback,
- fontSize: size * 0.68,
height: 1,
fontWeight: FontWeight.w700,
),
diff --git a/desktop/lib/widgets/environment_setup_screen.dart b/desktop/lib/widgets/environment_setup_screen.dart
index d7f06bafb..d317c006d 100644
--- a/desktop/lib/widgets/environment_setup_screen.dart
+++ b/desktop/lib/widgets/environment_setup_screen.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../bootstrap/environment_provisioner.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -159,24 +160,19 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
children: [
Text(
eyebrow.toUpperCase(),
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.accent,
- fontSize: 11,
fontWeight: FontWeight.w700,
letterSpacing: 1.4,
),
),
const SizedBox(height: 6),
- Text(
- title,
- style: const TextStyle(fontSize: 28, fontWeight: FontWeight.w600),
- ),
+ Text(title, style: terminalTextStyle(fontWeight: FontWeight.w600)),
const SizedBox(height: 8),
Text(lead, style: TextStyle(color: AppColors.textSoft, height: 1.55)),
const SizedBox(height: 16),
],
);
-
Widget _preflight(EnvironmentReadiness state) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -376,7 +372,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
'Every dependency is ready. Continue to final verification.',
);
}
- final stacked = MediaQuery.textScalerOf(context).scale(1) > 1.25;
+ final stacked = terminalTextScaleOf(context) > 1.25;
return _Panel(
child: Column(
children: [
@@ -387,19 +383,13 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
radius: 14,
backgroundColor: AppColors.hover,
foregroundColor: AppColors.text,
- child: Text(
- '${index + 1}',
- style: const TextStyle(fontSize: 11),
- ),
- ),
- title: Text(
- items[index].title,
- style: const TextStyle(fontSize: 13),
+ child: Text('${index + 1}', style: terminalTextStyle()),
),
+ title: Text(items[index].title, style: terminalTextStyle()),
subtitle: stacked
? Text(
items[index].detail,
- style: TextStyle(color: AppColors.textSoft, fontSize: 11),
+ style: terminalTextStyle(color: AppColors.textSoft),
)
: null,
trailing: stacked
@@ -411,7 +401,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
- style: TextStyle(color: AppColors.muted, fontSize: 11),
+ style: terminalTextStyle(color: AppColors.muted),
),
),
),
@@ -438,10 +428,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
children: [
Text(
'${index + 1} · ${items[index].title}',
- style: const TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w600,
- ),
+ style: terminalTextStyle(fontWeight: FontWeight.w600),
),
const SizedBox(height: 9),
CommandRow(
@@ -475,10 +462,10 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
onExpansionChanged: (open) => setState(() => _detailsOpen = open),
title: Row(
children: [
- const Expanded(
+ Expanded(
child: Text(
'Setup details',
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600),
+ style: terminalTextStyle(fontWeight: FontWeight.w600),
),
),
TextButton.icon(
@@ -499,9 +486,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
padding: const EdgeInsets.all(14),
child: SelectableText(
diagnostics,
- style: TextStyle(
- fontFamily: AppFonts.mono,
- fontSize: 11,
+ style: terminalTextStyle(
height: 1.55,
color: AppColors.textSoft,
),
@@ -533,17 +518,13 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
children: [
Text(
title,
- style: const TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w600,
- ),
+ style: terminalTextStyle(fontWeight: FontWeight.w600),
),
const SizedBox(height: 4),
Text(
detail,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.textSoft,
- fontSize: 12,
height: 1.45,
),
),
@@ -633,9 +614,8 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
liveRegion: _copyError != null,
child: Text(
_copyError ?? 'Next: sign in and start a harness.',
- style: TextStyle(
+ style: terminalTextStyle(
color: _copyError == null ? AppColors.textSoft : AppColors.danger,
- fontSize: 11,
),
),
);
@@ -648,7 +628,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
child: LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600 ||
- MediaQuery.textScalerOf(context).scale(1) > 1.25) {
+ terminalTextScaleOf(context) > 1.25) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -674,17 +654,20 @@ class _Panel extends StatelessWidget {
const _Panel({required this.child, this.padding = EdgeInsets.zero});
@override
- Widget build(BuildContext context) => Container(
- width: double.infinity,
- padding: padding,
- clipBehavior: Clip.antiAlias,
- decoration: BoxDecoration(
- color: AppColors.surface,
- border: Border.all(color: AppColors.border),
- borderRadius: BorderRadius.circular(11),
- ),
- child: child,
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Container(
+ width: double.infinity,
+ padding: padding,
+ clipBehavior: Clip.antiAlias,
+ decoration: BoxDecoration(
+ color: AppColors.surface,
+ border: Border.all(color: AppColors.border),
+ borderRadius: BorderRadius.circular(11),
+ ),
+ child: child,
+ );
+ }
}
class _CheckSectionLabel extends StatelessWidget {
@@ -692,23 +675,25 @@ class _CheckSectionLabel extends StatelessWidget {
const _CheckSectionLabel(this.label);
@override
- Widget build(BuildContext context) => Container(
- width: double.infinity,
- padding: const EdgeInsets.fromLTRB(16, 11, 16, 8),
- decoration: BoxDecoration(
- color: AppColors.background.withValues(alpha: 0.28),
- border: Border(bottom: BorderSide(color: AppColors.border)),
- ),
- child: Text(
- label.toUpperCase(),
- style: TextStyle(
- color: AppColors.textSoft,
- fontSize: 10,
- fontWeight: FontWeight.w700,
- letterSpacing: 1.1,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Container(
+ width: double.infinity,
+ padding: const EdgeInsets.fromLTRB(16, 11, 16, 8),
+ decoration: BoxDecoration(
+ color: AppColors.background.withValues(alpha: 0.28),
+ border: Border(bottom: BorderSide(color: AppColors.border)),
),
- ),
- );
+ child: Text(
+ label.toUpperCase(),
+ style: terminalTextStyle(
+ color: AppColors.textSoft,
+ fontWeight: FontWeight.w700,
+ letterSpacing: 1.1,
+ ),
+ ),
+ );
+ }
}
class _CheckRow extends StatelessWidget {
@@ -725,6 +710,7 @@ class _CheckRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final color = switch (status) {
EnvironmentStepStatus.ready => AppColors.success,
EnvironmentStepStatus.failed => AppColors.danger,
@@ -765,16 +751,10 @@ class _CheckRow extends StatelessWidget {
children: [
Text(
label,
- style: const TextStyle(
- fontSize: 13,
- fontWeight: FontWeight.w500,
- ),
+ style: terminalTextStyle(fontWeight: FontWeight.w500),
),
const SizedBox(height: 3),
- Text(
- detail,
- style: TextStyle(color: AppColors.muted, fontSize: 11),
- ),
+ Text(detail, style: terminalTextStyle(color: AppColors.muted)),
],
),
),
@@ -785,7 +765,7 @@ class _CheckRow extends StatelessWidget {
EnvironmentStepStatus.running => 'Working',
EnvironmentStepStatus.notApplicable => 'Not applicable',
_ => checking ? 'Checking' : 'Required',
- }, style: TextStyle(color: color, fontSize: 11)),
+ }, style: terminalTextStyle(color: color)),
],
),
);
diff --git a/desktop/lib/widgets/export_logs_dialog.dart b/desktop/lib/widgets/export_logs_dialog.dart
index 673c403f7..b5bddbcc5 100644
--- a/desktop/lib/widgets/export_logs_dialog.dart
+++ b/desktop/lib/widgets/export_logs_dialog.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/harness_cli_runner.dart';
import '../core/reveal_folder.dart';
@@ -120,18 +121,16 @@ class _ExportLogsDialogState extends State<_ExportLogsDialog> {
const SizedBox(height: 12),
Text(
title,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 15,
fontWeight: grid.AppFont.semibold,
),
),
const SizedBox(height: 5),
SelectableText(
body,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 12.5,
height: 1.5,
),
),
@@ -172,10 +171,10 @@ class _Label extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Text(
text,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
fontWeight: grid.AppFont.medium,
color: ToolbarPill.tint(tinted: tinted, enabled: true),
),
diff --git a/desktop/lib/widgets/flash_firmware_dialog.dart b/desktop/lib/widgets/flash_firmware_dialog.dart
index 103f6e871..8a4a29a55 100644
--- a/desktop/lib/widgets/flash_firmware_dialog.dart
+++ b/desktop/lib/widgets/flash_firmware_dialog.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../flash/flasher.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -254,18 +255,16 @@ class _FlashDialogState extends State<_FlashDialog> {
children: [
Text(
title,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 15,
fontWeight: grid.AppFont.semibold,
),
),
const SizedBox(height: 3),
Text(
sub,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 12.5,
height: 1.5,
),
),
@@ -335,17 +334,14 @@ class _FlashDialogState extends State<_FlashDialog> {
width: 104,
child: Text(
label,
- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 11.5),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
),
Expanded(
child: Text(
value,
- style: TextStyle(
+ style: terminalTextStyle(
color: tone ?? grid.AppPalette.textSecondary,
- fontSize: 11.5,
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
),
),
),
@@ -361,10 +357,7 @@ class _FlashDialogState extends State<_FlashDialog> {
children: [
Text(
'More than one board is connected — pick one:',
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 12,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
const SizedBox(height: 7),
for (final port in _ports)
@@ -399,9 +392,8 @@ class _FlashDialogState extends State<_FlashDialog> {
Expanded(
child: RichText(
text: TextSpan(
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11.5,
height: 1.5,
),
children: [
@@ -468,18 +460,14 @@ class _FlashDialogState extends State<_FlashDialog> {
const SizedBox(width: 8),
Text(
'Output',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11.5,
),
),
const Spacer(),
Text(
'flash-circle.sh',
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontSize: 11.5,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
],
),
@@ -501,12 +489,7 @@ class _FlashDialogState extends State<_FlashDialog> {
),
],
),
- style: TextStyle(
- fontSize: 11,
- height: 1.62,
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
- ),
+ style: terminalTextStyle(height: 1.62),
),
),
),
@@ -693,7 +676,7 @@ class _StepRow extends StatelessWidget {
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(color: ink, fontSize: 12.5),
+ style: terminalTextStyle(color: ink),
),
),
],
@@ -740,8 +723,7 @@ class _DialogButton extends StatelessWidget {
? BorderSide(color: grid.AppGlass.hair)
: BorderSide.none,
),
- textStyle: TextStyle(
- fontSize: 12,
+ textStyle: terminalTextStyle(
fontWeight: primary ? grid.AppFont.semibold : grid.AppFont.regular,
),
),
@@ -798,12 +780,7 @@ class _PortChoice extends StatelessWidget {
const SizedBox(width: 9),
Text(
port,
- style: TextStyle(
- color: grid.AppPalette.textPrimary,
- fontSize: 12,
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textPrimary),
),
],
),
diff --git a/desktop/lib/widgets/fork_agent_dialog.dart b/desktop/lib/widgets/fork_agent_dialog.dart
index 2bd4e8650..02225cb25 100644
--- a/desktop/lib/widgets/fork_agent_dialog.dart
+++ b/desktop/lib/widgets/fork_agent_dialog.dart
@@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
import '../core/agent_names.dart';
import '../shortcuts/app_keymap.dart';
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'terminal_prompt.dart';
@@ -313,137 +313,138 @@ class _ForkAgentPromptState extends State<_ForkAgentPrompt> {
);
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => TerminalPromptKeys(
- composing: () => _composing,
- inputFocus: _nameFocus.hasFocus ? _nameFocus : _taskFocus,
- cancel: _close,
- accept: _accept,
- submit: _submit,
- next: () => _vertical(1),
- previous: () => _vertical(-1),
- pageDown: () => _page(1),
- pageUp: () => _page(-1),
- child: CallbackShortcuts(
- bindings: {
- const SingleActivator(LogicalKeyboardKey.enter, alt: true): _newline,
- if (KeymapTheme.of(context) == null)
- const SingleActivator(LogicalKeyboardKey.enter, meta: true):
- _submit,
- },
- child: TerminalPrompt(
- width: 760,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: SingleChildScrollView(
- controller: _body,
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- 'Fork Harness',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- const SizedBox(height: 10),
- Text(
- 'from ${_attempt.source?.name ?? widget.sourceName}',
- style: boxMonoStyle(),
- ),
- if (widget.notifier
- .stateOf(widget.machineId)
- ?.machine
- .displayName
- case final machine?)
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => TerminalPromptKeys(
+ composing: () => _composing,
+ inputFocus: _nameFocus.hasFocus ? _nameFocus : _taskFocus,
+ cancel: _close,
+ accept: _accept,
+ submit: _submit,
+ next: () => _vertical(1),
+ previous: () => _vertical(-1),
+ pageDown: () => _page(1),
+ pageUp: () => _page(-1),
+ child: CallbackShortcuts(
+ bindings: {
+ const SingleActivator(LogicalKeyboardKey.enter, alt: true):
+ _newline,
+ if (KeymapTheme.of(context) == null)
+ const SingleActivator(LogicalKeyboardKey.enter, meta: true):
+ _submit,
+ },
+ child: TerminalPrompt(
+ width: 760,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: SingleChildScrollView(
+ controller: _body,
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
Text(
- [
- machine,
- if (_attempt.source?.project?.cwd case final cwd?
- when cwd.isNotEmpty)
- cwd,
- ].join(' '),
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ 'Fork Harness',
+ style: boxMonoStyle(color: kBoxFaint),
),
- const SizedBox(height: 6),
- Text(
- widget.engine == 'opencode'
- ? 'Starts from a handoff summary, in the same project folder.'
- : 'Continues the conversation in the same project folder.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- const SizedBox(height: 8),
- _input('name', _name, _nameFocus),
- _input('task', _task, _taskFocus, task: true),
- if (_error case final error?) ...[
- const SizedBox(height: 8),
+ const SizedBox(height: 10),
Text(
- error,
- style: boxMonoStyle(
- size: 12,
- color: Colors.orangeAccent,
- ),
+ 'from ${_attempt.source?.name ?? widget.sourceName}',
+ style: boxMonoStyle(),
),
- ],
- if (_busy)
+ if (widget.notifier
+ .stateOf(widget.machineId)
+ ?.machine
+ .displayName
+ case final machine?)
+ Text(
+ [
+ machine,
+ if (_attempt.source?.project?.cwd case final cwd?
+ when cwd.isNotEmpty)
+ cwd,
+ ].join(' '),
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ const SizedBox(height: 6),
Text(
- 'Forking continues if you close this prompt.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ widget.engine == 'opencode'
+ ? 'Starts from a handoff summary, in the same project folder.'
+ : 'Continues the conversation in the same project folder.',
+ style: boxMonoStyle(color: kBoxFaint),
),
- ],
- ),
- ),
- ),
- if (_attempt.awaitingConfirmation && !_busy)
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
- child: Align(
- alignment: Alignment.centerLeft,
- child: terminalPromptButton(
- 'Start another fork',
- _startAnother,
- key: const Key('fork-start-another'),
+ const SizedBox(height: 8),
+ _input('name', _name, _nameFocus),
+ _input('task', _task, _taskFocus, task: true),
+ if (_error case final error?) ...[
+ const SizedBox(height: 8),
+ Text(
+ error,
+ style: boxMonoStyle(color: Colors.orangeAccent),
+ ),
+ ],
+ if (_busy)
+ Text(
+ 'Forking continues if you close this prompt.',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
),
),
),
- BoxHintStrip(
- message: _busy
- ? 'Waiting for fork…'
- : (_attempt.awaitingConfirmation
- ? 'Fork may already exist.'
- : null),
- isError: !_busy && _attempt.awaitingConfirmation,
- hints: [
- if (!_busy)
- BoxHint(
- terminalPromptHint(context, 'picker.accept', 'enter'),
- _attempt.awaitingConfirmation
- ? 'check status'
- : (_nameFocus.hasFocus ? 'edit task' : 'fork'),
- onTap: _nameFocus.hasFocus
- ? _taskFocus.requestFocus
- : _submit,
+ if (_attempt.awaitingConfirmation && !_busy)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: terminalPromptButton(
+ 'Start another fork',
+ _startAnother,
+ key: const Key('fork-start-another'),
+ ),
),
- if (!_locked)
+ ),
+ BoxHintStrip(
+ message: _busy
+ ? 'Waiting for fork…'
+ : (_attempt.awaitingConfirmation
+ ? 'Fork may already exist.'
+ : null),
+ isError: !_busy && _attempt.awaitingConfirmation,
+ hints: [
+ if (!_busy)
+ BoxHint(
+ terminalPromptHint(context, 'picker.accept', 'enter'),
+ _attempt.awaitingConfirmation
+ ? 'check status'
+ : (_nameFocus.hasFocus ? 'edit task' : 'fork'),
+ onTap: _nameFocus.hasFocus
+ ? _taskFocus.requestFocus
+ : _submit,
+ ),
+ if (!_locked)
+ BoxHint(
+ terminalPromptHint(context, 'picker.complete', 'tab'),
+ 'fields',
+ ),
+ if (!_locked) const BoxHint('alt-enter', 'newline'),
BoxHint(
- terminalPromptHint(context, 'picker.complete', 'tab'),
- 'fields',
+ terminalPromptHint(context, 'picker.cancel', 'esc'),
+ 'close',
+ onTap: _close,
),
- if (!_locked) const BoxHint('alt-enter', 'newline'),
- BoxHint(
- terminalPromptHint(context, 'picker.cancel', 'esc'),
- 'close',
- onTap: _close,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/grid_model_picker.dart b/desktop/lib/widgets/grid_model_picker.dart
index 7b508d00f..bbdc21ee1 100644
--- a/desktop/lib/widgets/grid_model_picker.dart
+++ b/desktop/lib/widgets/grid_model_picker.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../core/test_run.dart';
@@ -303,8 +304,9 @@ class _GridModelPickerState extends State<GridModelPicker> {
if (widget.currentModel != null) widget.onUseOwnLogin?.call();
return;
}
- if (chosen.model!.id != widget.currentModel)
+ if (chosen.model!.id != widget.currentModel) {
widget.onSelected?.call(chosen.model!);
+ }
}
/// What the Local section says when it lists nothing.
@@ -402,6 +404,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final sentence = _webSearchSentence;
if (widget.compact) {
return IconButton(
@@ -466,7 +469,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
],
Text(
'Model',
- style: TextStyle(fontSize: 11, color: AppColors.textSoft),
+ style: terminalTextStyle(color: AppColors.textSoft),
),
Icon(
Icons.arrow_drop_down,
@@ -507,6 +510,7 @@ class _ManagerInvitationState extends State<_ManagerInvitation> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Padding(
// Wider than a row's inset on purpose: this block is not one of them.
padding: const EdgeInsets.fromLTRB(
@@ -527,10 +531,7 @@ class _ManagerInvitationState extends State<_ManagerInvitation> {
child: Text(
'Manage the models on your machines',
textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 10.5,
- color: AppColors.mutedStrong,
- ),
+ style: terminalTextStyle(color: AppColors.mutedStrong),
),
),
const SizedBox(width: 8),
@@ -556,8 +557,7 @@ class _ManagerInvitationState extends State<_ManagerInvitation> {
),
child: Text(
'Open Grid',
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
fontWeight: FontWeight.w500,
color: _hovered ? AppColors.text : AppColors.textSoft,
),
diff --git a/desktop/lib/widgets/harness_command_bar.dart b/desktop/lib/widgets/harness_command_bar.dart
index 3686f73ee..460bf9f62 100644
--- a/desktop/lib/widgets/harness_command_bar.dart
+++ b/desktop/lib/widgets/harness_command_bar.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../state/command_bar.dart';
@@ -196,8 +197,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
enabled: controller.phase != CommandPhase.executing,
autofocus: !widget.compact,
maxLength: 2000,
- style: TextStyle(
- fontSize: widget.compact ? 14 : 17,
+ style: terminalTextStyle(
color: grid.AppPalette.commandInk,
),
cursorColor: grid.AppPalette.commandInk,
@@ -208,8 +208,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
hintText: narrow
? 'Ask Harness…'
: 'Ask, find, or make something happen',
- hintStyle: TextStyle(
- fontSize: widget.compact ? 14 : 17,
+ hintStyle: terminalTextStyle(
color: grid.AppPalette.commandMuted,
),
border: InputBorder.none,
@@ -275,8 +274,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
const SizedBox(width: 7),
Text(
_findOnly ? 'Find' : 'Auto',
- style: const TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
fontWeight: FontWeight.w500,
color: grid.AppPalette.commandInk,
),
@@ -335,8 +333,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
const SizedBox(width: 6),
Text(
'JEV · OpenRouter',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -362,14 +359,13 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
),
style: TextButton.styleFrom(
foregroundColor: grid.AppPalette.textSecondary,
- textStyle: const TextStyle(fontSize: 11),
+ textStyle: terminalTextStyle(),
),
),
if (!widget.compact && !watchesVisible)
Text(
'⌘⇧J · toggle Esc · close',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -417,8 +413,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
liveRegion: true,
child: Text(
controller.message,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
@@ -427,10 +422,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
if (controller.elapsedMs != null)
Text(
'${(controller.elapsedMs! / 1000).toStringAsFixed(1)}s',
- style: TextStyle(
- fontSize: 11,
- color: grid.AppPalette.textFaint,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
IconButton(
visualDensity: VisualDensity.compact,
@@ -449,8 +441,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
liveRegion: true,
child: Text(
controller.error!,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.5,
color: grid.AppPalette.textPrimary,
),
@@ -542,8 +533,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
action.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14,
+ style: terminalTextStyle(
fontWeight: FontWeight.w500,
color: grid.AppPalette.textPrimary,
),
@@ -553,8 +543,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
action.detail,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
height: 1.4,
color: grid.AppPalette.textSecondary,
),
@@ -570,7 +559,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
: () => unawaited(controller.choose(action)),
child: Text(
action.buttonLabel,
- style: const TextStyle(fontSize: 12),
+ style: terminalTextStyle(),
),
),
],
@@ -581,8 +570,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
'“${controller.query}”',
maxLines: 3,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.5,
color: grid.AppPalette.textPrimary,
),
@@ -592,8 +580,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
padding: const EdgeInsets.only(top: 8),
child: Text(
'Current sessions only · checks changed activity once a minute · alerts appear here',
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
),
),
@@ -608,8 +595,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
action.context,
maxLines: 4,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
height: 1.5,
color: grid.AppPalette.textSecondary,
),
@@ -651,7 +637,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
watch.prompt,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 13),
+ style: terminalTextStyle(),
),
),
IconButton(
@@ -666,8 +652,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {
(watch.checking
? 'Checking recent activity…'
: '${watch.matches.length} matches · watching ${watch.scope.length} sessions'),
- style: TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
),
),
diff --git a/desktop/lib/widgets/harness_customize_pane.dart b/desktop/lib/widgets/harness_customize_pane.dart
index a2f412a40..d50b8bd3d 100644
--- a/desktop/lib/widgets/harness_customize_pane.dart
+++ b/desktop/lib/widgets/harness_customize_pane.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../settings/sections/appearance_section.dart';
import '../settings/sections/terminal_section.dart';
@@ -20,7 +21,7 @@ Future<void> showHarnessCustomizePane(BuildContext context) =>
builder: (context) => Align(
alignment: Alignment.centerRight,
child: SizedBox(
- width: (440 * MediaQuery.textScalerOf(context).scale(13) / 13).clamp(
+ width: (440 * terminalTextScaleOf(context)).clamp(
0,
MediaQuery.sizeOf(context).width,
),
@@ -59,7 +60,6 @@ class HarnessCustomizePane extends StatelessWidget {
child: Text(
'Customize Harness',
style: boxMonoStyle(
- size: 14,
color: grid.AppPalette.textPrimary,
weight: FontWeight.w600,
),
@@ -82,7 +82,7 @@ class HarnessCustomizePane extends StatelessWidget {
unselectedLabelColor: grid.AppPalette.textSecondary,
indicatorColor: grid.AppPalette.swarmAccent,
dividerColor: grid.AppPalette.divider,
- labelStyle: boxMonoStyle(size: 12),
+ labelStyle: boxMonoStyle(),
tabs: const [
Tab(key: ValueKey('customize-prompt'), text: 'Pane'),
Tab(
diff --git a/desktop/lib/widgets/harness_join_guide_screen.dart b/desktop/lib/widgets/harness_join_guide_screen.dart
index 85b89a21b..a42f3b1d0 100644
--- a/desktop/lib/widgets/harness_join_guide_screen.dart
+++ b/desktop/lib/widgets/harness_join_guide_screen.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/widgets/command_row.dart';
import '../state/app_state.dart';
@@ -41,6 +42,7 @@ class _HarnessJoinGuideScreenState extends State<HarnessJoinGuideScreen> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final isLocal = widget.machineState.isLocalMachine;
final content = Center(
child: ConstrainedBox(
@@ -61,9 +63,8 @@ class _HarnessJoinGuideScreenState extends State<HarnessJoinGuideScreen> {
const SizedBox(height: 14),
Text(
'Harness is offline',
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontSize: 18,
fontWeight: FontWeight.w700,
),
),
diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dart
index 1480acccf..fa369670e 100644
--- a/desktop/lib/widgets/harness_start_page.dart
+++ b/desktop/lib/widgets/harness_start_page.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
@@ -255,8 +256,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
padding: const EdgeInsets.only(left: 18, right: 8),
child: Text(
'Browse the\nHarness Store',
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
height: 1.3,
fontWeight: FontWeight.w500,
color: Colors.white.withValues(alpha: .94),
@@ -310,8 +310,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
padding: const EdgeInsets.only(left: 18, right: 8),
child: Text(
'Meet the\nHarness device',
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
height: 1.3,
fontWeight: FontWeight.w500,
color: Colors.white.withValues(alpha: .94),
@@ -484,7 +483,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
onPressed: widget.onQuickStart,
child: Text(
'Quick start · 4 steps',
- style: boxMonoStyle(size: 12),
+ style: boxMonoStyle(),
),
),
if (widget.onPractice != null)
@@ -495,7 +494,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
onPressed: widget.onPractice,
child: Text(
'Keyboard practice',
- style: boxMonoStyle(size: 12),
+ style: boxMonoStyle(),
),
),
],
diff --git a/desktop/lib/widgets/layout_palette.dart b/desktop/lib/widgets/layout_palette.dart
index 67648d1cb..385b2d695 100644
--- a/desktop/lib/widgets/layout_palette.dart
+++ b/desktop/lib/widgets/layout_palette.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
@@ -215,7 +216,7 @@ class _LayoutPaletteState extends State<_LayoutPalette> {
final choices = PanePreset.forCount(count);
final current = _currentChoice(count);
final cursor = _cursorIn(choices, current);
- final textScale = MediaQuery.textScalerOf(context).scale(11.5) / 11.5;
+ final textScale = terminalTextScaleOf(context);
final shapeWidth = (_Strip.shape * textScale).clamp(_Strip.shape, 216.0);
final paletteWidth =
_Strip.width(choices.length) * textScale.clamp(1.0, 2.0);
@@ -305,9 +306,8 @@ class _LayoutPaletteState extends State<_LayoutPalette> {
padding: const EdgeInsets.fromLTRB(18, 16, 18, 12),
child: Text(
choices.isEmpty ? 'Layout' : 'Layout · $count panes',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11.5,
letterSpacing: 0.9,
fontWeight: grid.AppFont.medium,
),
@@ -319,9 +319,8 @@ class _LayoutPaletteState extends State<_LayoutPalette> {
child: Text(
'One tile has no layout to choose. Open another and the '
'shapes appear here.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 12.5,
height: 1.45,
),
),
@@ -365,9 +364,8 @@ class _LayoutPaletteState extends State<_LayoutPalette> {
child: Text(
'Arrows to move · Enter or 1–${choices.length} to apply.\n'
'Changing layout resets pane sizes.',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11,
height: 1.4,
),
),
@@ -449,6 +447,7 @@ class _ShapeButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return GestureDetector(
onTap: onTap,
child: Container(
@@ -483,21 +482,16 @@ class _ShapeButton extends StatelessWidget {
preset.label,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: selected
? grid.AppPalette.textPrimary
: grid.AppPalette.textSecondary,
- fontSize: 11.5,
),
),
const SizedBox(height: 2),
Text(
'$index',
- style: TextStyle(
- fontFamily: grid.AppFont.mono,
- fontSize: 9.5,
- color: grid.AppPalette.textSecondary,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
],
),
diff --git a/desktop/lib/widgets/link_another_machine_dialog.dart b/desktop/lib/widgets/link_another_machine_dialog.dart
index 94236b742..986de6015 100644
--- a/desktop/lib/widgets/link_another_machine_dialog.dart
+++ b/desktop/lib/widgets/link_another_machine_dialog.dart
@@ -10,7 +10,7 @@ import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
import '../shortcuts/keymap_commands.dart' show describeKeyBinding;
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'link_machine_dialog.dart';
import 'link_machine_screen.dart';
@@ -469,7 +469,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
onPressed: action,
style: TextButton.styleFrom(
foregroundColor: Colors.white70,
- textStyle: boxMonoStyle(size: 12),
+ textStyle: boxMonoStyle(),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 5),
minimumSize: const Size(0, 28),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -516,10 +516,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
weight: selected ? FontWeight.w600 : null,
),
),
- Text(
- entry.detail,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
+ Text(entry.detail, style: boxMonoStyle(color: kBoxFaint)),
],
),
),
@@ -552,7 +549,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
_command('2. Sign in as $email', kLinkServerLoginCommand),
Text(
'Open the printed sign-in link in a browser on any device.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
_command(
'3. Start Harness and set a remote password',
@@ -571,14 +568,11 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
),
),
] else ...[
- Text(
- '1. Install Harness for macOS or Linux.',
- style: boxMonoStyle(size: 12),
- ),
+ Text('1. Install Harness for macOS or Linux.', style: boxMonoStyle()),
const SizedBox(height: 4),
SelectableText(
kHarnessDownloadUrl.toString(),
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ style: boxMonoStyle(color: Colors.white70),
),
Wrap(
spacing: 8,
@@ -597,16 +591,16 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
],
),
const SizedBox(height: 10),
- Text('2. Sign in as $email.', style: boxMonoStyle(size: 12)),
+ Text('2. Sign in as $email.', style: boxMonoStyle()),
const SizedBox(height: 10),
Text(
'3. Open commands → Link machine → This computer’s password.',
- style: boxMonoStyle(size: 12),
+ style: boxMonoStyle(),
),
const SizedBox(height: 4),
Text(
'Set a remote password there, then enter it here.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
],
const SizedBox(height: 16),
@@ -614,7 +608,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
remotes.isEmpty
? 'After sign-in, the machine appears here. Refresh to check now.'
: 'Available to link',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
for (final state in remotes)
_machineRow(
@@ -635,12 +629,9 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- Text(title, style: boxMonoStyle(size: 12)),
+ Text(title, style: boxMonoStyle()),
const SizedBox(height: 4),
- SelectableText(
- command,
- style: boxMonoStyle(size: 12, color: Colors.white70),
- ),
+ SelectableText(command, style: boxMonoStyle(color: Colors.white70)),
Align(
alignment: Alignment.centerLeft,
child: _button(
@@ -655,187 +646,191 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
);
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: Listenable.merge([app, terminalFontStore]),
- builder: (context, _) {
- final rows = _entries;
- final selected = _selected;
- final message = _message ?? app.machineListError;
- return Offstage(
- offstage: _nested,
- child: Dialog(
- alignment: Alignment.topCenter,
- insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),
- elevation: 0,
- backgroundColor: Colors.transparent,
- child: _keys(
- Focus(
- onKeyEvent: _key,
- child: SizedBox(
- width: 760,
- child: TerminalBox(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 8),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Text(
- 'Link another machine${_guide == null
- ? ''
- : _guide == _Guide.server
- ? ' / SSH'
- : ' / desktop'}',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- ),
- if (_guide == null)
- Text(
- '${rows.length}/${_remotes.length + 3}',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: Listenable.merge([app, terminalFontStore]),
+ builder: (context, _) {
+ final rows = _entries;
+ final selected = _selected;
+ final message = _message ?? app.machineListError;
+ return Offstage(
+ offstage: _nested,
+ child: Dialog(
+ alignment: Alignment.topCenter,
+ insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),
+ elevation: 0,
+ backgroundColor: Colors.transparent,
+ child: _keys(
+ Focus(
+ onKeyEvent: _key,
+ child: SizedBox(
+ width: 760,
+ child: TerminalBox(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 8),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Text(
+ 'Link another machine${_guide == null
+ ? ''
+ : _guide == _Guide.server
+ ? ' / SSH'
+ : ' / desktop'}',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
),
- ],
+ if (_guide == null)
+ Text(
+ '${rows.length}/${_remotes.length + 3}',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
+ ),
),
- ),
- if (_guide == null)
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 14),
- child: ReadlineKeys(
- controller: _query,
- onChanged: _changed,
- child: TextField(
- key: const Key('link-machine-search'),
+ if (_guide == null)
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 14),
+ child: ReadlineKeys(
controller: _query,
- focusNode: _inputFocus,
- autofocus: true,
- style: boxMonoStyle(),
- textAlignVertical: TextAlignVertical.center,
- decoration: InputDecoration(
- hintText: 'find a machine / desktop / SSH',
- hintStyle: boxMonoStyle(color: kBoxFaint),
- border: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- filled: false,
- isDense: true,
- prefixIcon: Padding(
- padding: const EdgeInsets.only(right: 10),
- child: Center(
- widthFactor: 1,
- heightFactor: 1,
- child: Text(
- 'machine >',
- style: boxMonoStyle(
- color: Colors.white70,
+ onChanged: _changed,
+ child: TextField(
+ key: const Key('link-machine-search'),
+ controller: _query,
+ focusNode: _inputFocus,
+ autofocus: true,
+ style: boxMonoStyle(),
+ textAlignVertical: TextAlignVertical.center,
+ decoration: InputDecoration(
+ hintText: 'find a machine / desktop / SSH',
+ hintStyle: boxMonoStyle(color: kBoxFaint),
+ border: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ filled: false,
+ isDense: true,
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: Center(
+ widthFactor: 1,
+ heightFactor: 1,
+ child: Text(
+ 'machine >',
+ style: boxMonoStyle(
+ color: Colors.white70,
+ ),
),
),
),
+ prefixIconConstraints: const BoxConstraints(
+ minHeight: 36,
+ ),
+ contentPadding: EdgeInsets.zero,
),
- prefixIconConstraints: const BoxConstraints(
- minHeight: 36,
- ),
- contentPadding: EdgeInsets.zero,
+ onChanged: _changed,
+ onEditingComplete: () {},
+ onSubmitted: (_) => unawaited(_open(_selected)),
),
- onChanged: _changed,
- onEditingComplete: () {},
- onSubmitted: (_) => unawaited(_open(_selected)),
),
),
- ),
- Flexible(
- child: SingleChildScrollView(
- key: ValueKey(_guide),
- padding: const EdgeInsets.fromLTRB(8, 6, 8, 10),
- child: _guide != null
- ? Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
- ),
- child: _guideBody(),
- )
- : Column(
- crossAxisAlignment:
- CrossAxisAlignment.stretch,
- children: [
- if (rows.isEmpty)
- Padding(
- padding: const EdgeInsets.all(8),
- child: Text(
- 'No matching machines. Clear the search to see setup options.',
- style: boxMonoStyle(
- size: 12,
- color: kBoxFaint,
+ Flexible(
+ child: SingleChildScrollView(
+ key: ValueKey(_guide),
+ padding: const EdgeInsets.fromLTRB(8, 6, 8, 10),
+ child: _guide != null
+ ? Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 6,
+ ),
+ child: _guideBody(),
+ )
+ : Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.stretch,
+ children: [
+ if (rows.isEmpty)
+ Padding(
+ padding: const EdgeInsets.all(8),
+ child: Text(
+ 'No matching machines. Clear the search to see setup options.',
+ style: boxMonoStyle(
+ color: kBoxFaint,
+ ),
),
),
- ),
- for (final entry in rows)
- _machineRow(entry, picker: true),
- if (selected != null && !selected.enabled)
- Padding(
- padding: const EdgeInsets.all(8),
- child: Text(
- 'Already linked. Open its agents from New Tab or New Pane.',
- style: boxMonoStyle(
- size: 11,
- color: kBoxFaint,
+ for (final entry in rows)
+ _machineRow(entry, picker: true),
+ if (selected != null && !selected.enabled)
+ Padding(
+ padding: const EdgeInsets.all(8),
+ child: Text(
+ 'Already linked. Open its agents from New Tab or New Pane.',
+ style: boxMonoStyle(
+ color: kBoxFaint,
+ ),
),
),
- ),
- ],
- ),
+ ],
+ ),
+ ),
),
- ),
- BoxHintStrip(
- message: _refreshing || app.machinesRefreshing
- ? 'Refreshing machines…'
- : message,
- isError:
- !_refreshing &&
- !app.machinesRefreshing &&
- (_error ||
- (_message == null &&
- app.machineListError != null)),
- hints: [
- if (_guide == null)
- BoxHint(
- '${_hint('picker.previous', '↑')}/${_hint('picker.next', '↓')}',
- 'select',
- ),
- if (_guide == null && selected?.enabled == true)
+ BoxHintStrip(
+ message: _refreshing || app.machinesRefreshing
+ ? 'Refreshing machines…'
+ : message,
+ isError:
+ !_refreshing &&
+ !app.machinesRefreshing &&
+ (_error ||
+ (_message == null &&
+ app.machineListError != null)),
+ hints: [
+ if (_guide == null)
+ BoxHint(
+ '${_hint('picker.previous', '↑')}/${_hint('picker.next', '↓')}',
+ 'select',
+ ),
+ if (_guide == null && selected?.enabled == true)
+ BoxHint(
+ _hint('picker.accept', 'enter'),
+ 'open',
+ onTap: () => unawaited(_open(selected)),
+ ),
+ if (_guide != null)
+ BoxHint(
+ _hint('picker.complete', 'tab'),
+ 'controls',
+ ),
BoxHint(
- _hint('picker.accept', 'enter'),
- 'open',
- onTap: () => unawaited(_open(selected)),
+ _hint(
+ 'picker.refresh',
+ _mac ? 'cmd-r' : 'ctrl-r',
+ ),
+ 'refresh',
+ onTap: () => unawaited(_refresh()),
),
- if (_guide != null)
BoxHint(
- _hint('picker.complete', 'tab'),
- 'controls',
+ _hint('picker.cancel', 'esc'),
+ _guide == null ? 'close' : 'back',
+ onTap: _back,
),
- BoxHint(
- _hint('picker.refresh', _mac ? 'cmd-r' : 'ctrl-r'),
- 'refresh',
- onTap: () => unawaited(_refresh()),
- ),
- BoxHint(
- _hint('picker.cancel', 'esc'),
- _guide == null ? 'close' : 'back',
- onTap: _back,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
),
),
),
- ),
- );
- },
- );
+ );
+ },
+ );
+ }
}
diff --git a/desktop/lib/widgets/link_machine_dialog.dart b/desktop/lib/widgets/link_machine_dialog.dart
index b47683bb4..deb75ed87 100644
--- a/desktop/lib/widgets/link_machine_dialog.dart
+++ b/desktop/lib/widgets/link_machine_dialog.dart
@@ -9,7 +9,7 @@ import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
import '../shortcuts/keymap_commands.dart' show describeKeyBinding;
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
/// This computer's incoming password and, separately, its outgoing links.
@@ -451,7 +451,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
onPressed: action,
style: TextButton.styleFrom(
foregroundColor: danger ? Colors.orangeAccent : Colors.white70,
- textStyle: boxMonoStyle(size: 12),
+ textStyle: boxMonoStyle(),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
minimumSize: const Size(0, 30),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -554,7 +554,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
if (_editing) ...[
Text(
'Use this password on the other machine to link to this computer.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ style: boxMonoStyle(color: Colors.white70),
),
const SizedBox(height: 12),
_field(confirm: false),
@@ -579,20 +579,20 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
const SizedBox(height: 8),
Text(
'On the other machine: Link machine → select this computer → enter its password.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ style: boxMonoStyle(color: Colors.white70),
),
if (_status!.fingerprint case final fingerprint?) ...[
const SizedBox(height: 12),
- Text('fingerprint', style: boxMonoStyle(size: 11, color: kBoxFaint)),
+ Text('fingerprint', style: boxMonoStyle(color: kBoxFaint)),
SelectableText(
fingerprint,
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ style: boxMonoStyle(color: Colors.white70),
),
],
if (_status!.setAt case final date?)
Text(
'set ${date.toLocal().toIso8601String().substring(0, 16).replaceFirst('T', ' ')}',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
const SizedBox(height: 10),
Wrap(
@@ -616,7 +616,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
const SizedBox(height: 8),
Text(
'This operation continues if you close the prompt.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
],
const SizedBox(height: 12),
@@ -634,7 +634,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
List<Widget> _linksBody() => [
Text(
'Machines this computer can connect to.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ style: boxMonoStyle(color: Colors.white70),
),
const SizedBox(height: 8),
Align(
@@ -654,11 +654,11 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
Text(_name(machine), style: boxMonoStyle()),
SelectableText(
machine.fingerprint,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
Text(
'linked ${machine.linkedAt}',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
_button(
app.unlinkingMachine(machine.machineId)
@@ -681,7 +681,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
clear
? 'Prevent new links using this password? Existing links and sessions stay connected.'
: 'Remove this computer’s saved link to ${_name(_unlinkTarget!)}? A new connection will need that machine’s password.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ style: boxMonoStyle(color: Colors.white70),
),
const SizedBox(height: 14),
Wrap(
@@ -708,111 +708,116 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: Listenable.merge([
- app,
- terminalFontStore,
- _passwordFocus,
- _confirmFocus,
- ]),
- builder: (context, _) => Dialog(
- alignment: Alignment.topCenter,
- insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),
- elevation: 0,
- backgroundColor: Colors.transparent,
- child: _keys(
- Focus(
- autofocus: true,
- onKeyEvent: _key,
- child: SizedBox(
- width: 660,
- child: TerminalBox(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(switch (_page) {
- _Page.password => 'This computer’s password',
- _Page.clear => 'Clear remote password',
- _Page.links => 'Links from this computer',
- _Page.unlink => 'Unlink machine',
- }, style: boxMonoStyle(size: 12, color: kBoxFaint)),
- const SizedBox(height: 14),
- ...switch (_page) {
- _Page.password => _passwordBody(),
- _Page.links => _linksBody(),
- _Page.clear || _Page.unlink => _confirmationBody(),
- },
- ],
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: Listenable.merge([
+ app,
+ terminalFontStore,
+ _passwordFocus,
+ _confirmFocus,
+ ]),
+ builder: (context, _) => Dialog(
+ alignment: Alignment.topCenter,
+ insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),
+ elevation: 0,
+ backgroundColor: Colors.transparent,
+ child: _keys(
+ Focus(
+ autofocus: true,
+ onKeyEvent: _key,
+ child: SizedBox(
+ width: 660,
+ child: TerminalBox(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(switch (_page) {
+ _Page.password => 'This computer’s password',
+ _Page.clear => 'Clear remote password',
+ _Page.links => 'Links from this computer',
+ _Page.unlink => 'Unlink machine',
+ }, style: boxMonoStyle(color: kBoxFaint)),
+ const SizedBox(height: 14),
+ ...switch (_page) {
+ _Page.password => _passwordBody(),
+ _Page.links => _linksBody(),
+ _Page.clear ||
+ _Page.unlink => _confirmationBody(),
+ },
+ ],
+ ),
),
),
- ),
- BoxHintStrip(
- message: _busy
- ? (_page == _Page.unlink
- ? 'Unlinking machine…'
- : _clearing
- ? 'Clearing password…'
- : 'Setting password…')
- : _message ??
- (_page == _Page.links
- ? app.linkedMachinesLoading
- ? 'Loading linked machines…'
- : app.linkedMachinesError
- : null),
- isError:
- !_busy &&
- (_error ||
- _page == _Page.links &&
- app.linkedMachinesError != null),
- hints: [
- if (!_busy && !_loading)
- BoxHint(
- _hint('picker.accept', 'enter'),
- _page == _Page.password &&
- _editing &&
- _passwordFocus.hasFocus
- ? 'confirm password'
- : _page == _Page.password &&
+ BoxHintStrip(
+ message: _busy
+ ? (_page == _Page.unlink
+ ? 'Unlinking machine…'
+ : _clearing
+ ? 'Clearing password…'
+ : 'Setting password…')
+ : _message ??
+ (_page == _Page.links
+ ? app.linkedMachinesLoading
+ ? 'Loading linked machines…'
+ : app.linkedMachinesError
+ : null),
+ isError:
+ !_busy &&
+ (_error ||
+ _page == _Page.links &&
+ app.linkedMachinesError != null),
+ hints: [
+ if (!_busy && !_loading)
+ BoxHint(
+ _hint('picker.accept', 'enter'),
+ _page == _Page.password &&
_editing &&
- _confirmFocus.hasFocus
- ? 'set password'
- : 'select',
- ),
- if (!_busy && !_loading)
- BoxHint(_hint('picker.complete', 'tab'), 'controls'),
- if (!_busy &&
- !_loading &&
- (_page == _Page.links ||
- _page == _Page.password && !_editing))
+ _passwordFocus.hasFocus
+ ? 'confirm password'
+ : _page == _Page.password &&
+ _editing &&
+ _confirmFocus.hasFocus
+ ? 'set password'
+ : 'select',
+ ),
+ if (!_busy && !_loading)
+ BoxHint(_hint('picker.complete', 'tab'), 'controls'),
+ if (!_busy &&
+ !_loading &&
+ (_page == _Page.links ||
+ _page == _Page.password && !_editing))
+ BoxHint(
+ _hint('picker.refresh', _mac ? 'cmd-r' : 'ctrl-r'),
+ 'refresh',
+ onTap: _refresh,
+ ),
BoxHint(
- _hint('picker.refresh', _mac ? 'cmd-r' : 'ctrl-r'),
- 'refresh',
- onTap: _refresh,
+ _hint('picker.cancel', 'esc'),
+ _busy ||
+ _page == _Page.password &&
+ (!_editing ||
+ _status?.hasPassword != true)
+ ? 'close'
+ : 'back',
+ onTap: _back,
),
- BoxHint(
- _hint('picker.cancel', 'esc'),
- _busy ||
- _page == _Page.password &&
- (!_editing || _status?.hasPassword != true)
- ? 'close'
- : 'back',
- onTap: _back,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/link_machine_screen.dart b/desktop/lib/widgets/link_machine_screen.dart
index 176a4e0cf..10c579008 100644
--- a/desktop/lib/widgets/link_machine_screen.dart
+++ b/desktop/lib/widgets/link_machine_screen.dart
@@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
/// Opens [LinkMachineScreen] as a modal popup for [machineId], closing itself automatically once
@@ -210,162 +210,168 @@ class _LinkMachineScreenState extends State<LinkMachineScreen> {
};
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: Listenable.merge([widget.notifier, terminalFontStore]),
- builder: (context, _) {
- final machineName = widget.machineState.machine.displayName;
- return Focus(
- onKeyEvent: _key,
- child: SizedBox(
- width: 620,
- child: TerminalBox(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- 'Link this machine',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- const SizedBox(height: 12),
- Text(
- machineName,
- style: boxMonoStyle(weight: FontWeight.w600),
- ),
- const SizedBox(height: 4),
- Text(
- 'Enter the remote password set on this machine.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
- ),
- const SizedBox(height: 14),
- ReadlineKeys(
- controller: _passwordController,
- enabled: !_submitting,
- onChanged: _edited,
- child: TextField(
- key: const Key('remote-password-connect-field'),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: Listenable.merge([widget.notifier, terminalFontStore]),
+ builder: (context, _) {
+ final machineName = widget.machineState.machine.displayName;
+ return Focus(
+ onKeyEvent: _key,
+ child: SizedBox(
+ width: 620,
+ child: TerminalBox(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(
+ 'Link this machine',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ const SizedBox(height: 12),
+ Text(
+ machineName,
+ style: boxMonoStyle(weight: FontWeight.w600),
+ ),
+ const SizedBox(height: 4),
+ Text(
+ 'Enter the remote password set on this machine.',
+ style: boxMonoStyle(color: Colors.white70),
+ ),
+ const SizedBox(height: 14),
+ ReadlineKeys(
controller: _passwordController,
- focusNode: _passwordFocus,
- autofocus: true,
- readOnly: _submitting,
- obscureText: _obscure,
- enableSuggestions: false,
- autocorrect: false,
- textInputAction: TextInputAction.done,
- textAlignVertical: TextAlignVertical.center,
- style: boxMonoStyle(),
- decoration: InputDecoration(
- hintText: 'Remote password for $machineName',
- hintStyle: boxMonoStyle(color: kBoxFaint),
- isDense: true,
- filled: false,
- border: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- prefixIcon: Padding(
- padding: const EdgeInsets.only(right: 10),
- child: Center(
- widthFactor: 1,
- heightFactor: 1,
- child: Text(
- 'password >',
- style: boxMonoStyle(color: Colors.white70),
+ enabled: !_submitting,
+ onChanged: _edited,
+ child: TextField(
+ key: const Key('remote-password-connect-field'),
+ controller: _passwordController,
+ focusNode: _passwordFocus,
+ autofocus: true,
+ readOnly: _submitting,
+ obscureText: _obscure,
+ enableSuggestions: false,
+ autocorrect: false,
+ textInputAction: TextInputAction.done,
+ textAlignVertical: TextAlignVertical.center,
+ style: boxMonoStyle(),
+ decoration: InputDecoration(
+ hintText: 'Remote password for $machineName',
+ hintStyle: boxMonoStyle(color: kBoxFaint),
+ isDense: true,
+ filled: false,
+ border: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: Center(
+ widthFactor: 1,
+ heightFactor: 1,
+ child: Text(
+ 'password >',
+ style: boxMonoStyle(
+ color: Colors.white70,
+ ),
+ ),
),
),
- ),
- prefixIconConstraints: const BoxConstraints(
- minHeight: 36,
- ),
- suffixIconConstraints: const BoxConstraints(
- minWidth: 28,
- minHeight: 28,
- ),
- suffixIcon: IconButton(
- tooltip: _obscure
- ? 'Show password'
- : 'Hide password',
- icon: Icon(
- _obscure
- ? Icons.visibility_outlined
- : Icons.visibility_off_outlined,
- size: 16,
+ prefixIconConstraints: const BoxConstraints(
+ minHeight: 36,
+ ),
+ suffixIconConstraints: const BoxConstraints(
+ minWidth: 28,
+ minHeight: 28,
+ ),
+ suffixIcon: IconButton(
+ tooltip: _obscure
+ ? 'Show password'
+ : 'Hide password',
+ icon: Icon(
+ _obscure
+ ? Icons.visibility_outlined
+ : Icons.visibility_off_outlined,
+ size: 16,
+ ),
+ onPressed: _submitting
+ ? null
+ : () => setState(
+ () => _obscure = !_obscure,
+ ),
),
- onPressed: _submitting
- ? null
- : () =>
- setState(() => _obscure = !_obscure),
+ contentPadding: EdgeInsets.zero,
),
- contentPadding: EdgeInsets.zero,
+ // Native Done must keep the prompt's key scope alive
+ // while connecting, so Escape still closes it.
+ onEditingComplete: () {},
+ onSubmitted: (_) => _submit(),
+ onChanged: _edited,
),
- // Native Done must keep the prompt's key scope alive
- // while connecting, so Escape still closes it.
- onEditingComplete: () {},
- onSubmitted: (_) => _submit(),
- onChanged: _edited,
),
- ),
- const SizedBox(height: 8),
- Text(
- _submitting
- ? 'Connecting continues if you close this prompt.'
- : 'Your previous agent will reconnect automatically after linking.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- const SizedBox(height: 8),
- Align(
- alignment: Alignment.centerLeft,
- child: TextButton(
- key: const Key('link-troubleshooting-details'),
- style: TextButton.styleFrom(
- textStyle: boxMonoStyle(size: 11),
- foregroundColor: Colors.white70,
- padding: const EdgeInsets.symmetric(
- horizontal: 4,
+ const SizedBox(height: 8),
+ Text(
+ _submitting
+ ? 'Connecting continues if you close this prompt.'
+ : 'Your previous agent will reconnect automatically after linking.',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ const SizedBox(height: 8),
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TextButton(
+ key: const Key('link-troubleshooting-details'),
+ style: TextButton.styleFrom(
+ textStyle: boxMonoStyle(),
+ foregroundColor: Colors.white70,
+ padding: const EdgeInsets.symmetric(
+ horizontal: 4,
+ ),
+ minimumSize: const Size(0, 28),
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ ),
+ onPressed: () => setState(
+ () => _showTroubleshootingDetails =
+ !_showTroubleshootingDetails,
+ ),
+ child: Text(
+ _showTroubleshootingDetails
+ ? 'Hide details'
+ : 'Troubleshooting details',
),
- minimumSize: const Size(0, 28),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- onPressed: () => setState(
- () => _showTroubleshootingDetails =
- !_showTroubleshootingDetails,
- ),
- child: Text(
- _showTroubleshootingDetails
- ? 'Hide details'
- : 'Troubleshooting details',
),
),
- ),
- if (_showTroubleshootingDetails)
- SelectableText(
- 'Machine ID: $_machineId',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- ],
+ if (_showTroubleshootingDetails)
+ SelectableText(
+ 'Machine ID: $_machineId',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
+ ),
),
),
- ),
- BoxHintStrip(
- message: _error ?? (_submitting ? _progress : null),
- isError: _error != null,
- hints: [
- if (!_submitting)
- BoxHint('enter', 'link machine', onTap: _submit),
- BoxHint('tab', 'controls'),
- BoxHint('esc', 'close', onTap: _close),
- ],
- ),
- ],
+ BoxHintStrip(
+ message: _error ?? (_submitting ? _progress : null),
+ isError: _error != null,
+ hints: [
+ if (!_submitting)
+ BoxHint('enter', 'link machine', onTap: _submit),
+ BoxHint('tab', 'controls'),
+ BoxHint('esc', 'close', onTap: _close),
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
- },
- );
+ );
+ },
+ );
+ }
}
diff --git a/desktop/lib/widgets/login_fleet_map.dart b/desktop/lib/widgets/login_fleet_map.dart
index c0eb31252..49185bb7a 100644
--- a/desktop/lib/widgets/login_fleet_map.dart
+++ b/desktop/lib/widgets/login_fleet_map.dart
@@ -2,6 +2,7 @@ import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -234,6 +235,8 @@ class _MapPainter extends CustomPainter {
/// The loop's phase, 0 → 1, wrapping.
final double t;
final _MapPalette palette;
+ final _textStyle = terminalTextStyle(height: 1.2);
+ double _paintScale = 1;
static const Size _design = Size(512, 190);
@@ -291,6 +294,8 @@ class _MapPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final scale = size.width / _design.width;
+ if (scale <= 0) return;
+ _paintScale = scale;
canvas.save();
canvas.scale(scale);
canvas.clipRRect(
@@ -394,7 +399,7 @@ class _MapPainter extends CustomPainter {
canvas,
'● this Mac · 4 linked',
Offset(_window.left + 7, _window.top + 6),
- size: 9,
+
color: _fade(palette.ink2, landed),
);
const names = ['Claude', 'Codex', 'Gemini', '+'];
@@ -419,7 +424,7 @@ class _MapPainter extends CustomPainter {
canvas,
names[i],
Offset(pane.left + 5, pane.top + 4),
- size: 8,
+
weight: FontWeight.w600,
color: _fade(tints[i], landed),
);
@@ -492,8 +497,8 @@ class _MapPainter extends CustomPainter {
// Labels are laid out in unscaled space and only faded, so the text
// never renders at a fractional scale mid-pop.
- final nameWidth = _measure(pin.name, size: 10.5, weight: FontWeight.w500);
- final subWidth = _measure(pin.sub, size: 8.5, mono: true);
+ final nameWidth = _measure(pin.name, weight: FontWeight.w500);
+ final subWidth = _measure(pin.sub);
final width = math.max(nameWidth, subWidth);
// Centred on the pin, but never off the field.
final left = (pin.at.dx - width / 2).clamp(
@@ -505,16 +510,18 @@ class _MapPainter extends CustomPainter {
canvas,
pin.name,
Offset(left + (width - nameWidth) / 2, top),
- size: 10.5,
+
weight: FontWeight.w500,
color: _fade(palette.ink2, alpha),
);
_text(
canvas,
pin.sub,
- Offset(left + (width - subWidth) / 2, top + 13),
- size: 8.5,
- mono: true,
+ Offset(
+ left + (width - subWidth) / 2,
+ top + terminalFontStore.size * 1.2 / _paintScale,
+ ),
+
color: _fade(palette.faint, alpha),
);
}
@@ -572,58 +579,40 @@ class _MapPainter extends CustomPainter {
TextPainter _layout(
String text, {
- required double size,
FontWeight weight = FontWeight.w400,
- bool mono = false,
Color color = const Color(0xFFFFFFFF),
}) {
final painter = TextPainter(
text: TextSpan(
text: text,
- style: TextStyle(
- fontFamily: mono ? palette.mono : palette.sans,
- fontFamilyFallback: mono
- ? palette.monoFallback
- : palette.sansFallback,
- fontSize: size,
- fontWeight: weight,
- color: color,
- height: 1.2,
- ),
+ style: _textStyle.copyWith(fontWeight: weight, color: color),
),
textDirection: TextDirection.ltr,
+ // Scale the drawing, but keep its labels at the selected point size.
+ textScaler: TextScaler.linear(1 / _paintScale),
maxLines: 1,
ellipsis: '…',
)..layout(maxWidth: 160);
return painter;
}
- double _measure(
- String text, {
- required double size,
- FontWeight weight = FontWeight.w400,
- bool mono = false,
- }) => _layout(text, size: size, weight: weight, mono: mono).width;
+ double _measure(String text, {FontWeight weight = FontWeight.w400}) =>
+ _layout(text, weight: weight).width;
void _text(
Canvas canvas,
String text,
Offset at, {
- required double size,
required Color color,
FontWeight weight = FontWeight.w400,
- bool mono = false,
}) {
- _layout(
- text,
- size: size,
- weight: weight,
- mono: mono,
- color: color,
- ).paint(canvas, at);
+ _layout(text, weight: weight, color: color).paint(canvas, at);
}
@override
bool shouldRepaint(_MapPainter old) =>
- old.t != t || old.entrance != entrance || old.palette != palette;
+ old.t != t ||
+ old.entrance != entrance ||
+ old.palette != palette ||
+ old._textStyle != _textStyle;
}
diff --git a/desktop/lib/widgets/login_relay_diagram.dart b/desktop/lib/widgets/login_relay_diagram.dart
index 70cb9abda..a51df759b 100644
--- a/desktop/lib/widgets/login_relay_diagram.dart
+++ b/desktop/lib/widgets/login_relay_diagram.dart
@@ -1,6 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -232,6 +233,8 @@ class _RelayPainter extends CustomPainter {
final double t;
final _DiagramPalette palette;
final _DiagramLabels labels;
+ final _textStyle = terminalTextStyle(height: 1.0);
+ double _paintScale = 1;
static const Size _design = Size(440, 140);
@@ -252,6 +255,8 @@ class _RelayPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final scale = size.width / _design.width;
+ if (scale <= 0) return;
+ _paintScale = scale;
canvas.save();
canvas.scale(scale);
@@ -353,7 +358,6 @@ class _RelayPainter extends CustomPainter {
// box rather than a sentence printed across the wires outside it.
final caption = _layOutText(
labels.hub,
- fontSize: 9.5,
color: palette.faint,
maxWidth: _hub.width - eyeWidth - gap - padding * 2,
);
@@ -416,7 +420,6 @@ class _RelayPainter extends CustomPainter {
canvas,
labels.nodes[i],
Offset(r.left + 26, r.center.dy),
- fontSize: 10.5,
color: palette.ink,
);
}
@@ -542,27 +545,17 @@ class _RelayPainter extends CustomPainter {
/// font, or the user's chosen family changes.
TextPainter _layOutText(
String text, {
- required double fontSize,
required Color color,
double? maxWidth,
}) {
return TextPainter(
text: TextSpan(
text: text,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: fontSize,
- color: color,
- letterSpacing: grid.AppFont.trackingFor(fontSize),
- height: 1.0,
- ),
+ style: _textStyle.copyWith(color: color),
),
textDirection: TextDirection.ltr,
- // The drawing is scaled as a unit, so text inside it must not also take
- // the platform's scaler — that would grow the labels past the boxes they
- // sit in while the boxes stayed put.
- textScaler: TextScaler.noScaling,
+ // Counteract only the drawing scale; labels retain the terminal size.
+ textScaler: TextScaler.linear(1 / _paintScale),
maxLines: 1,
ellipsis: '…',
)..layout(maxWidth: maxWidth ?? double.infinity);
@@ -572,10 +565,9 @@ class _RelayPainter extends CustomPainter {
Canvas canvas,
String text,
Offset at, {
- required double fontSize,
required Color color,
}) {
- final painter = _layOutText(text, fontSize: fontSize, color: color);
+ final painter = _layOutText(text, color: color);
painter.paint(canvas, Offset(at.dx, at.dy - painter.height / 2));
}
@@ -583,7 +575,8 @@ class _RelayPainter extends CustomPainter {
bool shouldRepaint(covariant _RelayPainter old) =>
old.t != t ||
old.palette.accent != palette.accent ||
- old.palette.isDark != palette.isDark;
+ old.palette.isDark != palette.isDark ||
+ old._textStyle != _textStyle;
}
/// A left-to-right gradient between two points on the canvas, used to give the
diff --git a/desktop/lib/widgets/machine_actions.dart b/desktop/lib/widgets/machine_actions.dart
index 6c3f5501b..72a2eaec3 100644
--- a/desktop/lib/widgets/machine_actions.dart
+++ b/desktop/lib/widgets/machine_actions.dart
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import '../shortcuts/app_keymap.dart';
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'terminal_prompt.dart';
@@ -95,86 +95,89 @@ class _DeleteMachinePromptState extends State<_DeleteMachinePrompt> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => TerminalPromptKeys(
- cancel: _close,
- child: TerminalPrompt(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- 'Delete machine',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- const SizedBox(height: 12),
- Text(
- widget.displayName,
- style: boxMonoStyle(weight: FontWeight.w600),
- ),
- const SizedBox(height: 8),
- Text(
- 'Delete this machine from your account and close its panes in this window?',
- style: boxMonoStyle(size: 12, color: Colors.white70),
- ),
- const SizedBox(height: 12),
- if (!_deleting)
- Wrap(
- spacing: 12,
- children: [
- terminalPromptButton(
- 'Cancel',
- _close,
- focusNode: _cancel,
- ),
- terminalPromptButton(
- 'Delete',
- _delete,
- danger: true,
- key: const Key('machine-delete-confirm'),
- ),
- ],
- )
- else
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => TerminalPromptKeys(
+ cancel: _close,
+ child: TerminalPrompt(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(
+ 'Delete machine',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ const SizedBox(height: 12),
+ Text(
+ widget.displayName,
+ style: boxMonoStyle(weight: FontWeight.w600),
+ ),
+ const SizedBox(height: 8),
Text(
- 'Deletion continues if you close this prompt.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ 'Delete this machine from your account and close its panes in this window?',
+ style: boxMonoStyle(color: Colors.white70),
),
- ],
+ const SizedBox(height: 12),
+ if (!_deleting)
+ Wrap(
+ spacing: 12,
+ children: [
+ terminalPromptButton(
+ 'Cancel',
+ _close,
+ focusNode: _cancel,
+ ),
+ terminalPromptButton(
+ 'Delete',
+ _delete,
+ danger: true,
+ key: const Key('machine-delete-confirm'),
+ ),
+ ],
+ )
+ else
+ Text(
+ 'Deletion continues if you close this prompt.',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
+ ),
),
),
- ),
- BoxHintStrip(
- message: _error ?? (_deleting ? 'Deleting machine…' : null),
- isError: _error != null,
- hints: [
- if (!_deleting)
- BoxHint(
- terminalPromptHint(context, 'picker.accept', 'enter'),
- 'select',
- ),
- if (!_deleting)
+ BoxHintStrip(
+ message: _error ?? (_deleting ? 'Deleting machine…' : null),
+ isError: _error != null,
+ hints: [
+ if (!_deleting)
+ BoxHint(
+ terminalPromptHint(context, 'picker.accept', 'enter'),
+ 'select',
+ ),
+ if (!_deleting)
+ BoxHint(
+ terminalPromptHint(context, 'picker.complete', 'tab'),
+ 'controls',
+ ),
BoxHint(
- terminalPromptHint(context, 'picker.complete', 'tab'),
- 'controls',
+ terminalPromptHint(context, 'picker.cancel', 'esc'),
+ 'close',
+ onTap: _close,
),
- BoxHint(
- terminalPromptHint(context, 'picker.cancel', 'esc'),
- 'close',
- onTap: _close,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/machine_rail.dart b/desktop/lib/widgets/machine_rail.dart
index 5232795f1..4595f70e8 100644
--- a/desktop/lib/widgets/machine_rail.dart
+++ b/desktop/lib/widgets/machine_rail.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import 'window_chrome.dart';
@@ -34,10 +35,8 @@ import 'machines_manager.dart';
/// metrics: `skeleton_sites_test.dart` measures a placeholder machine row
/// against a real one, and a caption whose type drifts from its placeholder
/// makes the rail resize the moment the list lands.
-TextStyle _machineCaptionStyle(Color color) => TextStyle(
+TextStyle _machineCaptionStyle(Color color) => terminalTextStyle(
color: color,
- fontFamily: grid.AppFont.sans,
- fontSize: 11,
fontWeight: grid.AppFont.semibold,
letterSpacing: 0.3,
);
@@ -229,9 +228,8 @@ class _MachineRailState extends State<MachineRail> {
Expanded(
child: Text(
'Harness',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 16,
// Semibold, not bold. A wordmark at this size
// already out-ranks everything below it.
fontWeight: grid.AppFont.semibold,
@@ -305,9 +303,8 @@ class _MachineRailState extends State<MachineRail> {
Expanded(
child: Text(
'Offline copy — backend unreachable',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 11,
),
),
),
@@ -325,10 +322,8 @@ class _MachineRailState extends State<MachineRail> {
: Center(
child: Text(
'no remote machines',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 13.5,
),
),
)
@@ -397,41 +392,44 @@ class _CaptionActions extends StatelessWidget {
static const double _drift = 10;
@override
- Widget build(BuildContext context) => TweenAnimationBuilder<double>(
- // No `begin`: a row built already hovered is settled, not animating in.
- tween: Tween(end: shown ? 1.0 : 0.0),
- duration: grid.AppMotion.hover,
- curve: grid.AppMotion.curve,
- builder: (context, t, child) => ClipRect(
- child: Align(
- // Pinned right, so the pair grows out of the row's edge rather than
- // sliding along it — and clipped, so nothing is clickable while it is
- // still folded away.
- alignment: Alignment.centerRight,
- widthFactor: t,
- child: Opacity(
- opacity: t,
- child: Transform.translate(
- offset: Offset((1 - t) * _drift, 0),
- child: child,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return TweenAnimationBuilder<double>(
+ // No `begin`: a row built already hovered is settled, not animating in.
+ tween: Tween(end: shown ? 1.0 : 0.0),
+ duration: grid.AppMotion.hover,
+ curve: grid.AppMotion.curve,
+ builder: (context, t, child) => ClipRect(
+ child: Align(
+ // Pinned right, so the pair grows out of the row's edge rather than
+ // sliding along it — and clipped, so nothing is clickable while it is
+ // still folded away.
+ alignment: Alignment.centerRight,
+ widthFactor: t,
+ child: Opacity(
+ opacity: t,
+ child: Transform.translate(
+ offset: Offset((1 - t) * _drift, 0),
+ child: child,
+ ),
),
),
),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- menu,
- const SizedBox(width: 2),
- AppIconButton(
- icon: LucideIcons.plus300,
- size: 16,
- tooltip: 'New Harness here…',
- onPressed: onNewAgent,
- ),
- ],
- ),
- );
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ menu,
+ const SizedBox(width: 2),
+ AppIconButton(
+ icon: LucideIcons.plus300,
+ size: 16,
+ tooltip: 'New Harness here…',
+ onPressed: onNewAgent,
+ ),
+ ],
+ ),
+ );
+ }
}
class _MachineNode extends StatefulWidget {
@@ -678,10 +676,8 @@ class _MachineNodeState extends State<_MachineNode> {
padding: const EdgeInsets.only(left: 6),
child: Text(
'${state.agents.length}',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 11,
fontFeatures: const [
FontFeature.tabularFigures(),
],
@@ -917,11 +913,7 @@ class _AgentTree extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(38, 2, 12, 8),
child: Text(
state.terminalCapabilityError ?? 'terminal unavailable',
- style: TextStyle(
- color: grid.AppPalette.dangerFill,
- fontFamily: grid.AppFont.sans,
- fontSize: 11.2,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.dangerFill),
),
),
],
@@ -1340,9 +1332,8 @@ class _DragChip extends StatelessWidget {
const SizedBox(width: 7),
Text(
name,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 12,
fontWeight: FontWeight.w600,
),
),
@@ -1364,16 +1355,19 @@ class _MachineListSkeleton extends StatelessWidget {
static const _labels = [0.56, 0.42, 0.64];
@override
- Widget build(BuildContext context) => SkeletonList(
- rows: 3,
- semanticsLabel: 'Loading machines',
- itemBuilder: (context, i) => SidebarTimeline(
- role: SidebarTimelineRole.node,
- above: i > 0,
- below: false,
- child: _MachineCaptionSkeleton(labelFactor: _labels[i]),
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return SkeletonList(
+ rows: 3,
+ semanticsLabel: 'Loading machines',
+ itemBuilder: (context, i) => SidebarTimeline(
+ role: SidebarTimelineRole.node,
+ above: i > 0,
+ below: false,
+ child: _MachineCaptionSkeleton(labelFactor: _labels[i]),
+ ),
+ );
+ }
}
/// A machine caption with nothing in it yet.
@@ -1388,28 +1382,31 @@ class _MachineCaptionSkeleton extends StatelessWidget {
final double labelFactor;
@override
- Widget build(BuildContext context) => Padding(
- padding: _machineCaptionPadding,
- child: SizedBox(
- height: _machineCaptionHeight,
- child: Row(
- children: [
- Skeleton(
- width: _machineMarkSize,
- height: _machineMarkSize,
- radius: 5,
- ),
- const SizedBox(width: 10),
- Expanded(
- child: SkeletonText(
- style: _machineCaptionStyle(grid.AppPalette.textFaint),
- widthFactor: labelFactor,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Padding(
+ padding: _machineCaptionPadding,
+ child: SizedBox(
+ height: _machineCaptionHeight,
+ child: Row(
+ children: [
+ Skeleton(
+ width: _machineMarkSize,
+ height: _machineMarkSize,
+ radius: 5,
),
- ),
- ],
+ const SizedBox(width: 10),
+ Expanded(
+ child: SkeletonText(
+ style: _machineCaptionStyle(grid.AppPalette.textFaint),
+ widthFactor: labelFactor,
+ ),
+ ),
+ ],
+ ),
),
- ),
- );
+ );
+ }
}
/// A machine's agents before `agents_list` has answered: two rows where the
@@ -1421,24 +1418,27 @@ class _AgentRowsSkeleton extends StatelessWidget {
static const _labels = [0.48, 0.36];
@override
- Widget build(BuildContext context) => SkeletonList(
- rows: _rows,
- fadeDepth: skeletonFadeLight,
- semanticsLabel: 'Loading agents',
- itemBuilder: (context, i) => SidebarTimeline(
- role: SidebarTimelineRole.branch,
- below: i < _rows - 1,
- child: Padding(
- // Where a nested row's box starts — see [_AgentRow].
- padding: const EdgeInsets.only(left: 28),
- child: _SidebarRowSkeleton(
- leading: 16,
- leadingRadius: 4,
- labelFactor: _labels[i],
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return SkeletonList(
+ rows: _rows,
+ fadeDepth: skeletonFadeLight,
+ semanticsLabel: 'Loading agents',
+ itemBuilder: (context, i) => SidebarTimeline(
+ role: SidebarTimelineRole.branch,
+ below: i < _rows - 1,
+ child: Padding(
+ // Where a nested row's box starts — see [_AgentRow].
+ padding: const EdgeInsets.only(left: 28),
+ child: _SidebarRowSkeleton(
+ leading: 16,
+ leadingRadius: 4,
+ labelFactor: _labels[i],
+ ),
),
),
- ),
- );
+ );
+ }
}
/// A [SidebarItem] with nothing in it yet: the same 1px margin, 36px box,
@@ -1457,32 +1457,38 @@ class _SidebarRowSkeleton extends StatelessWidget {
final double labelFactor;
@override
- Widget build(BuildContext context) => Padding(
- padding: const EdgeInsets.symmetric(vertical: 1),
- child: SizedBox(
- height: 36,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(SidebarItem.iconGutter, 0, 5, 0),
- child: Row(
- children: [
- Skeleton(width: leading, height: leading, radius: leadingRadius),
- const SizedBox(width: 10),
- Expanded(
- child: SkeletonText(
- style: const TextStyle(fontSize: 13.7, height: 1.25),
- strutStyle: const StrutStyle(
- fontSize: 13.5,
- height: 1.25,
- forceStrutHeight: true,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 1),
+ child: SizedBox(
+ height: 36,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(SidebarItem.iconGutter, 0, 5, 0),
+ child: Row(
+ children: [
+ Skeleton(width: leading, height: leading, radius: leadingRadius),
+ const SizedBox(width: 10),
+ Expanded(
+ child: SkeletonText(
+ style: terminalTextStyle(height: 1.25),
+ strutStyle: StrutStyle(
+ fontSize: terminalFontStore.size,
+ fontFamily: terminalFontStore.value.fontFamily,
+ fontFamilyFallback:
+ terminalFontStore.value.fontFamilyFallback,
+ height: 1.25,
+ forceStrutHeight: true,
+ ),
+ widthFactor: labelFactor,
),
- widthFactor: labelFactor,
),
- ),
- ],
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
class _AgentStatusRow extends StatelessWidget {
@@ -1506,11 +1512,7 @@ class _AgentStatusRow extends StatelessWidget {
Expanded(
child: Text(
label,
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 11.2,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
),
],
@@ -1535,10 +1537,8 @@ class _OfflineWord extends StatelessWidget {
padding: const EdgeInsets.only(left: 8),
child: Text(
'offline',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 10,
letterSpacing: 0.2,
),
),
@@ -1559,10 +1559,8 @@ class _OnlineWord extends StatelessWidget {
padding: const EdgeInsets.only(left: 8),
child: Text(
'online',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 10,
letterSpacing: 0.2,
),
),
@@ -1601,12 +1599,7 @@ class _MachineOfflineNote extends StatelessWidget {
: "Harness isn't running on $where.",
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- fontSize: 11.2,
- height: 1.4,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint, height: 1.4),
),
);
}
@@ -1636,11 +1629,7 @@ class _AgentLoadError extends StatelessWidget {
state.agentsLoadError ?? 'Could not load agents',
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: grid.AppPalette.dangerFill,
- fontFamily: grid.AppFont.sans,
- fontSize: 11.2,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.dangerFill),
),
),
IconButton(
@@ -1813,6 +1802,7 @@ class _EmptyAgents extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
// No sentence, and nothing framed. An empty list says it is empty by being empty; what it cannot say
// on its own is that a row can be added, and that is exactly what this row is. See [_NewAgentRow] for
// what it replaces and why.
diff --git a/desktop/lib/widgets/machines_manager.dart b/desktop/lib/widgets/machines_manager.dart
index f42eeaaaf..436c16b57 100644
--- a/desktop/lib/widgets/machines_manager.dart
+++ b/desktop/lib/widgets/machines_manager.dart
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import '../core/fuzzy_match.dart';
import '../shortcuts/app_keymap.dart';
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'link_machine_dialog.dart';
import 'link_machine_screen.dart';
@@ -399,7 +399,7 @@ class _MachinesManagerState extends State<_MachinesManager> {
),
Text(
entry.detail,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
],
),
@@ -415,200 +415,204 @@ class _MachinesManagerState extends State<_MachinesManager> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: Listenable.merge([app, terminalFontStore]),
- builder: (context, _) {
- final rows = _entries;
- final machine = _machine;
- final empty = _machineId != null && machine == null
- ? 'This machine is no longer available.'
- : machine?.machine.isShared == true
- ? 'Shared machines are view-only. Their owner manages machine settings.'
- : app.machinesLoading
- ? 'Loading machines…'
- : 'No matching ${_machineId == null ? 'machines' : 'actions'}.';
- return Offstage(
- offstage: _nested,
- child: TerminalPromptKeys(
- inputFocus: _input,
- composing: () => _composing,
- cancel: _back,
- accept: _accept,
- next: () => _move(1),
- previous: () => _move(-1),
- pageDown: () => _move(8),
- pageUp: () => _move(-8),
- refresh: () => unawaited(_refresh()),
- child: TerminalPrompt(
- width: 760,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 8),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Text(
- _machineId == null
- ? 'Machines Manager'
- : machine?.machine.displayName ??
- _machineTitle ??
- 'Machine',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: Listenable.merge([app, terminalFontStore]),
+ builder: (context, _) {
+ final rows = _entries;
+ final machine = _machine;
+ final empty = _machineId != null && machine == null
+ ? 'This machine is no longer available.'
+ : machine?.machine.isShared == true
+ ? 'Shared machines are view-only. Their owner manages machine settings.'
+ : app.machinesLoading
+ ? 'Loading machines…'
+ : 'No matching ${_machineId == null ? 'machines' : 'actions'}.';
+ return Offstage(
+ offstage: _nested,
+ child: TerminalPromptKeys(
+ inputFocus: _input,
+ composing: () => _composing,
+ cancel: _back,
+ accept: _accept,
+ next: () => _move(1),
+ previous: () => _move(-1),
+ pageDown: () => _move(8),
+ pageUp: () => _move(-8),
+ refresh: () => unawaited(_refresh()),
+ child: TerminalPrompt(
+ width: 760,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 8),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Text(
+ _machineId == null
+ ? 'Machines Manager'
+ : machine?.machine.displayName ??
+ _machineTitle ??
+ 'Machine',
+ style: boxMonoStyle(color: kBoxFaint),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ ),
),
- ),
- Text(
- '${rows.length}/${_allEntries.length}',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- ],
+ Text(
+ '${rows.length}/${_allEntries.length}',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
+ ),
),
- ),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 14),
- child: ReadlineKeys(
- controller: _query,
- onChanged: _changed,
- child: TextField(
- key: const Key('machines-manager-search'),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 14),
+ child: ReadlineKeys(
controller: _query,
- focusNode: _input,
- style: boxMonoStyle(),
- textAlignVertical: TextAlignVertical.center,
- textInputAction: TextInputAction.done,
- decoration: InputDecoration(
- hintText: _machineId == null
- ? 'find a machine / link another'
- : 'find an action',
- hintStyle: boxMonoStyle(color: kBoxFaint),
- isDense: true,
- filled: false,
- border: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- prefixIcon: Padding(
- padding: const EdgeInsets.only(right: 10),
- child: Center(
- widthFactor: 1,
- heightFactor: 1,
- child: Text(
- _machineId == null ? 'machine >' : 'action >',
- style: boxMonoStyle(color: Colors.white70),
+ onChanged: _changed,
+ child: TextField(
+ key: const Key('machines-manager-search'),
+ controller: _query,
+ focusNode: _input,
+ style: boxMonoStyle(),
+ textAlignVertical: TextAlignVertical.center,
+ textInputAction: TextInputAction.done,
+ decoration: InputDecoration(
+ hintText: _machineId == null
+ ? 'find a machine / link another'
+ : 'find an action',
+ hintStyle: boxMonoStyle(color: kBoxFaint),
+ isDense: true,
+ filled: false,
+ border: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: Center(
+ widthFactor: 1,
+ heightFactor: 1,
+ child: Text(
+ _machineId == null ? 'machine >' : 'action >',
+ style: boxMonoStyle(color: Colors.white70),
+ ),
),
),
+ prefixIconConstraints: const BoxConstraints(
+ minHeight: 38,
+ ),
+ contentPadding: EdgeInsets.zero,
),
- prefixIconConstraints: const BoxConstraints(
- minHeight: 38,
- ),
- contentPadding: EdgeInsets.zero,
+ onChanged: _changed,
+ onEditingComplete: () {},
+ onSubmitted: (_) => _accept(),
),
- onChanged: _changed,
- onEditingComplete: () {},
- onSubmitted: (_) => _accept(),
),
),
- ),
- Flexible(
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(6, 8, 6, 8),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- if (machine != null)
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
- child: SelectableText(
- [
- _status(machine),
- if (machine.machine.ownerName case final owner?)
- 'shared by $owner',
- ?machine.machine.hostname,
- machine.machine.machineId,
- ].join(' · '),
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- ),
- if (_machineId == null &&
- app.machineStates.isEmpty &&
- _machineQuery.text.isEmpty)
- Padding(
- padding: const EdgeInsets.all(12),
- child: Text(
- app.machinesLoading
- ? 'Loading machines…'
- : app.machineListError != null
- ? 'Machine list unavailable.'
- : 'No machines available yet.',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ Flexible(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(6, 8, 6, 8),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (machine != null)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
+ child: SelectableText(
+ [
+ _status(machine),
+ if (machine.machine.ownerName
+ case final owner?)
+ 'shared by $owner',
+ ?machine.machine.hostname,
+ machine.machine.machineId,
+ ].join(' · '),
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
),
- ),
- if (rows.isEmpty)
- Padding(
- padding: const EdgeInsets.all(12),
- child: Text(
- empty,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ if (_machineId == null &&
+ app.machineStates.isEmpty &&
+ _machineQuery.text.isEmpty)
+ Padding(
+ padding: const EdgeInsets.all(12),
+ child: Text(
+ app.machinesLoading
+ ? 'Loading machines…'
+ : app.machineListError != null
+ ? 'Machine list unavailable.'
+ : 'No machines available yet.',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
),
- )
- else
- ...rows.map(_row),
- ],
+ if (rows.isEmpty)
+ Padding(
+ padding: const EdgeInsets.all(12),
+ child: Text(
+ empty,
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ )
+ else
+ ...rows.map(_row),
+ ],
+ ),
),
),
- ),
- BoxHintStrip(
- message: _refreshing || app.machinesRefreshing
- ? 'Refreshing machines…'
- : _message ?? app.machineListError,
- isError:
- !_refreshing &&
- !app.machinesRefreshing &&
- (_error ||
- _message == null && app.machineListError != null),
- hints: [
- if (rows.isNotEmpty)
+ BoxHintStrip(
+ message: _refreshing || app.machinesRefreshing
+ ? 'Refreshing machines…'
+ : _message ?? app.machineListError,
+ isError:
+ !_refreshing &&
+ !app.machinesRefreshing &&
+ (_error ||
+ _message == null && app.machineListError != null),
+ hints: [
+ if (rows.isNotEmpty)
+ BoxHint(
+ '${_hint('picker.previous', '↑')}/${_hint('picker.next', '↓')}',
+ 'select',
+ ),
+ if (rows.isNotEmpty)
+ BoxHint(
+ _hint('picker.accept', 'enter'),
+ _machineId == null && _selected?.machine != null
+ ? 'actions'
+ : 'open',
+ onTap: () => unawaited(_open(_selected)),
+ ),
BoxHint(
- '${_hint('picker.previous', '↑')}/${_hint('picker.next', '↓')}',
- 'select',
+ _hint(
+ 'picker.refresh',
+ Theme.of(context).platform == TargetPlatform.macOS
+ ? 'cmd-r'
+ : 'ctrl-r',
+ ),
+ 'refresh',
+ onTap: () => unawaited(_refresh()),
),
- if (rows.isNotEmpty)
BoxHint(
- _hint('picker.accept', 'enter'),
- _machineId == null && _selected?.machine != null
- ? 'actions'
- : 'open',
- onTap: () => unawaited(_open(_selected)),
- ),
- BoxHint(
- _hint(
- 'picker.refresh',
- Theme.of(context).platform == TargetPlatform.macOS
- ? 'cmd-r'
- : 'ctrl-r',
+ _hint('picker.cancel', 'esc'),
+ _machineId == null ? 'close' : 'back',
+ onTap: _back,
),
- 'refresh',
- onTap: () => unawaited(_refresh()),
- ),
- BoxHint(
- _hint('picker.cancel', 'esc'),
- _machineId == null ? 'close' : 'back',
- onTap: _back,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
- },
- );
+ );
+ },
+ );
+ }
}
Future<void> showMachineRenameDialog(
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index 928d17135..c034bff6a 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -5,6 +5,7 @@ import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../analytics/analytics.dart';
import '../state/pane_arrangement.dart';
@@ -795,7 +796,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
side: BorderSide(color: Colors.white.withValues(alpha: .24)),
),
title: Text(_title),
- titleTextStyle: boxMonoStyle(size: 12, color: kBoxFaint),
+ titleTextStyle: boxMonoStyle(color: kBoxFaint),
contentTextStyle: boxMonoStyle(),
titlePadding: EdgeInsets.fromLTRB(edgePadding, 12, edgePadding, 0),
contentPadding: EdgeInsets.fromLTRB(edgePadding, 16, edgePadding, 16),
@@ -1018,7 +1019,10 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
),
],
);
- final scale = MediaQuery.textScalerOf(context).scale(13) / 13;
+ final scale =
+ MediaQuery.textScalerOf(context)
+ .scale(terminalFontStore.size) /
+ 13;
final stacked =
(_advancedOpen || _confirmationPending) &&
constraints.maxWidth < 740 * math.min(1.4, scale);
@@ -1106,11 +1110,11 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
TextSpan(text: ' $prompt'),
],
),
- style: boxMonoStyle(size: 12, color: grid.AppPalette.textSecondary),
+ style: boxMonoStyle(color: grid.AppPalette.textSecondary),
),
),
if (helpTopic != null)
- HarnessHelpLink(topic: helpTopic, textStyle: boxMonoStyle(size: 12)),
+ HarnessHelpLink(topic: helpTopic, textStyle: boxMonoStyle()),
],
),
);
@@ -1119,7 +1123,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
/// but never on its width — so the task field, laid out outside the tiles'
/// LayoutBuilder, can be the same height as they are.
static double _tileHeight(TextScaler scaler, {required bool compactHeight}) {
- return math.max(32, scaler.scale(13) * 1.35 + 14);
+ return math.max(32, scaler.scale(terminalFontStore.size) * 1.35 + 14);
}
Widget _choices() => LayoutBuilder(
@@ -1257,10 +1261,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
child: Text(
'Couldn’t check whether ${_labelOf(_baseEngine(_engine))} is installed. '
'You can still try starting the harness.',
- style: boxMonoStyle(
- size: 12,
- color: grid.AppPalette.textSecondary,
- ),
+ style: boxMonoStyle(color: grid.AppPalette.textSecondary),
),
),
const SizedBox(width: 12),
@@ -1392,7 +1393,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
listenable: _task,
builder: (context, _) {
final radius = BorderRadius.circular(2);
- final line = MediaQuery.textScalerOf(context).scale(13) * 1.35;
+ final line =
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) * 1.35;
final padding = ((minHeight - line) / 2).clamp(6.0, double.infinity);
final tooLong = _taskTooLong;
final errorBorder = OutlineInputBorder(
@@ -1483,7 +1485,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
onPressed: _choicesLocked ? null : _toggleAdvanced,
style: TextButton.styleFrom(
foregroundColor: grid.AppPalette.textSecondary,
- textStyle: boxMonoStyle(size: 12),
+ textStyle: boxMonoStyle(),
minimumSize: const Size(28, 28),
padding: const EdgeInsets.all(6),
),
@@ -1500,10 +1502,16 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
/// How far the agent may go without asking. The field shows the mode; the menu says what each
/// one does, since "Accept edits" and "Plan first" mean little on their own.
Widget _permissionModeField(List<PermissionMode> modes) => SizedBox(
- width: 156 * math.min(1.8, MediaQuery.textScalerOf(context).scale(13) / 13),
+ width:
+ 156 *
+ math.min(
+ 1.8,
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) / 13,
+ ),
height: math.max(
34,
- MediaQuery.textScalerOf(context).scale(13) * 1.35 + 14,
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) * 1.35 +
+ 14,
),
child: AppSelectField<String>(
key: const Key('new-agent-permission-mode'),
@@ -1511,7 +1519,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
radius: 2,
height: math.max(
34,
- MediaQuery.textScalerOf(context).scale(13) * 1.35 + 14,
+ MediaQuery.textScalerOf(context).scale(terminalFontStore.size) * 1.35 +
+ 14,
),
menuWidth: 340,
value: _permissionModeFor(_baseEngine(_engine)),
diff --git a/desktop/lib/widgets/new_harness_box.dart b/desktop/lib/widgets/new_harness_box.dart
index 57cd568d9..714792d28 100644
--- a/desktop/lib/widgets/new_harness_box.dart
+++ b/desktop/lib/widgets/new_harness_box.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/permission_modes.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -61,13 +62,11 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
int get _pinnedCount => _profilePicker && box.supportsProfiles ? 2 : 0;
bool get _hasInput => !_launching;
_LaunchChoice _launchChoice = _LaunchChoice.create;
- String get _agentSummary => box.detectingAgent
- ? 'Detecting installed agents…'
- : [
- box.agentLabel,
- if (box.hasModes && box.mode != kDefaultPermissionMode) box.modeLabel,
- if (box.profileLabel case final profile?) 'profile $profile',
- ].join(' · ');
+ String get _agentSummary => [
+ box.agentLabel,
+ if (box.hasModes && box.mode != kDefaultPermissionMode) box.modeLabel,
+ if (box.profileLabel case final profile?) 'profile $profile',
+ ].join(' · ');
List<_LaunchChoice> get _launchChoices => [
_LaunchChoice.agent,
_LaunchChoice.machine,
@@ -132,6 +131,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
selection: TextSelection.collapsed(offset: box.query.length),
);
box.addListener(_changed);
+ terminalFontStore.addListener(_fontChanged);
HardwareKeyboard.instance.addHandler(_watchAlt);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
@@ -145,6 +145,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
_closeSettingsMenu?.call();
HardwareKeyboard.instance.removeHandler(_watchAlt);
box.removeListener(_changed);
+ terminalFontStore.removeListener(_fontChanged);
_text.dispose();
_focus.dispose();
_launchFocus.dispose();
@@ -205,7 +206,6 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
box.options,
box.cursor,
box.busy,
- box.detectingAgent,
box.checking,
box.listing,
box.status,
@@ -568,6 +568,8 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
_requestFocus();
}
+ void _fontChanged() => setState(() {});
+
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
@@ -578,7 +580,9 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
box.field == NewHarnessField.projectName ||
box.field == NewHarnessField.projectRepository ||
_projectMenu)
- ? scale.scale(13) * 1.35 + scale.scale(12) * 1.35 + 10
+ ? scale.scale(terminalFontStore.size) * 1.35 +
+ scale.scale(terminalFontStore.size) * 1.35 +
+ 10
: boxRowHeight(scale);
final input = Semantics(
label: '${_fieldName(box.field)}. ${box.hint}',
@@ -775,7 +779,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
NewHarnessField.mode => 'Permissions',
_ => _fieldName(box.field),
}.padRight(8)} ',
- style: boxMonoStyle(size: 12, color: grid.AppPalette.swarmAccent),
+ style: boxMonoStyle(color: grid.AppPalette.swarmAccent),
),
suffixIconConstraints: const BoxConstraints(minHeight: 38),
suffixIcon: !onTask && box.query.trim().isNotEmpty && box.matchCount > 0
@@ -838,7 +842,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
Expanded(
child: Text(
'Projects on ${box.machineLabel}',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -850,10 +854,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
: () => box.focusField(NewHarnessField.machine),
child: Text(
'Change Machine',
- style: boxMonoStyle(
- size: 12,
- color: grid.AppPalette.swarmAccent,
- ),
+ style: boxMonoStyle(color: grid.AppPalette.swarmAccent),
),
),
],
@@ -881,7 +882,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
: box.field == NewHarnessField.mode
? 'Permissions for ${box.agentSettingsLabel}'
: 'New Harness',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
if (!_agentPicker &&
@@ -972,9 +973,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
? _LaunchChoice.values.where((item) => item.name == name).firstOrNull
: null;
final highlighted = choice != null && choice == _launchChoice;
- final disabled =
- !enabled ||
- (name == 'create' ? box.busy || box.detectingAgent : box.locked);
+ final disabled = !enabled || (name == 'create' ? box.busy : box.locked);
final fieldLabel = '${name[0].toUpperCase()}${name.substring(1)}';
final checkbox =
name == 'worktree' && !box.checkingGit && box.gitError == null;
@@ -1013,7 +1012,6 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
Text(
'${fieldLabel.padRight(8)} ',
style: boxMonoStyle(
- size: 12,
color: active
? grid.AppPalette.swarmAccent
: kBoxFaint,
@@ -1025,7 +1023,6 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: boxMonoStyle(
- size: 12,
color: risky
? grid.AppPalette.warn
: disabled
@@ -1115,7 +1112,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
box.tildePath(folder),
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
],
@@ -1133,7 +1130,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
padding: const EdgeInsets.only(left: 8),
child: Text(
_keys['picker.accept'] ?? '↵',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
],
@@ -1166,7 +1163,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
: 'recent · ${recents.length}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
if (recents.isNotEmpty)
@@ -1215,7 +1212,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
box.query.trim().isEmpty
? 'Clone to ${box.machineLabel}:~/harnesses/<repository>'
: 'Paste a GitHub repository URL, or try openai/codex',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
);
@@ -1228,7 +1225,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
heightFactor: 1,
child: Text(
"${box.machineLabel}:~/harnesses/<name>",
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
);
@@ -1251,7 +1248,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
: 'Nothing matches “${box.query.trim()}” in '
'${_fieldName(box.field)}. Escape goes back.',
textAlign: TextAlign.center,
- style: const TextStyle(fontSize: 13, color: kBoxFaint),
+ style: terminalTextStyle(color: kBoxFaint),
),
),
);
@@ -1266,7 +1263,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
child: Text(
'No agents match “${box.query.trim()}”.',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
),
@@ -1394,7 +1391,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
option.detail,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
],
)
@@ -1424,7 +1421,6 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: boxMonoStyle(
- size: 12,
color: option.risky
? grid.AppPalette.warn
: kBoxFaint,
@@ -1468,7 +1464,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
Text(
_keys['picker.accept'] ?? '↵',
key: const ValueKey('new-harness-row-action'),
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
if (_agentPicker)
SizedBox(
@@ -1561,7 +1557,7 @@ class _NewHarnessBoxState extends State<NewHarnessBox> {
box.field == NewHarnessField.projectName
? 'use project'
: 'choose',
- onTap: box.detectingAgent && box.returnCreates ? null : _enter,
+ onTap: _enter,
),
if (_launching &&
!box.checking &&
@@ -1614,22 +1610,25 @@ class _AgentSettingsButtonState extends State<_AgentSettingsButton> {
bool _focused = false;
@override
- Widget build(BuildContext context) => Focus(
- onFocusChange: (focused) => setState(() => _focused = focused),
- child: Opacity(
- opacity: widget.visible || _focused ? 1 : 0,
- alwaysIncludeSemantics: true,
- child: IconButton(
- tooltip: widget.label,
- onPressed: widget.onPressed,
- icon: const Icon(LucideIcons.settings, size: 14, color: kBoxFaint),
- style: IconButton.styleFrom(
- padding: EdgeInsets.zero,
- minimumSize: const Size(28, 28),
- maximumSize: const Size(28, 28),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Focus(
+ onFocusChange: (focused) => setState(() => _focused = focused),
+ child: Opacity(
+ opacity: widget.visible || _focused ? 1 : 0,
+ alwaysIncludeSemantics: true,
+ child: IconButton(
+ tooltip: widget.label,
+ onPressed: widget.onPressed,
+ icon: const Icon(LucideIcons.settings, size: 14, color: kBoxFaint),
+ style: IconButton.styleFrom(
+ padding: EdgeInsets.zero,
+ minimumSize: const Size(28, 28),
+ maximumSize: const Size(28, 28),
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/new_harness_help.dart b/desktop/lib/widgets/new_harness_help.dart
index 6cac03411..62414d60d 100644
--- a/desktop/lib/widgets/new_harness_help.dart
+++ b/desktop/lib/widgets/new_harness_help.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart';
import '../shared/widgets/app_dialog.dart';
@@ -55,13 +56,7 @@ class _HarnessHelpLinkState extends State<HarnessHelpLink> {
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
textStyle:
widget.textStyle ??
- TextStyle(
- fontFamily: AppFont.sans,
- fontFamilyFallback: AppFont.sansFallback,
- fontSize: 14,
- fontWeight: FontWeight.w400,
- height: 1.4,
- ),
+ terminalTextStyle(fontWeight: FontWeight.w400, height: 1.4),
side: BorderSide.none,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
@@ -170,8 +165,7 @@ class _HarnessHelpDialogState extends State<_HarnessHelpDialog> {
header: true,
child: Text(
title,
- style: TextStyle(
- fontSize: compact ? 28 : 32,
+ style: terminalTextStyle(
height: 1.2,
fontWeight: AppFont.semibold,
color: AppPalette.textPrimary,
@@ -181,8 +175,7 @@ class _HarnessHelpDialogState extends State<_HarnessHelpDialog> {
const SizedBox(height: 20),
Text(
intro,
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
height: 1.5,
color: AppPalette.textSecondary,
),
@@ -317,8 +310,7 @@ class _HelpOption extends StatelessWidget {
children: [
Text(
title,
- style: TextStyle(
- fontSize: 18,
+ style: terminalTextStyle(
height: 1.4,
fontWeight: AppFont.semibold,
color: AppPalette.textPrimary,
@@ -327,8 +319,7 @@ class _HelpOption extends StatelessWidget {
const SizedBox(height: 8),
Text(
description,
- style: TextStyle(
- fontSize: 16,
+ style: terminalTextStyle(
height: 1.5,
color: AppPalette.textSecondary,
),
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index 7c37d75e2..2e4494db7 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -21,7 +21,7 @@ import '../state/pane_preset.dart';
import '../state/pane_arrangement.dart';
import '../state/terminal_pane.dart';
import '../terminal/terminal_binary.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import '../terminal/terminal_session.dart';
import '../theme/app_theme.dart';
import 'agent_drag.dart';
@@ -54,6 +54,7 @@ class PaneGrid extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return ValueListenableBuilder<AgentDragRef?>(
valueListenable: agentDrag,
builder: (context, dragging, _) {
@@ -470,120 +471,123 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
}
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, constraints) {
- final app = widget.notifier;
- final viewportChanged = _viewportSize != constraints.biggest;
- _viewportSize = constraints.biggest;
- if (_focusRevealPending && viewportChanged) {
- _revealFocusedPane(correctingLayout: true);
- }
- _focusRevealPending = false;
- final visible = [
- for (final pane in app.panes)
- if (app.zoomedPaneId == null || pane.id == app.zoomedPaneId) pane,
- ];
- final layout = _SwarmGeometry(
- count: visible.length,
- viewport: constraints.biggest,
- preset: app.presetFor(visible.length),
- minimum: _MinTile.of(),
- sizes: app.activeSwarm.paneSizes,
- );
- if (app.zoomedPaneId == null) {
- app.activeSwarm.arranged = layout.arrangement;
- app.activeSwarm.arrangedKey = layout.key;
- final minimum = _MinTile.of();
- app.activeSwarm.arrangedMinimum = Size(
- (minimum.width + kPaneGap) / (layout.width + kPaneGap),
- (minimum.height + kPaneGap) / (layout.height + kPaneGap),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final app = widget.notifier;
+ final viewportChanged = _viewportSize != constraints.biggest;
+ _viewportSize = constraints.biggest;
+ if (_focusRevealPending && viewportChanged) {
+ _revealFocusedPane(correctingLayout: true);
+ }
+ _focusRevealPending = false;
+ final visible = [
+ for (final pane in app.panes)
+ if (app.zoomedPaneId == null || pane.id == app.zoomedPaneId) pane,
+ ];
+ final layout = _SwarmGeometry(
+ count: visible.length,
+ viewport: constraints.biggest,
+ preset: app.presetFor(visible.length),
+ minimum: _MinTile.of(),
+ sizes: app.activeSwarm.paneSizes,
);
- }
- if (layout.columns != null) app.gridColumns = layout.columns;
- final rectangles = {
- for (var i = 0; i < visible.length; i++)
- visible[i].id: layout.rectangles[i],
- };
- final retainedIds = app.allPanes.map((pane) => pane.id).toSet();
- _inputLayers.removeWhere((id, _) => !retainedIds.contains(id));
- final scrollBehavior = ScrollConfiguration.of(context);
- // Both scroll views stay mounted when content fits. Stable ancestry
- // retains terminal views as a split grows or shrinks the canvas.
- return Focus(
- focusNode: _idleFocus,
- includeSemantics: false,
- child: Scrollbar(
- key: const ValueKey('swarm-horizontal-scrollbar'),
- controller: _horizontalScroll,
- thumbVisibility: layout.width > constraints.maxWidth,
- scrollbarOrientation: ScrollbarOrientation.bottom,
- notificationPredicate: (notification) =>
- notification.depth == 1 &&
- notification.metrics.axis == Axis.horizontal,
- // Keep the horizontal thumb at the viewport's bottom even when the
- // workspace also scrolls vertically. Terminals retain their bars.
- child: SingleChildScrollView(
- controller: _scroll,
- child: ScrollConfiguration(
- behavior: scrollBehavior.copyWith(scrollbars: false),
- child: SingleChildScrollView(
- controller: _horizontalScroll,
- scrollDirection: Axis.horizontal,
- child: ScrollConfiguration(
- behavior: scrollBehavior,
- child: SizedBox(
- width: layout.width,
- height: layout.height,
- child: Stack(
- children: [
- if (visible.isEmpty)
- Positioned.fill(
- child: widget.empty ?? _EmptyGrid(notifier: app),
- ),
- for (final pane in app.allPanes)
- if (rectangles.containsKey(pane.id) ||
- pane.lastViewSize != null)
- Positioned.fromRect(
- key: ValueKey(pane.id),
- rect:
- rectangles[pane.id] ??
- Offset.zero & pane.lastViewSize!,
- child: _PaneLayer(
- key: _inputLayers.putIfAbsent(
- pane.id,
- () => GlobalKey<_PaneLayerState>(),
- ),
- session: pane.session,
- visible: rectangles.containsKey(pane.id),
- presentation: _presentation(
- pane,
- rectangles.containsKey(pane.id),
- ),
- child: _PaneCell(
- key: pane.cellKey,
- notifier: app,
- pane: pane,
- dragging: widget.dragging,
+ if (app.zoomedPaneId == null) {
+ app.activeSwarm.arranged = layout.arrangement;
+ app.activeSwarm.arrangedKey = layout.key;
+ final minimum = _MinTile.of();
+ app.activeSwarm.arrangedMinimum = Size(
+ (minimum.width + kPaneGap) / (layout.width + kPaneGap),
+ (minimum.height + kPaneGap) / (layout.height + kPaneGap),
+ );
+ }
+ if (layout.columns != null) app.gridColumns = layout.columns;
+ final rectangles = {
+ for (var i = 0; i < visible.length; i++)
+ visible[i].id: layout.rectangles[i],
+ };
+ final retainedIds = app.allPanes.map((pane) => pane.id).toSet();
+ _inputLayers.removeWhere((id, _) => !retainedIds.contains(id));
+ final scrollBehavior = ScrollConfiguration.of(context);
+ // Both scroll views stay mounted when content fits. Stable ancestry
+ // retains terminal views as a split grows or shrinks the canvas.
+ return Focus(
+ focusNode: _idleFocus,
+ includeSemantics: false,
+ child: Scrollbar(
+ key: const ValueKey('swarm-horizontal-scrollbar'),
+ controller: _horizontalScroll,
+ thumbVisibility: layout.width > constraints.maxWidth,
+ scrollbarOrientation: ScrollbarOrientation.bottom,
+ notificationPredicate: (notification) =>
+ notification.depth == 1 &&
+ notification.metrics.axis == Axis.horizontal,
+ // Keep the horizontal thumb at the viewport's bottom even when the
+ // workspace also scrolls vertically. Terminals retain their bars.
+ child: SingleChildScrollView(
+ controller: _scroll,
+ child: ScrollConfiguration(
+ behavior: scrollBehavior.copyWith(scrollbars: false),
+ child: SingleChildScrollView(
+ controller: _horizontalScroll,
+ scrollDirection: Axis.horizontal,
+ child: ScrollConfiguration(
+ behavior: scrollBehavior,
+ child: SizedBox(
+ width: layout.width,
+ height: layout.height,
+ child: Stack(
+ children: [
+ if (visible.isEmpty)
+ Positioned.fill(
+ child: widget.empty ?? _EmptyGrid(notifier: app),
+ ),
+ for (final pane in app.allPanes)
+ if (rectangles.containsKey(pane.id) ||
+ pane.lastViewSize != null)
+ Positioned.fromRect(
+ key: ValueKey(pane.id),
+ rect:
+ rectangles[pane.id] ??
+ Offset.zero & pane.lastViewSize!,
+ child: _PaneLayer(
+ key: _inputLayers.putIfAbsent(
+ pane.id,
+ () => GlobalKey<_PaneLayerState>(),
+ ),
+ session: pane.session,
visible: rectangles.containsKey(pane.id),
- swarmMode: true,
- onSplit: widget.onSplit,
+ presentation: _presentation(
+ pane,
+ rectangles.containsKey(pane.id),
+ ),
+ child: _PaneCell(
+ key: pane.cellKey,
+ notifier: app,
+ pane: pane,
+ dragging: widget.dragging,
+ visible: rectangles.containsKey(pane.id),
+ swarmMode: true,
+ onSplit: widget.onSplit,
+ ),
),
),
- ),
- if (app.zoomedPaneId == null &&
- layout.arrangement?.dividers.isNotEmpty == true)
- Positioned.fill(child: _resizeLayer(layout)),
- ],
+ if (app.zoomedPaneId == null &&
+ layout.arrangement?.dividers.isNotEmpty == true)
+ Positioned.fill(child: _resizeLayer(layout)),
+ ],
+ ),
),
),
),
),
),
),
- ),
- );
- },
- );
+ );
+ },
+ );
+ }
Widget _resizeLayer(_SwarmGeometry layout) {
final app = widget.notifier;
@@ -622,10 +626,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
children: [
Text(
'resize >',
- style: boxMonoStyle(
- size: 12,
- color: grid.AppPalette.swarmAccent,
- ),
+ style: boxMonoStyle(color: grid.AppPalette.swarmAccent),
),
for (final (key, action) in const [
('arrows', 'resize'),
@@ -643,7 +644,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
TextSpan(text: action),
],
),
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
],
),
@@ -786,33 +787,36 @@ class _PresetCells extends StatelessWidget {
final PanePreset preset;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, constraints) {
- final minimum = _MinTile.of();
- final geometry = _SwarmGeometry(
- count: cells.length,
- viewport: constraints.biggest,
- preset: preset,
- minimum: Size(minimum.width, minimum.height),
- );
- final canvas = SizedBox(
- width: constraints.maxWidth,
- height: geometry.height,
- child: Stack(
- children: [
- for (var i = 0; i < cells.length; i++)
- Positioned.fromRect(
- rect: geometry.rectangles[i],
- child: ClipRect(child: cells[i]),
- ),
- ],
- ),
- );
- return geometry.height > constraints.maxHeight
- ? SingleChildScrollView(child: canvas)
- : canvas;
- },
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final minimum = _MinTile.of();
+ final geometry = _SwarmGeometry(
+ count: cells.length,
+ viewport: constraints.biggest,
+ preset: preset,
+ minimum: Size(minimum.width, minimum.height),
+ );
+ final canvas = SizedBox(
+ width: constraints.maxWidth,
+ height: geometry.height,
+ child: Stack(
+ children: [
+ for (var i = 0; i < cells.length; i++)
+ Positioned.fromRect(
+ rect: geometry.rectangles[i],
+ child: ClipRect(child: cells[i]),
+ ),
+ ],
+ ),
+ );
+ return geometry.height > constraints.maxHeight
+ ? SingleChildScrollView(child: canvas)
+ : canvas;
+ },
+ );
+ }
}
/// A hidden view retains its last configuration and geometry. Status changes
@@ -862,7 +866,10 @@ class _PaneLayerState extends State<_PaneLayer> {
}
@override
- Widget build(BuildContext context) => _layer;
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return _layer;
+ }
@override
void dispose() {
@@ -913,6 +920,7 @@ class _Lattice extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final minTile = _MinTile.of();
return LayoutBuilder(
builder: (context, constraints) {
@@ -989,6 +997,7 @@ class _Axis extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
if (children.length < 2) {
return children.isEmpty ? const SizedBox.shrink() : children.first;
}
@@ -1033,12 +1042,7 @@ class _MinTile {
final painter = TextPainter(
text: TextSpan(
text: 'mmmmmmmmmm',
- style: TextStyle(
- fontFamily: style.fontFamily,
- fontFamilyFallback: style.fontFamilyFallback,
- fontSize: style.fontSize,
- height: style.height,
- ),
+ style: terminalTextStyle(height: style.height),
),
textDirection: TextDirection.ltr,
)..layout();
@@ -1115,16 +1119,19 @@ class GridField extends StatelessWidget {
final Widget child;
@override
- Widget build(BuildContext context) => DecoratedBox(
- decoration: const BoxDecoration(gradient: _plum),
- child: DecoratedBox(
- decoration: const BoxDecoration(gradient: _rose),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return DecoratedBox(
+ decoration: const BoxDecoration(gradient: _plum),
child: DecoratedBox(
- decoration: const BoxDecoration(gradient: _amber),
- child: child,
+ decoration: const BoxDecoration(gradient: _rose),
+ child: DecoratedBox(
+ decoration: const BoxDecoration(gradient: _amber),
+ child: child,
+ ),
),
- ),
- );
+ );
+ }
}
/// The space between two tiles.
@@ -1147,10 +1154,13 @@ class _Gap extends StatelessWidget {
final Axis axis;
@override
- Widget build(BuildContext context) => SizedBox(
- width: axis == Axis.horizontal ? kPaneGap : null,
- height: axis == Axis.horizontal ? null : kPaneGap,
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return SizedBox(
+ width: axis == Axis.horizontal ? kPaneGap : null,
+ height: axis == Axis.horizontal ? null : kPaneGap,
+ );
+ }
}
/// How round a card's corners are — a pane, and the rail beside it. Public for the same reason
@@ -1182,12 +1192,15 @@ class _PaneCell extends StatelessWidget {
bool get _single => notifier.panes.length == 1;
@override
- Widget build(BuildContext context) => LayoutBuilder(
- builder: (context, constraints) {
- if (visible) pane.lastViewSize = constraints.biggest;
- return _build(context);
- },
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ if (visible) pane.lastViewSize = constraints.biggest;
+ return _build(context);
+ },
+ );
+ }
Widget _build(BuildContext context) {
grid.AppTheme.watch(context);
@@ -1345,6 +1358,7 @@ class _PaneContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final machine = notifier.stateOf(pane.machineId);
void close() => notifier.closePane(pane.id);
if (pane.sharedHarness case final grant?) {
@@ -1687,10 +1701,8 @@ class _FileDropZoneState extends State<_FileDropZone> {
),
child: Text(
'Drop to attach',
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 12.5,
fontWeight: FontWeight.w600,
),
),
@@ -1917,10 +1929,8 @@ class _SwapZone extends StatelessWidget {
),
child: Text(
'Swap with this pane',
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 12.5,
fontWeight: FontWeight.w600,
),
),
@@ -1963,6 +1973,7 @@ class _Guide extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return LayoutBuilder(
builder: (context, constraints) {
final roomForCard =
@@ -2012,10 +2023,8 @@ class _PaneHeader extends StatelessWidget {
child: Text(
title,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 13,
fontWeight: FontWeight.w600,
),
),
@@ -2079,13 +2088,13 @@ class _PaneStatus extends StatelessWidget {
: Icon(icon, size: 26, color: AppColors.mutedStrong),
),
const SizedBox(height: 10),
- Text(
- message,
- textAlign: TextAlign.center,
- style: TextStyle(
- color: AppColors.mutedStrong,
- fontFamily: AppFonts.sans,
- fontSize: 11.5,
+ Flexible(
+ child: SingleChildScrollView(
+ child: Text(
+ message,
+ textAlign: TextAlign.center,
+ style: terminalTextStyle(color: AppColors.mutedStrong),
+ ),
),
),
if (actionLabel != null && onAction != null) ...[
@@ -2155,10 +2164,8 @@ class _DropZone extends StatelessWidget {
paneId == null
? 'Open ${candidate.first?.name ?? 'agent'} here'
: 'Show ${candidate.first?.name ?? 'agent'} in this pane',
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 12,
fontWeight: FontWeight.w600,
),
),
@@ -2192,11 +2199,7 @@ class _AddSlot extends StatelessWidget {
const SizedBox(height: 8),
Text(
'Drop here for a new pane',
- style: TextStyle(
- color: AppColors.mutedStrong,
- fontFamily: AppFonts.sans,
- fontSize: 11.5,
- ),
+ style: terminalTextStyle(color: AppColors.mutedStrong),
),
],
),
@@ -2255,11 +2258,7 @@ class _EmptyGrid extends StatelessWidget {
children: [
Text(
'Select an agent, or drag one in from the left.',
- style: TextStyle(
- color: AppColors.mutedStrong,
- fontFamily: AppFonts.sans,
- fontSize: 12,
- ),
+ style: terminalTextStyle(color: AppColors.mutedStrong),
),
// Selecting and dragging both need an agent to already exist. On a
// first launch none does, so the two sentences around this button
@@ -2285,11 +2284,7 @@ class _EmptyGrid extends StatelessWidget {
Text(
'Press ${shortcutHintFor(ShortcutAction.showShortcuts)} for '
'keyboard shortcuts',
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontFamily: AppFonts.sans,
- fontSize: 11.5,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
],
),
@@ -2309,8 +2304,9 @@ String viewerPaneName(Agent? owner, Iterable<DshEntry> catalog) {
final used = entry?.viewerUse;
if (used != null) {
final viewer = catalog.where((e) => e.id == used).firstOrNull;
- if (viewer != null && viewer.name.trim().isNotEmpty)
+ if (viewer != null && viewer.name.trim().isNotEmpty) {
return viewer.name.trim();
+ }
}
final harness = owner.dshName ?? entry?.name;
return harness == null || harness.trim().isEmpty
diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dart
index d2a103663..79f9ed9b5 100644
--- a/desktop/lib/widgets/pane_header_actions.dart
+++ b/desktop/lib/widgets/pane_header_actions.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../theme/app_theme.dart';
@@ -244,6 +245,7 @@ class _CompactPaneActionsState extends State<_CompactPaneActions> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final enabled = widget.items
.where((item) => item.callback != null)
.toList();
@@ -277,7 +279,7 @@ class _CompactPaneActionsState extends State<_CompactPaneActions> {
focusNode: i == 0 ? _firstFocus : null,
onPressed: enabled[i].callback,
style: ButtonStyle(
- textStyle: WidgetStatePropertyAll(boxMonoStyle(size: 12)),
+ textStyle: WidgetStatePropertyAll(boxMonoStyle()),
foregroundColor: WidgetStatePropertyAll(AppColors.text),
minimumSize: const WidgetStatePropertyAll(Size(180, 30)),
shape: const WidgetStatePropertyAll(RoundedRectangleBorder()),
@@ -323,19 +325,22 @@ class PaneHeaderHover extends StatefulWidget {
class _PaneHeaderHoverState extends State<PaneHeaderHover> {
bool _hovered = false, _focused = false;
@override
- Widget build(BuildContext context) => MouseRegion(
- onEnter: (_) => setState(() => _hovered = true),
- onExit: (_) => setState(() => _hovered = false),
- child: Focus(
- canRequestFocus: false,
- includeSemantics: false,
- onFocusChange: (value) => setState(() => _focused = value),
- child: _PaneHeaderVisibility(
- visible: _hovered || _focused,
- child: widget.child,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return MouseRegion(
+ onEnter: (_) => setState(() => _hovered = true),
+ onExit: (_) => setState(() => _hovered = false),
+ child: Focus(
+ canRequestFocus: false,
+ includeSemantics: false,
+ onFocusChange: (value) => setState(() => _focused = value),
+ child: _PaneHeaderVisibility(
+ visible: _hovered || _focused,
+ child: widget.child,
+ ),
),
- ),
- );
+ );
+ }
}
class _PaneHeaderVisibility extends InheritedWidget {
@@ -368,6 +373,7 @@ class _ViewerToggle extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final glow = color.withValues(alpha: .55);
return IconButton(
tooltip: on ? 'Hide viewer' : 'Show viewer',
diff --git a/desktop/lib/widgets/pane_menu.dart b/desktop/lib/widgets/pane_menu.dart
index 2ec6359d6..7b0c32a2d 100644
--- a/desktop/lib/widgets/pane_menu.dart
+++ b/desktop/lib/widgets/pane_menu.dart
@@ -3,6 +3,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
@@ -181,15 +182,18 @@ class _PaneMenuFocusState extends State<_PaneMenuFocus> {
}
@override
- Widget build(BuildContext context) => KeymapRegion(
- contextKind: KeymapContext.picker,
- child: FocusScope(
- node: _scope,
- autofocus: true,
- onKeyEvent: _key,
- child: FocusTraversalGroup(child: widget.child),
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return KeymapRegion(
+ contextKind: KeymapContext.picker,
+ child: FocusScope(
+ node: _scope,
+ autofocus: true,
+ onKeyEvent: _key,
+ child: FocusTraversalGroup(child: widget.child),
+ ),
+ );
+ }
}
/// One selectable row of a pane menu.
@@ -228,7 +232,7 @@ Widget paneMenuEmpty(String text) => Padding(
kPaneMenuInset + kPaneMenuRowPadding,
6,
),
- child: Text(text, style: TextStyle(fontSize: 11, color: AppColors.textSoft)),
+ child: Text(text, style: terminalTextStyle(color: AppColors.textSoft)),
);
/// A section label. Non-interactive and short, so the groups read as groups rather than as
@@ -253,8 +257,7 @@ Widget paneMenuHeader(String label, {String? caption}) => Padding(
children: [
Text(
label,
- style: TextStyle(
- fontSize: 10.5,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
letterSpacing: .3,
color: AppColors.mutedStrong,
@@ -265,7 +268,7 @@ Widget paneMenuHeader(String label, {String? caption}) => Padding(
padding: const EdgeInsets.only(top: 2),
child: Text(
caption,
- style: TextStyle(fontSize: 10.5, color: AppColors.textSoft),
+ style: terminalTextStyle(color: AppColors.textSoft),
),
),
],
@@ -299,6 +302,7 @@ class PaneMenuRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final row = Row(
children: [
if (engine != null) ...[
@@ -308,16 +312,13 @@ class PaneMenuRow extends StatelessWidget {
leading!,
const SizedBox(width: 7),
],
- // ⚠️ Expanded on the TITLE, not on the status. The status is a handful of characters and
- // wants only what it needs; giving it the flexible half truncated
- // `Qwen3.6-35B-A3B-UD-Q5_K_XL` to `Qwen3.6-35B-A3B-UD-Q5_K…` while empty space sat beside
- // it. The long string here is the model id, so the model id is what gets the room.
+ // The title gets spare width; trailing metadata may ellipsize when
+ // the selected terminal size makes the combined line too wide.
Expanded(
child: Text(
title,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
// Stated rather than inherited: a PopupMenuItem's default text style is heavier than
// this menu wants, which read as every row being emphasised.
fontWeight: FontWeight.w400,
@@ -327,16 +328,24 @@ class PaneMenuRow extends StatelessWidget {
),
if (detail.isNotEmpty) ...[
const SizedBox(width: 6),
- Text(
- detail,
- style: TextStyle(fontSize: 11, color: AppColors.mutedStrong),
+ Flexible(
+ child: Text(
+ detail,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: terminalTextStyle(color: AppColors.mutedStrong),
+ ),
),
],
if (status != null) ...[
const SizedBox(width: 14),
- Text(
- status!,
- style: TextStyle(fontSize: 11, color: AppColors.mutedStrong),
+ Flexible(
+ child: Text(
+ status!,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: terminalTextStyle(color: AppColors.mutedStrong),
+ ),
),
],
],
@@ -368,7 +377,7 @@ class PaneMenuRow extends StatelessWidget {
child: Text(
subtitle!,
overflow: TextOverflow.ellipsis,
- style: TextStyle(fontSize: 10.5, color: AppColors.textSoft),
+ style: terminalTextStyle(color: AppColors.textSoft),
),
),
],
diff --git a/desktop/lib/widgets/prompt_context.dart b/desktop/lib/widgets/prompt_context.dart
index 653a15ad0..86ae2a5f5 100644
--- a/desktop/lib/widgets/prompt_context.dart
+++ b/desktop/lib/widgets/prompt_context.dart
@@ -4,7 +4,7 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/prompt_style.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'search_result_text.dart';
@@ -17,14 +17,13 @@ class PromptContextView extends StatelessWidget {
required this.contextData,
this.prefs,
this.store,
- this.size = 12,
this.matches = const [],
});
final PromptContext contextData;
final PromptPrefs? prefs;
final AppearancePrefsStore? store;
- final double size;
+ double get size => terminalFontStore.size;
final Iterable<SearchFieldMatch> matches;
@override
@@ -119,10 +118,7 @@ class PromptContextView extends StatelessWidget {
if (part.ascii.isNotEmpty) ...[
if (prefs.style == PromptStyle.plain ||
part.icon == null)
- Text(
- part.ascii,
- style: boxMonoStyle(size: size, color: tone),
- )
+ Text(part.ascii, style: boxMonoStyle(color: tone))
else
Icon(part.icon, size: size, color: tone),
const SizedBox(width: 4),
@@ -131,7 +127,7 @@ class PromptContextView extends StatelessWidget {
child: SearchResultText(
part.value,
matches: matches,
- style: boxMonoStyle(size: size, color: tone),
+ style: boxMonoStyle(color: tone),
),
),
],
diff --git a/desktop/lib/widgets/prompt_customize.dart b/desktop/lib/widgets/prompt_customize.dart
index cbdcf8cdc..d5361ab5e 100644
--- a/desktop/lib/widgets/prompt_customize.dart
+++ b/desktop/lib/widgets/prompt_customize.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
@@ -13,167 +14,162 @@ class PromptCustomize extends StatelessWidget {
final AppearancePrefsStore store;
@override
- Widget build(BuildContext context) => ValueListenableBuilder<AppearancePrefs>(
- valueListenable: store,
- builder: (context, appearance, _) {
- final prefs = appearance.prompt;
- void choose(PromptPrefs next) => unawaited(store.setPrompt(next));
- Widget toggle(
- String name,
- String label,
- bool value,
- ValueChanged<bool> onChanged,
- ) => TextButton(
- key: ValueKey('prompt-$name'),
- style: TextButton.styleFrom(
- alignment: Alignment.centerLeft,
- foregroundColor: grid.AppPalette.textPrimary,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(kTerminalCornerRadius),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ValueListenableBuilder<AppearancePrefs>(
+ valueListenable: store,
+ builder: (context, appearance, _) {
+ final prefs = appearance.prompt;
+ void choose(PromptPrefs next) => unawaited(store.setPrompt(next));
+ Widget toggle(
+ String name,
+ String label,
+ bool value,
+ ValueChanged<bool> onChanged,
+ ) => TextButton(
+ key: ValueKey('prompt-$name'),
+ style: TextButton.styleFrom(
+ alignment: Alignment.centerLeft,
+ foregroundColor: grid.AppPalette.textPrimary,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(kTerminalCornerRadius),
+ ),
),
),
- ),
- onPressed: () => onChanged(!value),
- child: Semantics(
- checked: value,
- label: label,
- child: ExcludeSemantics(
- child: Text(
- '${value ? '[x]' : '[ ]'} $label',
- style: boxMonoStyle(color: grid.AppPalette.textPrimary),
+ onPressed: () => onChanged(!value),
+ child: Semantics(
+ checked: value,
+ label: label,
+ child: ExcludeSemantics(
+ child: Text(
+ '${value ? '[x]' : '[ ]'} $label',
+ style: boxMonoStyle(color: grid.AppPalette.textPrimary),
+ ),
),
),
- ),
- );
- return SingleChildScrollView(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- 'header style',
- style: boxMonoStyle(color: grid.AppPalette.textSecondary),
- ),
- const SizedBox(height: 8),
- for (final style in PromptStyle.values)
- TextButton(
- key: ValueKey('prompt-style-${style.name}'),
- onPressed: () => choose(prefs.copyWith(style: style)),
- style: TextButton.styleFrom(
- alignment: Alignment.centerLeft,
- backgroundColor: prefs.style == style
- ? grid.AppSurface.selectedFill
- : null,
- padding: const EdgeInsets.symmetric(
- horizontal: 10,
- vertical: 10,
- ),
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(kTerminalCornerRadius),
+ );
+ return SingleChildScrollView(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(
+ 'header style',
+ style: boxMonoStyle(color: grid.AppPalette.textSecondary),
+ ),
+ const SizedBox(height: 8),
+ for (final style in PromptStyle.values)
+ TextButton(
+ key: ValueKey('prompt-style-${style.name}'),
+ onPressed: () => choose(prefs.copyWith(style: style)),
+ style: TextButton.styleFrom(
+ alignment: Alignment.centerLeft,
+ backgroundColor: prefs.style == style
+ ? grid.AppSurface.selectedFill
+ : null,
+ padding: const EdgeInsets.symmetric(
+ horizontal: 10,
+ vertical: 10,
),
- ),
- ),
- child: Semantics(
- selected: prefs.style == style,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '${prefs.style == style ? '>' : ' '} ${style.label}',
- style: boxMonoStyle(color: grid.AppPalette.textPrimary),
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.all(
+ Radius.circular(kTerminalCornerRadius),
),
- Padding(
- padding: const EdgeInsets.only(left: 16, top: 3),
- child: Text(
- style.description,
+ ),
+ ),
+ child: Semantics(
+ selected: prefs.style == style,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ '${prefs.style == style ? '>' : ' '} ${style.label}',
style: boxMonoStyle(
- size: 11,
- color: grid.AppPalette.textSecondary,
+ color: grid.AppPalette.textPrimary,
),
),
- ),
- ],
+ Padding(
+ padding: const EdgeInsets.only(left: 16, top: 3),
+ child: Text(
+ style.description,
+ style: boxMonoStyle(
+ color: grid.AppPalette.textSecondary,
+ ),
+ ),
+ ),
+ ],
+ ),
),
),
+ const SizedBox(height: 16),
+ Text(
+ 'preview',
+ style: boxMonoStyle(color: grid.AppPalette.textSecondary),
),
- const SizedBox(height: 16),
- Text(
- 'preview',
- style: boxMonoStyle(
- size: 11,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- const SizedBox(height: 6),
- TerminalBox(
- child: Padding(
- padding: const EdgeInsets.all(12),
- child: PromptContextView(
- key: const ValueKey('prompt-preview'),
- store: store,
- contextData: const PromptContext(
- harness: 'Codex',
- machine: 'devbox',
- project: 'openharness',
- branch: 'main',
+ const SizedBox(height: 6),
+ TerminalBox(
+ child: Padding(
+ padding: const EdgeInsets.all(12),
+ child: PromptContextView(
+ key: const ValueKey('prompt-preview'),
+ store: store,
+ contextData: const PromptContext(
+ harness: 'Codex',
+ machine: 'devbox',
+ project: 'openharness',
+ branch: 'main',
+ ),
),
),
),
- ),
- const SizedBox(height: 16),
- Text(
- 'context',
- style: boxMonoStyle(
- size: 11,
- color: grid.AppPalette.textSecondary,
+ const SizedBox(height: 16),
+ Text(
+ 'context',
+ style: boxMonoStyle(color: grid.AppPalette.textSecondary),
),
- ),
- toggle(
- 'machine',
- 'Machine',
- prefs.machine,
- (value) => choose(prefs.copyWith(machine: value)),
- ),
- toggle(
- 'project',
- 'Project',
- prefs.project,
- (value) => choose(prefs.copyWith(project: value)),
- ),
- toggle(
- 'branch',
- 'Branch',
- prefs.branch,
- (value) => choose(prefs.copyWith(branch: value)),
- ),
- toggle(
- 'color',
- 'Color',
- prefs.color,
- (value) => choose(prefs.copyWith(color: value)),
- ),
- const SizedBox(height: 8),
- Text(
- 'Applies to agent search and pane headers. Changes are saved as you choose.',
- style: boxMonoStyle(
- size: 11,
- color: grid.AppPalette.textSecondary,
+ toggle(
+ 'machine',
+ 'Machine',
+ prefs.machine,
+ (value) => choose(prefs.copyWith(machine: value)),
),
- ),
- const SizedBox(height: 12),
- TextButton(
- key: const ValueKey('prompt-reset'),
- onPressed: () => choose(const PromptPrefs()),
- child: Text(
- 'Reset header style',
+ toggle(
+ 'project',
+ 'Project',
+ prefs.project,
+ (value) => choose(prefs.copyWith(project: value)),
+ ),
+ toggle(
+ 'branch',
+ 'Branch',
+ prefs.branch,
+ (value) => choose(prefs.copyWith(branch: value)),
+ ),
+ toggle(
+ 'color',
+ 'Color',
+ prefs.color,
+ (value) => choose(prefs.copyWith(color: value)),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ 'Applies to agent search and pane headers. Changes are saved as you choose.',
style: boxMonoStyle(color: grid.AppPalette.textSecondary),
),
- ),
- ],
- ),
- );
- },
- );
+ const SizedBox(height: 12),
+ TextButton(
+ key: const ValueKey('prompt-reset'),
+ onPressed: () => choose(const PromptPrefs()),
+ child: Text(
+ 'Reset header style',
+ style: boxMonoStyle(color: grid.AppPalette.textSecondary),
+ ),
+ ),
+ ],
+ ),
+ );
+ },
+ );
+ }
}
diff --git a/desktop/lib/widgets/remote_folder_picker.dart b/desktop/lib/widgets/remote_folder_picker.dart
index 1a2ee8c5d..c9acefe8b 100644
--- a/desktop/lib/widgets/remote_folder_picker.dart
+++ b/desktop/lib/widgets/remote_folder_picker.dart
@@ -1,8 +1,11 @@
import 'dart:math' as math;
+import '../shared/widgets/labeled_field.dart';
+
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:path/path.dart' as p;
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
@@ -253,7 +256,7 @@ class _RemoteFolderPickerDialogState extends State<_RemoteFolderPickerDialog> {
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
final scale = MediaQuery.textScalerOf(context);
- _rowHeight = math.max(36, scale.scale(14) * 1.35 + 16);
+ _rowHeight = math.max(36, scale.scale(terminalFontStore.size) * 1.35 + 16);
final listHeight =
(MediaQuery.sizeOf(context).height - 320 - scale.scale(50)).clamp(
120.0,
@@ -321,6 +324,7 @@ class _RemoteFolderPickerDialogState extends State<_RemoteFolderPickerDialog> {
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 12),
+ const FieldLabel('Folder path'),
Focus(
onKeyEvent: (node, event) {
if (event is KeyDownEvent &&
@@ -345,7 +349,6 @@ class _RemoteFolderPickerDialogState extends State<_RemoteFolderPickerDialog> {
autofocus: true,
style: grid.kFieldTextStyle,
decoration: InputDecoration(
- labelText: 'Folder path',
hintText: 'Enter a full folder path…',
suffixIcon: IconButton(
tooltip: 'Open path',
diff --git a/desktop/lib/widgets/restart_agent_action.dart b/desktop/lib/widgets/restart_agent_action.dart
index e1af104a0..b859928eb 100644
--- a/desktop/lib/widgets/restart_agent_action.dart
+++ b/desktop/lib/widgets/restart_agent_action.dart
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import '../shortcuts/app_keymap.dart';
import '../state/app_state.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'engine_identity.dart';
import 'terminal_prompt.dart';
@@ -180,156 +180,152 @@ class _RestartAgentPromptState extends State<_RestartAgentPrompt> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => TerminalPromptKeys(
- focusNode: _focus,
- inputFocus: _focus,
- accept: _accept,
- cancel: _confirmAgain ? _cancelAgain : _close,
- pageDown: () => _page(1),
- pageUp: () => _page(-1),
- child: TerminalPrompt(
- child: Column(
- key: const ValueKey('agent-restart-prompt'),
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: ExcludeFocus(
- child: SingleChildScrollView(
- controller: _body,
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- _terminal ? 'Restart Terminal' : 'Restart Harness',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- const SizedBox(height: 12),
- Text(
- _attempt.agent?.name ?? widget.agentId,
- style: boxMonoStyle(weight: FontWeight.w600),
- ),
- if (widget.notifier
- .stateOf(widget.machineId)
- ?.machine
- .displayName
- case final machine?)
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => TerminalPromptKeys(
+ focusNode: _focus,
+ inputFocus: _focus,
+ accept: _accept,
+ cancel: _confirmAgain ? _cancelAgain : _close,
+ pageDown: () => _page(1),
+ pageUp: () => _page(-1),
+ child: TerminalPrompt(
+ child: Column(
+ key: const ValueKey('agent-restart-prompt'),
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: ExcludeFocus(
+ child: SingleChildScrollView(
+ controller: _body,
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
Text(
- machine,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ _terminal ? 'Restart Terminal' : 'Restart Harness',
+ style: boxMonoStyle(color: kBoxFaint),
),
- if (!_confirmAgain) ...[
- const SizedBox(height: 10),
+ const SizedBox(height: 12),
Text(
- _terminal ? 'Starts a fresh shell in the same pane.' : 'Restarts the harness in the same pane and tries to resume its conversation.',
- style: boxMonoStyle(size: 12, color: Colors.white70),
+ _attempt.agent?.name ?? widget.agentId,
+ style: boxMonoStyle(weight: FontWeight.w600),
),
- if (_busy) ...[
- const SizedBox(height: 8),
+ if (widget.notifier
+ .stateOf(widget.machineId)
+ ?.machine
+ .displayName
+ case final machine?)
+ Text(machine, style: boxMonoStyle(color: kBoxFaint)),
+ if (!_confirmAgain) ...[
+ const SizedBox(height: 10),
Text(
- 'Restart continues if you close this prompt.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ _terminal
+ ? 'Starts a fresh shell in the same pane.'
+ : 'Restarts the harness in the same pane and tries to resume its conversation.',
+ style: boxMonoStyle(color: Colors.white70),
),
- ],
- if (_error case final error?) ...[
- const SizedBox(height: 12),
- Text(
- error,
- style: boxMonoStyle(
- size: 12,
- color: Colors.orangeAccent,
+ if (_busy) ...[
+ const SizedBox(height: 8),
+ Text(
+ 'Restart continues if you close this prompt.',
+ style: boxMonoStyle(color: kBoxFaint),
),
- ),
- ],
- if (_fresh) ...[
- const SizedBox(height: 12),
- Text(
- 'Started a new conversation. The previous session could not be resumed.',
- style: boxMonoStyle(
- size: 12,
- color: Colors.orangeAccent,
+ ],
+ if (_error case final error?) ...[
+ const SizedBox(height: 12),
+ Text(
+ error,
+ style: boxMonoStyle(color: Colors.orangeAccent),
),
- ),
+ ],
+ if (_fresh) ...[
+ const SizedBox(height: 12),
+ Text(
+ 'Started a new conversation. The previous session could not be resumed.',
+ style: boxMonoStyle(color: Colors.orangeAccent),
+ ),
+ ],
],
],
- ],
- ),
- ),
- ),
- ),
- if (_confirmAgain) ...[
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
- child: Wrap(
- spacing: 12,
- children: [
- terminalPromptButton(
- 'Cancel',
- _cancelAgain,
- focusNode: _cancel,
),
- terminalPromptButton(
- 'Restart',
- _restartAgain,
- key: const Key('restart-again-confirm'),
- ),
- ],
+ ),
),
),
- ] else if (_attempt.awaitingConfirmation && !_busy && !_closeOnly)
- Padding(
- padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
- child: Align(
- alignment: Alignment.centerLeft,
- child: terminalPromptButton(
- 'Restart again…',
- _askAgain,
- key: const Key('restart-again'),
+ if (_confirmAgain) ...[
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
+ child: Wrap(
+ spacing: 12,
+ children: [
+ terminalPromptButton(
+ 'Cancel',
+ _cancelAgain,
+ focusNode: _cancel,
+ ),
+ terminalPromptButton(
+ 'Restart',
+ _restartAgain,
+ key: const Key('restart-again-confirm'),
+ ),
+ ],
),
),
- ),
- BoxHintStrip(
- message: _busy
- ? 'Restarting…'
- : (_confirmAgain
- ? 'May have already restarted.'
- : (_attempt.awaitingConfirmation && !_closeOnly
- ? 'Restart not confirmed.'
- : null)),
- isError: !_busy && _attempt.awaitingConfirmation,
- hints: [
- if (!_busy)
- BoxHint(
- terminalPromptHint(context, 'picker.accept', 'enter'),
- _confirmAgain
- ? 'select'
- : (_closeOnly
- ? 'close'
- : (_attempt.awaitingConfirmation && !_closeOnly
- ? 'check status'
- : 'retry')),
- onTap: _confirmAgain
- ? null
- : (_closeOnly ? _close : _retry),
+ ] else if (_attempt.awaitingConfirmation && !_busy && !_closeOnly)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: terminalPromptButton(
+ 'Restart again…',
+ _askAgain,
+ key: const Key('restart-again'),
+ ),
),
- if (_confirmAgain)
+ ),
+ BoxHintStrip(
+ message: _busy
+ ? 'Restarting…'
+ : (_confirmAgain
+ ? 'May have already restarted.'
+ : (_attempt.awaitingConfirmation && !_closeOnly
+ ? 'Restart not confirmed.'
+ : null)),
+ isError: !_busy && _attempt.awaitingConfirmation,
+ hints: [
+ if (!_busy)
+ BoxHint(
+ terminalPromptHint(context, 'picker.accept', 'enter'),
+ _confirmAgain
+ ? 'select'
+ : (_closeOnly
+ ? 'close'
+ : (_attempt.awaitingConfirmation && !_closeOnly
+ ? 'check status'
+ : 'retry')),
+ onTap: _confirmAgain
+ ? null
+ : (_closeOnly ? _close : _retry),
+ ),
+ if (_confirmAgain)
+ BoxHint(
+ terminalPromptHint(context, 'picker.complete', 'tab'),
+ 'controls',
+ ),
BoxHint(
- terminalPromptHint(context, 'picker.complete', 'tab'),
- 'controls',
+ terminalPromptHint(context, 'picker.cancel', 'esc'),
+ _confirmAgain ? 'back' : 'close',
+ onTap: _confirmAgain ? _cancelAgain : _close,
),
- BoxHint(
- terminalPromptHint(context, 'picker.cancel', 'esc'),
- _confirmAgain ? 'back' : 'close',
- onTap: _confirmAgain ? _cancelAgain : _close,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/shortcuts_sheet.dart b/desktop/lib/widgets/shortcuts_sheet.dart
index 23d0e87fd..8d33d1b56 100644
--- a/desktop/lib/widgets/shortcuts_sheet.dart
+++ b/desktop/lib/widgets/shortcuts_sheet.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
@@ -46,9 +47,8 @@ class _ShortcutsSheetState extends State<_ShortcutsSheet> {
padding: const EdgeInsets.fromLTRB(18, 17, 18, 4),
child: Text(
'Keyboard shortcuts',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 15,
fontWeight: grid.AppFont.semibold,
),
),
diff --git a/desktop/lib/widgets/status_rail/key_hints.dart b/desktop/lib/widgets/status_rail/key_hints.dart
index efbb46e2d..67990832a 100644
--- a/desktop/lib/widgets/status_rail/key_hints.dart
+++ b/desktop/lib/widgets/status_rail/key_hints.dart
@@ -1,4 +1,5 @@
import 'package:flutter/widgets.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../shared/theme/app_theme.dart' as grid;
import '../../state/app_state.dart';
@@ -85,30 +86,22 @@ class _Hint extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
keys,
- style: TextStyle(
- fontSize: 10.5,
+ style: terminalTextStyle(
// The chord is the brighter half. Someone scanning this is looking
// for a key, not reading a sentence — the word after it only has to
// confirm what they guessed.
color: grid.AppPalette.textSecondary,
- fontFamily: grid.AppFont.sans,
fontWeight: grid.AppFont.medium,
),
),
const SizedBox(width: 5),
- Text(
- what,
- style: TextStyle(
- fontSize: 10.5,
- color: grid.AppPalette.textFaint,
- fontFamily: grid.AppFont.sans,
- ),
- ),
+ Text(what, style: terminalTextStyle(color: grid.AppPalette.textFaint)),
],
);
}
diff --git a/desktop/lib/widgets/status_rail/status_rail.dart b/desktop/lib/widgets/status_rail/status_rail.dart
index bcef96007..ee6840f44 100644
--- a/desktop/lib/widgets/status_rail/status_rail.dart
+++ b/desktop/lib/widgets/status_rail/status_rail.dart
@@ -33,7 +33,8 @@ class StatusRail extends StatefulWidget {
/// Tall enough for an 11.5pt figure with a hit target around it, short enough
/// to stay furniture.
- static const double height = 26;
+ static double get height =>
+ (grid.AppFont.codeSize * 1.35 + 8).clamp(26, double.infinity);
@override
State<StatusRail> createState() => _StatusRailState();
@@ -67,7 +68,13 @@ class _StatusRailState extends State<StatusRail> {
// The keys had nowhere to live that was not a modal. See [KeyHints]
// for why a strip beats a sheet for the ones nobody knows to go
// looking for.
- KeyHints(notifier: widget.notifier),
+ Flexible(
+ flex: 3,
+ child: SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ child: KeyHints(notifier: widget.notifier),
+ ),
+ ),
],
),
),
diff --git a/desktop/lib/widgets/status_rail/usage_panel.dart b/desktop/lib/widgets/status_rail/usage_panel.dart
index 6821a2384..4a4b79598 100644
--- a/desktop/lib/widgets/status_rail/usage_panel.dart
+++ b/desktop/lib/widgets/status_rail/usage_panel.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../shared/theme/app_theme.dart' as grid;
import '../../usage/usage_accounts.dart';
@@ -82,9 +83,8 @@ class UsagePanelContent extends StatelessWidget {
const SizedBox(height: 10),
Text(
reading.message ?? 'No usage to show',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 11.5,
height: 1.35,
),
),
@@ -113,16 +113,18 @@ class _AccountCaption extends StatelessWidget {
final String? machineName;
@override
- Widget build(BuildContext context) => Text(
- _caption,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 11,
- fontWeight: grid.AppFont.medium,
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Text(
+ _caption,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: terminalTextStyle(
+ color: grid.AppPalette.textSecondary,
+ fontWeight: grid.AppFont.medium,
+ ),
+ );
+ }
String get _caption {
if (!account.isLocal) return account.machines.join(', ');
@@ -145,8 +147,7 @@ class _PanelScope extends StatelessWidget {
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
- final style = TextStyle(
- fontSize: 11,
+ final style = terminalTextStyle(
height: 1.35,
color: grid.AppPalette.textSecondary,
);
@@ -180,6 +181,7 @@ class _Header extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final fetchedAt = reading.fetchedAt;
return Row(
children: [
@@ -190,9 +192,8 @@ class _Header extends StatelessWidget {
const SizedBox(width: 7),
Text(
reading.provider.label,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 12.5,
fontWeight: grid.AppFont.semibold,
),
),
@@ -207,10 +208,7 @@ class _Header extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.right,
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontSize: 10.5,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
),
],
@@ -240,6 +238,7 @@ class _WindowRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final resetsIn = window.resetsInLabel();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -247,9 +246,8 @@ class _WindowRow extends StatelessWidget {
children: [
Text(
window.label,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 11.5,
fontWeight: grid.AppFont.medium,
),
),
@@ -260,10 +258,7 @@ class _WindowRow extends StatelessWidget {
children: [
Text(
'${window.usedPercent.round()}% used',
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 11,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
),
const Spacer(),
// No reset time means no countdown — never "resets in 0m", which
@@ -271,10 +266,7 @@ class _WindowRow extends StatelessWidget {
if (resetsIn != null)
Text(
'Resets in $resetsIn',
- style: TextStyle(
- color: grid.AppPalette.textFaint,
- fontSize: 11,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
],
),
diff --git a/desktop/lib/widgets/status_rail/usage_readout.dart b/desktop/lib/widgets/status_rail/usage_readout.dart
index 06de52374..44f5ce437 100644
--- a/desktop/lib/widgets/status_rail/usage_readout.dart
+++ b/desktop/lib/widgets/status_rail/usage_readout.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../../shared/theme/app_theme.dart' as grid;
import '../../shared/widgets/skeleton.dart';
@@ -107,10 +108,8 @@ class _ProviderFigures extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final style = TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 11.5,
- );
+ TerminalFontScope.watch(context);
+ final style = terminalTextStyle(color: grid.AppPalette.textSecondary);
return Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -151,6 +150,7 @@ class _AccountFigure extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
// ⚠️ ONE window, not every window this account reports — see
// [ProviderUsage.railWindow]. Claude answers with three and Codex with one,
// so printing them all made one account three figures wide and the other
@@ -224,17 +224,20 @@ class _UsageSkeleton extends StatelessWidget {
const _UsageSkeleton();
@override
- Widget build(BuildContext context) => Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: RailHoverTarget.gap,
- vertical: 4,
- ),
- child: SkeletonText(
- // Measured against what lands here — one figure per account, an engine
- // mark and a countdown each. A placeholder wider than its answer is the
- // jump a skeleton exists to prevent, in the other direction.
- style: TextStyle(fontSize: 11.5, fontWeight: grid.AppFont.medium),
- width: 84,
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: RailHoverTarget.gap,
+ vertical: 4,
+ ),
+ child: SkeletonText(
+ // Measured against what lands here — one figure per account, an engine
+ // mark and a countdown each. A placeholder wider than its answer is the
+ // jump a skeleton exists to prevent, in the other direction.
+ style: terminalTextStyle(fontWeight: grid.AppFont.medium),
+ width: 84,
+ ),
+ );
+ }
}
diff --git a/desktop/lib/widgets/swarm_attention.dart b/desktop/lib/widgets/swarm_attention.dart
index 0dd227779..e2e8c21c9 100644
--- a/desktop/lib/widgets/swarm_attention.dart
+++ b/desktop/lib/widgets/swarm_attention.dart
@@ -1,6 +1,7 @@
import 'swarm_search_field.dart';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
@@ -114,9 +115,13 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final scale = MediaQuery.textScalerOf(context);
- _rowHeight = (scale.scale(13) * 1.35 * 3 + scale.scale(11) * 1.3 + 36)
- .clamp(104, double.infinity);
+ _rowHeight =
+ (scale.scale(terminalFontStore.size) * 1.35 * 3 +
+ scale.scale(terminalFontStore.size) * 1.3 +
+ 36)
+ .clamp(104, double.infinity);
final selected = _rows.isEmpty ? null : _rows[_cursor];
return Dialog(
alignment: const Alignment(0, -0.5),
@@ -130,11 +135,11 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
children: [
Row(
children: [
- const Text('Needs input', style: TextStyle(fontSize: 16)),
+ Text('Needs input', style: terminalTextStyle()),
const SizedBox(width: 8),
Text(
'${_catalog.length}',
- style: const TextStyle(fontSize: 13, color: Colors.white54),
+ style: terminalTextStyle(color: Colors.white54),
),
const Spacer(),
IconButton(
@@ -165,10 +170,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
_catalog.isEmpty
? 'No agents need your input'
: 'No matching questions',
- style: const TextStyle(
- fontSize: 13,
- color: Colors.white60,
- ),
+ style: terminalTextStyle(color: Colors.white60),
),
)
: ListView.builder(
@@ -202,8 +204,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
destination.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.35,
fontWeight: FontWeight.w500,
),
@@ -213,8 +214,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
row.question.prompt,
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontSize: 13,
+ style: terminalTextStyle(
height: 1.35,
color: Colors.white70,
),
@@ -224,8 +224,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
destination.detail,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontSize: 11,
+ style: terminalTextStyle(
height: 1.3,
color: Colors.white54,
),
@@ -238,10 +237,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
: destination.hasView
? 'Jump'
: 'Open Harness',
- style: const TextStyle(
- fontSize: 11,
- color: Colors.white54,
- ),
+ style: terminalTextStyle(color: Colors.white54),
),
onTap: row.available
? () => Navigator.pop(context, row)
@@ -261,7 +257,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
: '↑↓ or ⌃N ⌃P to choose · Return to jump · Esc to close',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11, color: Colors.white54),
+ style: terminalTextStyle(color: Colors.white54),
),
),
],
diff --git a/desktop/lib/widgets/swarm_dialogs.dart b/desktop/lib/widgets/swarm_dialogs.dart
index 19c8a0ca3..4cc7e82d9 100644
--- a/desktop/lib/widgets/swarm_dialogs.dart
+++ b/desktop/lib/widgets/swarm_dialogs.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/widgets/app_dialog.dart';
import '../shared/widgets/app_select_field.dart';
@@ -120,83 +121,87 @@ class _ProjectDialogState extends State<_ProjectDialog> {
}
@override
- Widget build(BuildContext context) => AlertDialog(
- title: const Text('Add project'),
- content: SizedBox(
- width: 460,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text(
- 'Choose an existing working folder.',
- style: TextStyle(fontSize: 12, color: Colors.white60),
- ),
- const SizedBox(height: 20),
- if (machineId != null)
- AppSelectField<String>(
- value: machineId!,
- options: [
- for (final machine in widget.notifier.machineStates.values)
- SelectOption(
- value: machine.machine.machineId,
- label: machine.isLocalMachine
- ? 'This computer'
- : machine.machine.displayName,
- ),
- ],
- onChanged: (value) => setState(() {
- if (machineId == value) return;
- _machineRevision++;
- machineId = value;
- path = null;
- error = null;
- }),
- ),
- const SizedBox(height: 16),
- OutlinedButton.icon(
- onPressed: machineId == null || picking ? null : browse,
- icon: const Icon(Icons.folder_open, size: 17),
- label: Text(
- path ?? 'Choose folder',
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- if (widget.notifier.stateOf(machineId ?? '')?.isLocalMachine == true)
- TextButton(
- onPressed: picking ? null : clone,
- style: TextButton.styleFrom(foregroundColor: Colors.white70),
- child: const Text('Clone repository…'),
- ),
- if (error != null)
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return AlertDialog(
+ title: const Text('Add project'),
+ content: SizedBox(
+ width: 460,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
Text(
- error!,
- style: const TextStyle(color: Colors.orangeAccent, fontSize: 12),
+ 'Choose an existing working folder.',
+ style: terminalTextStyle(color: Colors.white60),
),
- ],
- ),
- ),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context),
- child: const Text('Cancel'),
- ),
- FilledButton(
- onPressed: path == null || folderName.isEmpty || picking
- ? null
- : () => Navigator.pop(
- context,
- SavedSwarmProject(
- machineId: machineId!,
- path: path!,
- name: folderName,
- ),
+ const SizedBox(height: 20),
+ if (machineId != null)
+ AppSelectField<String>(
+ value: machineId!,
+ options: [
+ for (final machine in widget.notifier.machineStates.values)
+ SelectOption(
+ value: machine.machine.machineId,
+ label: machine.isLocalMachine
+ ? 'This computer'
+ : machine.machine.displayName,
+ ),
+ ],
+ onChanged: (value) => setState(() {
+ if (machineId == value) return;
+ _machineRevision++;
+ machineId = value;
+ path = null;
+ error = null;
+ }),
+ ),
+ const SizedBox(height: 16),
+ OutlinedButton.icon(
+ onPressed: machineId == null || picking ? null : browse,
+ icon: const Icon(Icons.folder_open, size: 17),
+ label: Text(
+ path ?? 'Choose folder',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
),
- child: const Text('Add project'),
+ ),
+ if (widget.notifier.stateOf(machineId ?? '')?.isLocalMachine ==
+ true)
+ TextButton(
+ onPressed: picking ? null : clone,
+ style: TextButton.styleFrom(foregroundColor: Colors.white70),
+ child: const Text('Clone repository…'),
+ ),
+ if (error != null)
+ Text(
+ error!,
+ style: terminalTextStyle(color: Colors.orangeAccent),
+ ),
+ ],
+ ),
),
- ],
- );
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(context),
+ child: const Text('Cancel'),
+ ),
+ FilledButton(
+ onPressed: path == null || folderName.isEmpty || picking
+ ? null
+ : () => Navigator.pop(
+ context,
+ SavedSwarmProject(
+ machineId: machineId!,
+ path: path!,
+ name: folderName,
+ ),
+ ),
+ child: const Text('Add project'),
+ ),
+ ],
+ );
+ }
}
/// Link another machine. The dialog itself lives in
diff --git a/desktop/lib/widgets/swarm_project_agents.dart b/desktop/lib/widgets/swarm_project_agents.dart
index d7df3cc98..7776e6172 100644
--- a/desktop/lib/widgets/swarm_project_agents.dart
+++ b/desktop/lib/widgets/swarm_project_agents.dart
@@ -1,6 +1,7 @@
import 'swarm_search_field.dart';
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
@@ -52,92 +53,95 @@ class _ProjectAgentsState extends State<_ProjectAgents> {
}
@override
- Widget build(BuildContext context) => Dialog(
- child: SizedBox(
- width: 620,
- height: 520,
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- widget.group.name,
- style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
- ),
- const SizedBox(height: 8),
- const Text(
- 'Include agents from any machine. Matching repositories are included automatically.',
- style: TextStyle(fontSize: 12),
- ),
- const SizedBox(height: 16),
- SwarmSearchField(
- autofocus: true,
- hintText: 'Find a harness or machine',
- onChanged: (value) => setState(() => _query = value),
- ),
- const SizedBox(height: 12),
- Expanded(
- child: ListenableBuilder(
- listenable: widget.app,
- builder: (context, _) {
- final rows = swarmAgents(widget.app, _query);
- if (rows.isEmpty) {
- return const Center(child: Text('No matching harnesses'));
- }
- return ListView.builder(
- itemCount: rows.length,
- itemBuilder: (context, index) {
- final agent = rows[index];
- final id = (
- machineId: agent.machineId,
- agentId: agent.agent.id,
- );
- final automatic = _automatic.contains(id);
- return CheckboxListTile(
- controlAffinity: ListTileControlAffinity.leading,
- contentPadding: EdgeInsets.zero,
- value: automatic || _members.contains(id),
- title: Text(
- agent.agent.name,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 13),
- ),
- subtitle: Text(
- '${agent.machine.machine.displayName}${automatic ? ' · Repository match' : ''}',
- style: const TextStyle(fontSize: 11),
- ),
- onChanged: automatic
- ? null
- : (selected) => setState(() {
- if (selected == true) {
- _members.add(id);
- } else {
- _members.remove(id);
- }
- }),
- );
- },
- );
- },
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Dialog(
+ child: SizedBox(
+ width: 620,
+ height: 520,
+ child: Padding(
+ padding: const EdgeInsets.all(20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(
+ widget.group.name,
+ style: terminalTextStyle(fontWeight: FontWeight.w500),
),
- ),
- const SizedBox(height: 12),
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- TextButton(
- onPressed: () => Navigator.pop(context),
- child: const Text('Cancel'),
+ const SizedBox(height: 8),
+ Text(
+ 'Include agents from any machine. Matching repositories are included automatically.',
+ style: terminalTextStyle(),
+ ),
+ const SizedBox(height: 16),
+ SwarmSearchField(
+ autofocus: true,
+ hintText: 'Find a harness or machine',
+ onChanged: (value) => setState(() => _query = value),
+ ),
+ const SizedBox(height: 12),
+ Expanded(
+ child: ListenableBuilder(
+ listenable: widget.app,
+ builder: (context, _) {
+ final rows = swarmAgents(widget.app, _query);
+ if (rows.isEmpty) {
+ return const Center(child: Text('No matching harnesses'));
+ }
+ return ListView.builder(
+ itemCount: rows.length,
+ itemBuilder: (context, index) {
+ final agent = rows[index];
+ final id = (
+ machineId: agent.machineId,
+ agentId: agent.agent.id,
+ );
+ final automatic = _automatic.contains(id);
+ return CheckboxListTile(
+ controlAffinity: ListTileControlAffinity.leading,
+ contentPadding: EdgeInsets.zero,
+ value: automatic || _members.contains(id),
+ title: Text(
+ agent.agent.name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: terminalTextStyle(),
+ ),
+ subtitle: Text(
+ '${agent.machine.machine.displayName}${automatic ? ' · Repository match' : ''}',
+ style: terminalTextStyle(),
+ ),
+ onChanged: automatic
+ ? null
+ : (selected) => setState(() {
+ if (selected == true) {
+ _members.add(id);
+ } else {
+ _members.remove(id);
+ }
+ }),
+ );
+ },
+ );
+ },
),
- const SizedBox(width: 8),
- FilledButton(onPressed: _save, child: const Text('Save')),
- ],
- ),
- ],
+ ),
+ const SizedBox(height: 12),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ TextButton(
+ onPressed: () => Navigator.pop(context),
+ child: const Text('Cancel'),
+ ),
+ const SizedBox(width: 8),
+ FilledButton(onPressed: _save, child: const Text('Save')),
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/swarm_search_field.dart b/desktop/lib/widgets/swarm_search_field.dart
index dbee0c2b0..9f7ad5ca7 100644
--- a/desktop/lib/widgets/swarm_search_field.dart
+++ b/desktop/lib/widgets/swarm_search_field.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
class SwarmSearchField extends StatefulWidget {
const SwarmSearchField({
@@ -50,6 +51,7 @@ class _SwarmSearchFieldState extends State<SwarmSearchField> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final onMove = widget.onMove;
final onSubmitted = widget.onSubmitted;
return CallbackShortcuts(
@@ -83,7 +85,7 @@ class _SwarmSearchFieldState extends State<SwarmSearchField> {
autofocus: widget.autofocus,
onChanged: widget.onChanged,
onSubmitted: (_) => onSubmitted?.call(),
- style: const TextStyle(fontSize: 13),
+ style: terminalTextStyle(),
decoration: InputDecoration(
hintText: widget.hintText,
prefixIcon: const Icon(Icons.search, size: 18),
diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dart
index fe75e5413..6a6659096 100644
--- a/desktop/lib/widgets/swarm_search_input.dart
+++ b/desktop/lib/widgets/swarm_search_input.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../state/swarm_search.dart';
@@ -27,7 +28,6 @@ class SwarmSearchInput extends StatelessWidget {
this.fillColor,
this.trailing,
this.height,
- this.fontSize = 16,
this.prompt,
this.terminal = false,
});
@@ -54,7 +54,7 @@ class SwarmSearchInput extends StatelessWidget {
final double? height;
/// The typed text and the hint; the search glyph grows with it.
- final double fontSize;
+ double get fontSize => terminalFontStore.size;
final String? prompt;
/// Plain monospace input in a TerminalBox, without a decorative search glyph.
@@ -62,12 +62,15 @@ class SwarmSearchInput extends StatelessWidget {
final bool terminal;
@override
- Widget build(BuildContext context) => ListenableBuilder(
- // Command mode changes with the editor value. Result highlights do not,
- // so arrow navigation must not rebuild the text field.
- listenable: controller,
- builder: (context, _) => _buildInput(context),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ // Command mode changes with the editor value. Result highlights do not,
+ // so arrow navigation must not rebuild the text field.
+ listenable: controller,
+ builder: (context, _) => _buildInput(context),
+ );
+ }
Widget _buildInput(BuildContext context) {
final open = search != null;
@@ -98,8 +101,8 @@ class SwarmSearchInput extends StatelessWidget {
onTapOutside: onTapOutside == null ? null : (_) => onTapOutside!(),
onChanged: onChanged,
style: terminalStyle
- ? boxMonoStyle(size: fontSize)
- : TextStyle(fontSize: fontSize, color: Colors.white),
+ ? boxMonoStyle()
+ : terminalTextStyle(color: Colors.white),
cursorColor: grid.AppPalette.swarmAccent,
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
@@ -110,8 +113,8 @@ class SwarmSearchInput extends StatelessWidget {
? search!.hint
: hintText ?? search?.hint ?? kSwarmSearchHint,
hintStyle: terminalStyle
- ? boxMonoStyle(size: fontSize, color: kBoxFaint)
- : TextStyle(fontSize: fontSize, color: Colors.white60),
+ ? boxMonoStyle(color: kBoxFaint)
+ : terminalTextStyle(color: Colors.white60),
hintMaxLines: 1,
prefixIcon: prompt != null
? Padding(
@@ -121,10 +124,7 @@ class SwarmSearchInput extends StatelessWidget {
heightFactor: 1,
child: Text(
prompt!,
- style: boxMonoStyle(
- size: fontSize,
- color: grid.AppPalette.swarmAccent,
- ),
+ style: boxMonoStyle(color: grid.AppPalette.swarmAccent),
),
),
)
@@ -153,10 +153,7 @@ class SwarmSearchInput extends StatelessWidget {
foregroundColor: Colors.white60,
minimumSize: const Size(36, 28),
),
- child: const Text(
- 'esc',
- style: TextStyle(fontSize: 11),
- ),
+ child: Text('esc', style: terminalTextStyle()),
),
],
),
diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dart
index 1d6983e0d..4e3b50b9a 100644
--- a/desktop/lib/widgets/swarm_search_preview.dart
+++ b/desktop/lib/widgets/swarm_search_preview.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show ScrollCacheExtent;
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../shared/theme/prompt_style.dart';
@@ -160,102 +161,104 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
}
@override
- Widget build(BuildContext context) => AnimatedBuilder(
- animation: Listenable.merge([app, app.sessionPreviews]),
- builder: (context, _) {
- final row = widget.search.selected;
- if (row == null) return const SizedBox.shrink();
- _renderedId = row.id;
- final agents = _agents(app, row);
- return Semantics(
- container: true,
- label: 'Agent preview',
- child: Scrollbar(
- controller: _scroll,
- child: agents.length != 1
- ? ListView.builder(
- key: ValueKey('preview-content:${row.id}'),
- controller: _scroll,
- padding: EdgeInsets.all(
- widget.terminal
- ? 12
- : widget.compactHeader
- ? 16
- : 24,
- ),
- scrollCacheExtent: const ScrollCacheExtent.pixels(120),
- itemCount: agents.length + 1,
- itemBuilder: (context, index) => index == 0
- ? Padding(
- padding: const EdgeInsets.only(bottom: 24),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- row.title,
- // The list leads the eye; this confirms it.
- style: const TextStyle(
- fontSize: 15,
- fontWeight: FontWeight.w600,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return AnimatedBuilder(
+ animation: Listenable.merge([app, app.sessionPreviews]),
+ builder: (context, _) {
+ final row = widget.search.selected;
+ if (row == null) return const SizedBox.shrink();
+ _renderedId = row.id;
+ final agents = _agents(app, row);
+ return Semantics(
+ container: true,
+ label: 'Agent preview',
+ child: Scrollbar(
+ controller: _scroll,
+ child: agents.length != 1
+ ? ListView.builder(
+ key: ValueKey('preview-content:${row.id}'),
+ controller: _scroll,
+ padding: EdgeInsets.all(
+ widget.terminal
+ ? 12
+ : widget.compactHeader
+ ? 16
+ : 24,
+ ),
+ scrollCacheExtent: const ScrollCacheExtent.pixels(120),
+ itemCount: agents.length + 1,
+ itemBuilder: (context, index) => index == 0
+ ? Padding(
+ padding: const EdgeInsets.only(bottom: 24),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ row.title,
+ // The list leads the eye; this confirms it.
+ style: terminalTextStyle(
+ fontWeight: FontWeight.w600,
+ ),
),
- ),
- const SizedBox(height: 6),
- Text(row.detail, style: _muted),
- // Nothing exists yet behind the create row, so
- // there is no session to be missing text from.
- if (agents.isEmpty && !row.isCreate)
- const Padding(
- padding: EdgeInsets.only(top: 24),
- child: Text(
- 'No recent session text available.',
- style: _muted,
+ const SizedBox(height: 6),
+ Text(row.detail, style: _muted),
+ // Nothing exists yet behind the create row, so
+ // there is no session to be missing text from.
+ if (agents.isEmpty && !row.isCreate)
+ Padding(
+ padding: EdgeInsets.only(top: 24),
+ child: Text(
+ 'No recent session text available.',
+ style: _muted,
+ ),
),
+ ],
+ ),
+ )
+ : Padding(
+ padding: EdgeInsets.only(top: index > 1 ? 20 : 0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _AgentPreview(
+ app: app,
+ item: agents[index - 1],
+ compact: true,
+ terminal: widget.terminal,
),
- ],
+ if (index < agents.length)
+ const SizedBox(height: 20),
+ ],
+ ),
),
- )
- : Padding(
- padding: EdgeInsets.only(top: index > 1 ? 20 : 0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _AgentPreview(
- app: app,
- item: agents[index - 1],
- compact: true,
- terminal: widget.terminal,
- ),
- if (index < agents.length)
- const SizedBox(height: 20),
- ],
- ),
- ),
- )
- : SingleChildScrollView(
- key: ValueKey('preview-content:${row.id}'),
- controller: _scroll,
- padding: EdgeInsets.all(
- widget.terminal
- ? 12
- : widget.compactHeader
- ? 16
- : 24,
- ),
- child: _AgentPreview(
- app: app,
- item: agents.single,
- dense: widget.compactHeader,
- terminal: widget.terminal,
+ )
+ : SingleChildScrollView(
+ key: ValueKey('preview-content:${row.id}'),
+ controller: _scroll,
+ padding: EdgeInsets.all(
+ widget.terminal
+ ? 12
+ : widget.compactHeader
+ ? 16
+ : 24,
+ ),
+ child: _AgentPreview(
+ app: app,
+ item: agents.single,
+ dense: widget.compactHeader,
+ terminal: widget.terminal,
+ ),
),
- ),
- ),
- );
- },
- );
+ ),
+ );
+ },
+ );
+ }
}
-const _muted = TextStyle(fontSize: 12, height: 1.5, color: Colors.white54);
-const _body = TextStyle(fontSize: 14, height: 1.6, color: Color(0xffe1e1e4));
+TextStyle get _muted => terminalTextStyle(height: 1.5, color: Colors.white54);
+TextStyle get _body => terminalTextStyle(height: 1.6, color: Color(0xffe1e1e4));
class _AgentPreview extends StatelessWidget {
const _AgentPreview({
@@ -273,9 +276,10 @@ class _AgentPreview extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final muted = terminal ? boxMonoStyle(size: 11, color: kBoxFaint) : _muted;
+ TerminalFontScope.watch(context);
+ final muted = terminal ? boxMonoStyle(color: kBoxFaint) : _muted;
final body = terminal
- ? boxMonoStyle(size: 12, color: const Color(0xffe1e1e4))
+ ? boxMonoStyle(color: const Color(0xffe1e1e4))
: _body;
Widget section(String label, String text, {int? maxLines}) =>
_Section(label, text, maxLines: maxLines, terminal: terminal);
@@ -357,9 +361,8 @@ class _AgentPreview extends StatelessWidget {
Expanded(
child: Text(
agent.displayName,
- style: TextStyle(
+ style: terminalTextStyle(
// The list leads the eye; the preview confirms it.
- fontSize: 15,
fontWeight: FontWeight.w600,
height: 1.25,
),
@@ -367,7 +370,7 @@ class _AgentPreview extends StatelessWidget {
),
if (dense) ...[
const SizedBox(width: 10),
- Text(state, style: TextStyle(fontSize: 11, color: color)),
+ Text(state, style: terminalTextStyle(color: color)),
],
],
),
@@ -395,7 +398,7 @@ class _AgentPreview extends StatelessWidget {
color: color,
),
const SizedBox(width: 5),
- Text(state, style: TextStyle(fontSize: 11, color: color)),
+ Text(state, style: terminalTextStyle(color: color)),
],
),
),
@@ -449,8 +452,7 @@ class _AgentPreview extends StatelessWidget {
children: [
Text(
'Needs your input',
- style: TextStyle(
- fontSize: 12,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: color,
),
@@ -554,27 +556,30 @@ class _Section extends StatelessWidget {
final int? maxLines;
final bool terminal;
@override
- Widget build(BuildContext context) => Padding(
- padding: EdgeInsets.only(bottom: terminal ? 8 : 24),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- label,
- style: terminal
- ? boxMonoStyle(size: 11, color: kBoxFaint)
- : _muted.copyWith(fontWeight: FontWeight.w500),
- ),
- SizedBox(height: terminal ? 4 : 7),
- Text(
- _displayText(text),
- style: terminal ? boxMonoStyle(size: 12) : _body,
- maxLines: maxLines,
- overflow: maxLines == null ? null : TextOverflow.ellipsis,
- ),
- ],
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Padding(
+ padding: EdgeInsets.only(bottom: terminal ? 8 : 24),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ label,
+ style: terminal
+ ? boxMonoStyle(color: kBoxFaint)
+ : _muted.copyWith(fontWeight: FontWeight.w500),
+ ),
+ SizedBox(height: terminal ? 4 : 7),
+ Text(
+ _displayText(text),
+ style: terminal ? boxMonoStyle() : _body,
+ maxLines: maxLines,
+ overflow: maxLines == null ? null : TextOverflow.ellipsis,
+ ),
+ ],
+ ),
+ );
+ }
}
// Plain readable excerpts, not a second transcript renderer. Preserve the words
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 7101bb6d1..8c0cf34ae 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -8,7 +8,7 @@ import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
import 'box_chrome.dart';
import 'prompt_context.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'search_result_text.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -58,57 +58,60 @@ class _SwarmHistoryState extends State<_SwarmHistory> {
}
@override
- Widget build(BuildContext context) => Dialog(
- alignment: const Alignment(0, -0.5),
- insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 48),
- child: SizedBox(
- width: 680,
- height: 480,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: SwarmSearchKeys(
- search: widget.search,
- editing: _query,
- onChoose: _choose,
- onClose: () => Navigator.pop(context),
- onRefocus: _focus.requestFocus,
- child: Column(
- children: [
- const Row(
- children: [
- Text(
- 'History',
- style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
- ),
- Spacer(),
- Text(
- 'This session',
- style: TextStyle(fontSize: 11, color: Colors.white54),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Dialog(
+ alignment: const Alignment(0, -0.5),
+ insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 48),
+ child: SizedBox(
+ width: 680,
+ height: 480,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: SwarmSearchKeys(
+ search: widget.search,
+ editing: _query,
+ onChoose: _choose,
+ onClose: () => Navigator.pop(context),
+ onRefocus: _focus.requestFocus,
+ child: Column(
+ children: [
+ Row(
+ children: [
+ Text(
+ 'History',
+ style: terminalTextStyle(fontWeight: FontWeight.w500),
+ ),
+ Spacer(),
+ Text(
+ 'This session',
+ style: terminalTextStyle(color: Colors.white54),
+ ),
+ ],
+ ),
+ const SizedBox(height: 16),
+ SwarmSearchField(
+ controller: _query,
+ focusNode: _focus,
+ autofocus: true,
+ hintText: 'Search history…',
+ onChanged: widget.search.setQuery,
+ ),
+ const SizedBox(height: 8),
+ Expanded(
+ child: SwarmSearchResults(
+ search: widget.search,
+ onChoose: _choose,
+ onRefocus: _focus.requestFocus,
),
- ],
- ),
- const SizedBox(height: 16),
- SwarmSearchField(
- controller: _query,
- focusNode: _focus,
- autofocus: true,
- hintText: 'Search history…',
- onChanged: widget.search.setQuery,
- ),
- const SizedBox(height: 8),
- Expanded(
- child: SwarmSearchResults(
- search: widget.search,
- onChoose: _choose,
- onRefocus: _focus.requestFocus,
),
- ),
- ],
+ ],
+ ),
),
),
),
- ),
- );
+ );
+ }
}
/// Search and History share editing and navigation keys.
@@ -140,6 +143,7 @@ class SwarmSearchKeys extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final search = this.search;
bool composing() =>
editing.value.composing.isValid && !editing.value.composing.isCollapsed;
@@ -332,9 +336,14 @@ double swarmSearchRowHeight(
bool stacked = false,
}) => terminal
? stacked
- ? scale.scale(13) * 1.35 + scale.scale(12) * 1.35 + 8
+ ? scale.scale(terminalFontStore.size) * 1.35 +
+ scale.scale(terminalFontStore.size) * 1.35 +
+ 8
: boxRowHeight(scale)
- : (scale.scale(14) * 1.2 + 14).clamp(34, double.infinity);
+ : (scale.scale(terminalFontStore.size) * 1.2 + 14).clamp(
+ 34,
+ double.infinity,
+ );
double swarmSearchResultsHeight(
SwarmSearchController search,
@@ -523,6 +532,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final scale = MediaQuery.textScalerOf(context);
final acceptKey = effectiveCommandHint(
context,
@@ -546,7 +556,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
widget.terminal &&
!search.isCommandMode &&
!search.isHelpMode &&
- resultWidth < 700 * scale.scale(13) / 13;
+ resultWidth < 700 * scale.scale(terminalFontStore.size) / 13;
_rowHeight = swarmSearchRowHeight(
scale,
commands: search.isCommandMode,
@@ -562,7 +572,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
: constraints.maxHeight;
final compactAction =
(sideBySide ? constraints.maxWidth / 2 : constraints.maxWidth) <
- 380 * scale.scale(14) / 14;
+ 380 * scale.scale(terminalFontStore.size) / terminalFontSize;
final geometry = (Size(constraints.maxWidth, height), _rowHeight);
if (_geometry != geometry) {
_geometry = geometry;
@@ -585,7 +595,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
highlighted ? (search.canAccept, search.actionLabel(row)) : null,
_rowHeight,
compactAction,
- scale.scale(11),
+ scale.scale(terminalFontStore.size),
grid.AppTheme.palette.value,
acceptKey,
widget.terminal,
@@ -674,23 +684,26 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
? Text(
acceptKey ?? '',
key: const ValueKey('swarm-row-action'),
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
)
: row.shortcut == null
? null
: Text(
row.shortcut!,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
))
: alreadyHere && search.placement == null
- ? const Text(
+ ? Text(
'Already added',
- style: TextStyle(fontSize: 11, color: Colors.white54),
+ style: terminalTextStyle(color: Colors.white54),
)
: highlighted
? ConstrainedBox(
constraints: BoxConstraints(
- maxWidth: 170 * scale.scale(11) / 11,
+ maxWidth:
+ 170 *
+ scale.scale(terminalFontStore.size) /
+ terminalFontSize,
),
child: TextButton(
key: const ValueKey('swarm-row-action'),
@@ -708,7 +721,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
? null
: Text(
row.shortcut!,
- style: const TextStyle(fontSize: 12, color: Colors.white60),
+ style: terminalTextStyle(color: Colors.white60),
),
onTap: canSubmit ? () => _submit(row) : null,
);
@@ -763,10 +776,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
: search.adding
? 'No matching harnesses'
: 'No matching results',
- style: const TextStyle(
- fontSize: 14,
- color: Colors.white60,
- ),
+ style: terminalTextStyle(color: Colors.white60),
),
)
: Padding(
@@ -815,10 +825,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
: 'No room to open this ${selected.isSwarm || selected.isGroup ? 'group' : 'harness'}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontSize: 11,
- color: Colors.white60,
- ),
+ style: terminalTextStyle(color: Colors.white60),
),
),
],
@@ -986,7 +993,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
final title = SearchResultText(
row.title,
matches: matches.where((match) => match.title),
- style: widget.terminal ? boxMonoStyle() : const TextStyle(fontSize: 14),
+ style: widget.terminal ? boxMonoStyle() : terminalTextStyle(),
);
final detailText = widget.terminal
? row.terminalDetail ?? row.detail
@@ -1009,8 +1016,8 @@ class _SearchRowContentState extends State<_SearchRowContent> {
),
matches: matches.where((match) => !match.title),
style: widget.terminal
- ? boxMonoStyle(size: 12, color: kBoxFaint)
- : const TextStyle(fontSize: 12, color: Colors.white54),
+ ? boxMonoStyle(color: kBoxFaint)
+ : terminalTextStyle(color: Colors.white54),
)
: null;
return widget.stacked
@@ -1047,6 +1054,7 @@ class SwarmSearchActionLabel extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final hint = effectiveCommandHint(
context,
command,
@@ -1063,7 +1071,7 @@ class SwarmSearchActionLabel extends StatelessWidget {
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11),
+ style: terminalTextStyle(),
),
),
if (hint != null) ...[
@@ -1072,7 +1080,7 @@ class SwarmSearchActionLabel extends StatelessWidget {
if (hint.length > 1)
Text(
hint.substring(0, hint.length - 1),
- style: const TextStyle(fontSize: 11),
+ style: terminalTextStyle(),
),
const Icon(Icons.keyboard_return, size: 14),
] else
@@ -1082,7 +1090,7 @@ class SwarmSearchActionLabel extends StatelessWidget {
hint.replaceAll('↵', 'Return').replaceAll('⇥', 'Tab'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11),
+ style: terminalTextStyle(),
),
),
],
@@ -1115,92 +1123,97 @@ class SwarmSearchHints extends StatelessWidget {
final ValueChanged<String>? onQuery;
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: search,
- builder: (context, _) {
- String? key(
- String command, [
- KeymapContext kind = KeymapContext.picker,
- ]) => effectiveCommandHint(context, command, contextKind: kind);
- final selected = search.selected;
- final action = search.actionLabel(selected);
- // `>` and `?` only mean something at the start of an ordinary search: a
- // hint for a key that does nothing here is worse than no hint.
- final prefixes =
- search.allowsCommands && !search.isCommandMode && !search.isHelpMode;
- return BoxHintStrip(
- key: const ValueKey('swarm-search-hints'),
- hints: [
- if (search.resultsFromBottom)
- if ((key('picker.previous'), key('picker.next')) case (
- final String previous,
- final String next,
- ))
- BoxHint('$previous/$next', 'select'),
- if (key('picker.accept') case final accept?)
- BoxHint(
- accept,
- selected?.isCreate == true
- ? 'new harness'
- // Keep this hint short so filtering does not wrap the
- // footer and move the input above it on narrow windows.
- : search.placement != null && action == search.primaryAction
- ? 'open'
- : action.toLowerCase(),
- onTap: onSubmit,
- reserveLabel: search.resultsFromBottom ? 'focus pane' : null,
- ),
- if (!search.adding && search.canAdd(selected))
- if (key('picker.add_here') case final add?)
- BoxHint(add, 'add here', onTap: onAddHere),
- if (search.supportsPreview)
- if (key('picker.toggle_preview') case final toggle?)
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: search,
+ builder: (context, _) {
+ String? key(
+ String command, [
+ KeymapContext kind = KeymapContext.picker,
+ ]) => effectiveCommandHint(context, command, contextKind: kind);
+ final selected = search.selected;
+ final action = search.actionLabel(selected);
+ // `>` and `?` only mean something at the start of an ordinary search: a
+ // hint for a key that does nothing here is worse than no hint.
+ final prefixes =
+ search.allowsCommands &&
+ !search.isCommandMode &&
+ !search.isHelpMode;
+ return BoxHintStrip(
+ key: const ValueKey('swarm-search-hints'),
+ hints: [
+ if (search.resultsFromBottom)
+ if ((key('picker.previous'), key('picker.next')) case (
+ final String previous,
+ final String next,
+ ))
+ BoxHint('$previous/$next', 'select'),
+ if (key('picker.accept') case final accept?)
BoxHint(
- toggle,
- search.previewVisible ? 'preview on' : 'preview off',
- onTap: search.togglePreview,
- reserveLabel: search.resultsFromBottom ? 'preview off' : null,
+ accept,
+ selected?.isCreate == true
+ ? 'new harness'
+ // Keep this hint short so filtering does not wrap the
+ // footer and move the input above it on narrow windows.
+ : search.placement != null && action == search.primaryAction
+ ? 'open'
+ : action.toLowerCase(),
+ onTap: onSubmit,
+ reserveLabel: search.resultsFromBottom ? 'focus pane' : null,
),
- if (prefixes) ...[
- if (search.commands != null)
+ if (!search.adding && search.canAdd(selected))
+ if (key('picker.add_here') case final add?)
+ BoxHint(add, 'add here', onTap: onAddHere),
+ if (search.supportsPreview)
+ if (key('picker.toggle_preview') case final toggle?)
+ BoxHint(
+ toggle,
+ search.previewVisible ? 'preview on' : 'preview off',
+ onTap: search.togglePreview,
+ reserveLabel: search.resultsFromBottom ? 'preview off' : null,
+ ),
+ if (prefixes) ...[
+ if (search.commands != null)
+ BoxHint(
+ '>',
+ 'commands',
+ onTap: onQuery == null ? null : () => onQuery!('> '),
+ ),
BoxHint(
- '>',
- 'commands',
- onTap: onQuery == null ? null : () => onQuery!('> '),
+ '@',
+ 'machines',
+ onTap: onQuery == null ? null : () => onQuery!('@ '),
+ ),
+ BoxHint(
+ '#',
+ 'projects',
+ onTap: onQuery == null ? null : () => onQuery!('# '),
+ ),
+ ],
+ if (prefixes && search.modes != null && !search.commandsOnly)
+ BoxHint(
+ '?',
+ 'help',
+ onTap: onQuery == null ? null : () => onQuery!('?'),
+ ),
+ if (key('picker.cancel') case final cancel?)
+ BoxHint(
+ cancel,
+ search.canGoBack ? 'back' : 'close',
+ onTap: () {
+ if (search.back()) {
+ onQuery?.call(search.query);
+ } else {
+ onClose?.call();
+ }
+ },
),
- BoxHint(
- '@',
- 'machines',
- onTap: onQuery == null ? null : () => onQuery!('@ '),
- ),
- BoxHint(
- '#',
- 'projects',
- onTap: onQuery == null ? null : () => onQuery!('# '),
- ),
],
- if (prefixes && search.modes != null && !search.commandsOnly)
- BoxHint(
- '?',
- 'help',
- onTap: onQuery == null ? null : () => onQuery!('?'),
- ),
- if (key('picker.cancel') case final cancel?)
- BoxHint(
- cancel,
- search.canGoBack ? 'back' : 'close',
- onTap: () {
- if (search.back()) {
- onQuery?.call(search.query);
- } else {
- onClose?.call();
- }
- },
- ),
- ],
- );
- },
- );
+ );
+ },
+ );
+ }
}
/// fzf's `4/7`, in the input: how many of what could match do. It answers, at
@@ -1217,30 +1230,32 @@ class SwarmSearchCount extends StatelessWidget {
final bool terminal;
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: search,
- builder: (context, _) {
- final typed = search.matchQuery;
- // "0 of 71" beside a row that offers to make the thing reads as a bug.
- if (!terminal && (typed.trim().isEmpty || search.matchCount == 0)) {
- return const SizedBox.shrink();
- }
- return Padding(
- padding: const EdgeInsets.only(right: 4),
- child: Text(
- terminal
- ? '${search.matchCount}/${search.total}'
- : '${search.matchCount} of ${search.total}',
- key: const ValueKey('swarm-search-count'),
- style: terminal
- ? boxMonoStyle(size: 11, color: kBoxFaint)
- : const TextStyle(
- fontSize: 11,
- color: Colors.white54,
- fontFeatures: [FontFeature.tabularFigures()],
- ),
- ),
- );
- },
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: search,
+ builder: (context, _) {
+ final typed = search.matchQuery;
+ // "0 of 71" beside a row that offers to make the thing reads as a bug.
+ if (!terminal && (typed.trim().isEmpty || search.matchCount == 0)) {
+ return const SizedBox.shrink();
+ }
+ return Padding(
+ padding: const EdgeInsets.only(right: 4),
+ child: Text(
+ terminal
+ ? '${search.matchCount}/${search.total}'
+ : '${search.matchCount} of ${search.total}',
+ key: const ValueKey('swarm-search-count'),
+ style: terminal
+ ? boxMonoStyle(color: kBoxFaint)
+ : terminalTextStyle(
+ color: Colors.white54,
+ fontFeatures: [FontFeature.tabularFigures()],
+ ),
+ ),
+ );
+ },
+ );
+ }
}
diff --git a/desktop/lib/widgets/task_palette.dart b/desktop/lib/widgets/task_palette.dart
index 0a8c59f41..1f1630288 100644
--- a/desktop/lib/widgets/task_palette.dart
+++ b/desktop/lib/widgets/task_palette.dart
@@ -3,6 +3,7 @@ import 'dart:ui' show FontFeature, ImageFilter;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -577,9 +578,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
// Read-only rather than disabled while the router thinks: a disabled field drops the focus,
// and the focus is what Esc is listening on.
readOnly: working || _stage == _Stage.sent,
- style: const TextStyle(
+ style: terminalTextStyle(
color: _D.fieldInk,
- fontSize: _D.fieldSize,
height: 1.35,
letterSpacing: -0.22, // -.01em at 22px
),
@@ -587,7 +587,7 @@ class _TaskPaletteState extends State<_TaskPalette> {
cursorWidth: 2,
cursorHeight: _D.fieldSize * 1.05,
cursorRadius: Radius.zero,
- decoration: const InputDecoration(
+ decoration: InputDecoration(
filled: false,
isDense: true,
isCollapsed: true,
@@ -598,11 +598,7 @@ class _TaskPaletteState extends State<_TaskPalette> {
focusedBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: 'Describe the work…',
- hintStyle: TextStyle(
- color: _D.hint,
- fontSize: _D.fieldSize,
- height: 1.35,
- ),
+ hintStyle: terminalTextStyle(color: _D.hint, height: 1.35),
),
),
),
@@ -634,9 +630,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
child: Center(
child: Text(
'${_elapsed}s',
- style: const TextStyle(
+ style: terminalTextStyle(
color: _D.hint,
- fontSize: 11.5,
fontFeatures: [FontFeature.tabularFigures()],
),
),
@@ -660,11 +655,7 @@ class _TaskPaletteState extends State<_TaskPalette> {
padding: const EdgeInsets.fromLTRB(16, 6, 16, 8),
child: Text(
_note,
- style: const TextStyle(
- color: _D.questionInk,
- fontSize: 12,
- height: 1.45,
- ),
+ style: terminalTextStyle(color: _D.questionInk, height: 1.45),
),
),
]);
@@ -674,7 +665,7 @@ class _TaskPaletteState extends State<_TaskPalette> {
// it replaces: the eye is already on the row, and a lit row answers "who" as well as "done".
final taker = _named(_committed);
return _panel([
- const Padding(
+ Padding(
padding: EdgeInsets.fromLTRB(16, 8, 16, 6),
child: Row(
children: [
@@ -682,9 +673,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
SizedBox(width: 8),
Text(
'on it',
- style: TextStyle(
+ style: terminalTextStyle(
color: _D.green,
- fontSize: 13.5,
fontWeight: FontWeight.w500,
),
),
@@ -750,10 +740,9 @@ class _TaskPaletteState extends State<_TaskPalette> {
final reason = (answer?.reason ?? '').trim();
final weighed = answer?.weighed ?? 0;
final machines = answer?.machines ?? 0;
- const base = TextStyle(color: _D.questionInk, fontSize: 12, height: 1.45);
- const mark = TextStyle(
+ final base = terminalTextStyle(color: _D.questionInk, height: 1.45);
+ final mark = terminalTextStyle(
color: _D.questionMark,
- fontSize: 12,
fontWeight: FontWeight.w500,
);
return Padding(
@@ -795,9 +784,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
'“$reason”',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(
+ style: terminalTextStyle(
color: _D.machineDim,
- fontSize: 11.5,
fontStyle: FontStyle.italic,
),
),
@@ -862,9 +850,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
candidate.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: taken ? const Color(0xFFDFFBE9) : _D.engineInk,
- fontSize: 14,
fontWeight: FontWeight.w500,
),
),
@@ -876,9 +863,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
candidate.machine,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: taken ? const Color(0xFF9FD9B6) : _D.machineInk,
- fontSize: 12.5,
),
),
),
@@ -888,10 +874,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
candidate.recent,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: taken ? const Color(0xFFDFFBE9) : _D.nameInk,
- fontFamily: grid.AppFont.mono,
- fontSize: 13,
),
),
),
@@ -903,10 +887,8 @@ class _TaskPaletteState extends State<_TaskPalette> {
child: Text(
fit > 0 ? fit.toStringAsFixed(2) : '',
textAlign: TextAlign.right,
- style: TextStyle(
+ style: terminalTextStyle(
color: leader || taken ? _D.green : _D.lowFit,
- fontFamily: grid.AppFont.mono,
- fontSize: 12,
fontFeatures: const [FontFeature.tabularFigures()],
),
),
diff --git a/desktop/lib/widgets/terminal_composer.dart b/desktop/lib/widgets/terminal_composer.dart
index ff075eefe..65b10d485 100644
--- a/desktop/lib/widgets/terminal_composer.dart
+++ b/desktop/lib/widgets/terminal_composer.dart
@@ -174,7 +174,7 @@ class _TerminalComposerState extends State<TerminalComposer> {
child: MediaQuery.withNoTextScaling(
child: AnimatedContainer(
key: const ValueKey('terminal-composer-surface'),
- duration: const Duration(milliseconds: 140),
+ duration: Duration.zero,
curve: Curves.easeOut,
constraints: const BoxConstraints(minHeight: 48),
decoration: BoxDecoration(
@@ -200,7 +200,7 @@ class _TerminalComposerState extends State<TerminalComposer> {
padding: const EdgeInsets.only(left: 14, right: 10),
child: AnimatedDefaultTextStyle(
key: const ValueKey('terminal-composer-prompt-style'),
- duration: const Duration(milliseconds: 140),
+ duration: Duration.zero,
curve: Curves.easeOut,
style: terminalStyle
.toTextStyle(
diff --git a/desktop/lib/widgets/terminal_find_bar.dart b/desktop/lib/widgets/terminal_find_bar.dart
index 7131205ab..5db96d679 100644
--- a/desktop/lib/widgets/terminal_find_bar.dart
+++ b/desktop/lib/widgets/terminal_find_bar.dart
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import '../terminal/terminal_search.dart';
import 'box_chrome.dart';
import 'pane_menu.dart';
@@ -172,9 +172,9 @@ class TerminalFindBarState extends State<TerminalFindBar> {
),
child: Row(
children: [
- Expanded(child: Text(label, style: boxMonoStyle(size: 12))),
+ Expanded(child: Text(label, style: boxMonoStyle())),
const SizedBox(width: 16),
- Text(hint, style: boxMonoStyle(size: 11, color: kBoxFaint)),
+ Text(hint, style: boxMonoStyle(color: kBoxFaint)),
],
),
),
@@ -199,10 +199,13 @@ class TerminalFindBarState extends State<TerminalFindBar> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => _buildBar(context),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => _buildBar(context),
+ );
+ }
Widget _buildBar(BuildContext context) => FocusScope(
node: _scope,
@@ -332,7 +335,6 @@ class TerminalFindBarState extends State<TerminalFindBar> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: boxMonoStyle(
- size: 11,
color:
count == 0 && query.isNotEmpty && !searching
? const Color(0xffffb4a9)
@@ -357,7 +359,6 @@ class TerminalFindBarState extends State<TerminalFindBar> {
Text(
'Aa',
style: boxMonoStyle(
- size: 12,
color: sensitive ? Colors.white : Colors.white54,
weight: sensitive
? FontWeight.w700
diff --git a/desktop/lib/widgets/terminal_name_prompt.dart b/desktop/lib/widgets/terminal_name_prompt.dart
index 7902cf5df..a74070acb 100644
--- a/desktop/lib/widgets/terminal_name_prompt.dart
+++ b/desktop/lib/widgets/terminal_name_prompt.dart
@@ -2,7 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import 'box_chrome.dart';
import 'terminal_prompt.dart';
@@ -123,121 +123,120 @@ class _TerminalNamePromptState extends State<TerminalNamePrompt> {
}
@override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: terminalFontStore,
- builder: (context, _) => TerminalPromptKeys(
- inputFocus: _input,
- composing: () => _composing,
- cancel: _close,
- accept: _accept,
- child: TerminalPrompt(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Flexible(
- child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- widget.title,
- style: boxMonoStyle(size: 12, color: kBoxFaint),
- ),
- if (widget.detail case final detail?) ...[
- const SizedBox(height: 6),
- Text(
- detail,
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- ],
- const SizedBox(height: 10),
- ReadlineKeys(
- controller: _text,
- enabled: !_saving,
- onChanged: _changed,
- child: Semantics(
- label: widget.fieldLabel,
- child: TextField(
- key: widget.fieldKey,
- controller: _text,
- focusNode: _input,
- readOnly: _saving,
- maxLength: widget.maxLength,
- style: boxMonoStyle(),
- textAlignVertical: TextAlignVertical.center,
- textInputAction: TextInputAction.done,
- decoration: InputDecoration(
- hintText: widget.fieldLabel,
- hintStyle: boxMonoStyle(color: kBoxFaint),
- counterText: '',
- suffixText:
- widget.maxLength != null &&
- _text.text.characters.length >=
- widget.maxLength! - 10
- ? '${_text.text.characters.length}/${widget.maxLength}'
- : null,
- suffixStyle: boxMonoStyle(
- size: 11,
- color: kBoxFaint,
- ),
- isDense: true,
- filled: false,
- border: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- prefixIcon: Padding(
- padding: const EdgeInsets.only(right: 10),
- child: Center(
- widthFactor: 1,
- heightFactor: 1,
- child: Text(
- 'name >',
- style: boxMonoStyle(color: Colors.white70),
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => TerminalPromptKeys(
+ inputFocus: _input,
+ composing: () => _composing,
+ cancel: _close,
+ accept: _accept,
+ child: TerminalPrompt(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Flexible(
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(widget.title, style: boxMonoStyle(color: kBoxFaint)),
+ if (widget.detail case final detail?) ...[
+ const SizedBox(height: 6),
+ Text(
+ detail,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
+ const SizedBox(height: 10),
+ ReadlineKeys(
+ controller: _text,
+ enabled: !_saving,
+ onChanged: _changed,
+ child: Semantics(
+ label: widget.fieldLabel,
+ child: TextField(
+ key: widget.fieldKey,
+ controller: _text,
+ focusNode: _input,
+ readOnly: _saving,
+ maxLength: widget.maxLength,
+ style: boxMonoStyle(),
+ textAlignVertical: TextAlignVertical.center,
+ textInputAction: TextInputAction.done,
+ decoration: InputDecoration(
+ hintText: widget.fieldLabel,
+ hintStyle: boxMonoStyle(color: kBoxFaint),
+ counterText: '',
+ suffixText:
+ widget.maxLength != null &&
+ _text.text.characters.length >=
+ widget.maxLength! - 10
+ ? '${_text.text.characters.length}/${widget.maxLength}'
+ : null,
+ suffixStyle: boxMonoStyle(color: kBoxFaint),
+ isDense: true,
+ filled: false,
+ border: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: Center(
+ widthFactor: 1,
+ heightFactor: 1,
+ child: Text(
+ 'name >',
+ style: boxMonoStyle(color: Colors.white70),
+ ),
),
),
+ prefixIconConstraints: const BoxConstraints(
+ minHeight: 38,
+ ),
+ contentPadding: EdgeInsets.zero,
),
- prefixIconConstraints: const BoxConstraints(
- minHeight: 38,
- ),
- contentPadding: EdgeInsets.zero,
+ onChanged: _changed,
+ onEditingComplete: () {},
+ onSubmitted: (_) => _save(),
),
- onChanged: _changed,
- onEditingComplete: () {},
- onSubmitted: (_) => _save(),
),
),
- ),
- if (_saving)
- Text(
- 'Saving continues if you close this prompt.',
- style: boxMonoStyle(size: 11, color: kBoxFaint),
- ),
- ],
+ if (_saving)
+ Text(
+ 'Saving continues if you close this prompt.',
+ style: boxMonoStyle(color: kBoxFaint),
+ ),
+ ],
+ ),
),
),
- ),
- BoxHintStrip(
- message: _error ?? (_saving ? 'Saving name…' : null),
- isError: _error != null,
- hints: [
- if (!_saving)
+ BoxHintStrip(
+ message: _error ?? (_saving ? 'Saving name…' : null),
+ isError: _error != null,
+ hints: [
+ if (!_saving)
+ BoxHint(
+ terminalPromptHint(context, 'picker.accept', 'enter'),
+ 'save',
+ onTap: _save,
+ ),
BoxHint(
- terminalPromptHint(context, 'picker.accept', 'enter'),
- 'save',
- onTap: _save,
+ terminalPromptHint(context, 'picker.cancel', 'esc'),
+ 'close',
+ onTap: _close,
),
- BoxHint(
- terminalPromptHint(context, 'picker.cancel', 'esc'),
- 'close',
- onTap: _close,
- ),
- ],
- ),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index df767a7e1..83dd4d855 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -24,7 +24,7 @@ import 'terminal_find_bar.dart';
import '../terminal/terminal_search.dart';
import '../terminal/terminal_snapshot.dart';
import '../terminal/terminal_binary.dart';
-import '../terminal/terminal_font_store.dart';
+import '../terminal/terminal_text.dart';
import '../terminal/terminal_link_opener.dart';
import '../terminal/remote_media_download.dart';
import '../terminal/terminal_links.dart';
@@ -1512,22 +1512,9 @@ class _TerminalPanelState extends State<TerminalPanel>
),
padding: const EdgeInsets.all(10),
textStyle: terminalFontStore.value,
- // ⚠️ The terminal is NOT app chrome, and the user said so:
- // it carries its own font settings (Settings ▸ Terminal,
- // [terminalFontStore]) precisely because its type is a grid
- // a remote program is drawing into, not a label.
- //
- // Without this, `TerminalView` falls back to
- // `MediaQuery.textScalerOf(context)` (xterm's
- // terminal_view.dart:257), so the app-wide UI size would
- // change the cell size — and a changed cell size is not
- // cosmetic here: it re-derives `rows`, which fires
- // `Terminal.resize` → `session.resize` → a `terminal_resize`
- // frame on the wire and a real SIGWINCH at the far end.
- //
- // Read in `createRenderObject`, not only on update, so this
- // holds from the very first frame — no scaled first paint
- // and no startup resize.
+ // The chosen point size already sizes each terminal cell.
+ // Applying the OS text scale again would change rows/cols
+ // and resize the remote terminal unexpectedly.
textScaler: TextScaler.noScaling,
onKeyEvent: _onTerminalKey,
onTapDown: _onLinkTapDown,
@@ -1548,8 +1535,7 @@ class _TerminalPanelState extends State<TerminalPanel>
),
),
),
- // The header's status chip is 11pt in a corner; a person
- // mid-sentence never sees it. This band sits over the
+ // Keep the control notice beside the work. This band covers the
// frozen output itself, where the eyes already are, and
// stays through `opening` so the pane does not jump when
// it is answered.
@@ -1754,6 +1740,7 @@ class _TerminalHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final color = switch (session.status) {
TerminalSessionStatus.controlling => AppColors.success,
TerminalSessionStatus.opening ||
@@ -1856,7 +1843,7 @@ class _TerminalHeader extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: _stripPadding),
child: LayoutBuilder(
builder: (context, constraints) {
- final scale = MediaQuery.textScalerOf(context).scale(13) / 13;
+ final scale = terminalTextScaleOf(context);
final narrow = constraints.maxWidth < 560 * math.max(1, scale);
final rightWidth = narrow
? math.max(
@@ -1898,7 +1885,7 @@ class _TerminalHeader extends StatelessWidget {
overflow: TextOverflow.ellipsis,
style: boxMonoStyle(
color: AppColors.text,
- size: 12,
+
weight: FontWeight.w600,
),
),
@@ -1962,7 +1949,7 @@ class _TerminalHeader extends StatelessWidget {
status.label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11),
+ style: terminalTextStyle(),
),
),
],
@@ -2082,7 +2069,6 @@ class _TerminalHeader extends StatelessWidget {
machineName,
].join('\n'),
child: PromptContextView(
- size: narrow ? 11 : 12,
contextData: PromptContext(
machine: machineName,
project: narrow ? null : folder,
@@ -2141,6 +2127,7 @@ class _LinkModeMark extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final (icon, color, label) = switch (mode) {
'p2p' => (
LucideIcons.link2,
@@ -2263,7 +2250,8 @@ class _ControlBanner extends StatelessWidget {
// A quarter-width tile at large text cannot seat the sentence
// and the button on one line; there the button takes a line of
// its own under the title rather than running off the edge.
- final narrow = constraints.maxWidth < 340;
+ final narrow =
+ constraints.maxWidth < 340 * terminalTextScaleOf(context);
final lead = !busy
? Icon(Icons.lock_outline, size: 16, color: ink)
: SizedBox(
@@ -2282,10 +2270,8 @@ class _ControlBanner extends StatelessWidget {
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 12,
fontWeight: FontWeight.w700,
),
),
@@ -2295,10 +2281,8 @@ class _ControlBanner extends StatelessWidget {
detail,
maxLines: narrow ? 1 : 2,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: nudged ? ink : AppColors.textSoft,
- fontFamily: AppFonts.sans,
- fontSize: 11,
height: 1.3,
),
),
@@ -2332,13 +2316,7 @@ class _ControlBanner extends StatelessWidget {
prose,
if (button != null) ...[
const SizedBox(height: 8),
- Align(
- alignment: Alignment.centerRight,
- child: FittedBox(
- fit: BoxFit.scaleDown,
- child: button,
- ),
- ),
+ Align(alignment: Alignment.centerRight, child: button),
],
],
);
@@ -2367,6 +2345,7 @@ class _ControlBannerButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final onAccent = Theme.of(context).colorScheme.onPrimary;
return FilledButton(
onPressed: onPressed,
@@ -2379,12 +2358,10 @@ class _ControlBannerButton extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
- Text(
- 'Take control',
- style: TextStyle(
- fontFamily: AppFonts.sans,
- fontSize: 12,
- fontWeight: FontWeight.w600,
+ Flexible(
+ child: Text(
+ 'Take control',
+ style: terminalTextStyle(fontWeight: FontWeight.w600),
),
),
const SizedBox(width: 8),
@@ -2439,10 +2416,8 @@ class _TransferProgressBadge extends StatelessWidget {
child: Text(
'$label$percentLabel',
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.textSoft,
- fontFamily: AppFonts.sans,
- fontSize: 10,
fontWeight: FontWeight.w700,
),
),
@@ -2452,10 +2427,8 @@ class _TransferProgressBadge extends StatelessWidget {
onTap: onCancel,
child: Text(
'CANCEL',
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.textSoft,
- fontFamily: AppFonts.sans,
- fontSize: 10,
fontWeight: FontWeight.w700,
),
),
@@ -2540,10 +2513,8 @@ class _PaneGhost extends StatelessWidget {
child: Center(
child: Text(
session.agentName,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.mutedStrong,
- fontFamily: AppFonts.sans,
- fontSize: 15,
fontWeight: FontWeight.w600,
),
),
diff --git a/desktop/lib/widgets/terminal_prompt.dart b/desktop/lib/widgets/terminal_prompt.dart
index 2aa7de7c0..fbb8fc480 100644
--- a/desktop/lib/widgets/terminal_prompt.dart
+++ b/desktop/lib/widgets/terminal_prompt.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/widgets/app_dialog.dart';
import '../shortcuts/app_keymap.dart';
@@ -178,6 +179,7 @@ class TerminalPromptKeys extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final focused = Focus(
focusNode: focusNode,
autofocus: true,
@@ -217,16 +219,24 @@ class TerminalPrompt extends StatelessWidget {
final Widget child;
final double width;
@override
- Widget build(BuildContext context) => Dialog(
- alignment: Alignment.topCenter,
- insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),
- elevation: 0,
- backgroundColor: Colors.transparent,
- child: SizedBox(
- width: width,
- child: TerminalBox(child: child),
- ),
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Dialog(
+ alignment: Alignment.topCenter,
+ insetPadding: EdgeInsets.fromLTRB(
+ 16,
+ (MediaQuery.sizeOf(context).height * .08).clamp(16.0, 56.0),
+ 16,
+ 18,
+ ),
+ elevation: 0,
+ backgroundColor: Colors.transparent,
+ child: SizedBox(
+ width: width,
+ child: TerminalBox(child: child),
+ ),
+ );
+ }
}
Widget terminalPromptButton(
@@ -241,7 +251,7 @@ Widget terminalPromptButton(
onPressed: onPressed,
style: TextButton.styleFrom(
foregroundColor: danger ? Colors.orangeAccent : Colors.white70,
- textStyle: boxMonoStyle(size: 12),
+ textStyle: boxMonoStyle(),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
minimumSize: const Size(0, 30),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
diff --git a/desktop/lib/widgets/update_notice.dart b/desktop/lib/widgets/update_notice.dart
index 748f5d5f9..c9e902f2b 100644
--- a/desktop/lib/widgets/update_notice.dart
+++ b/desktop/lib/widgets/update_notice.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/app_version.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -127,9 +128,8 @@ class UpdateNotice extends StatelessWidget {
message,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 12.5,
),
),
),
@@ -137,9 +137,8 @@ class UpdateNotice extends StatelessWidget {
const SizedBox(width: 8),
Text(
'· ${formatDownloadSize(update.size)}',
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textFaint,
- fontSize: 11.5,
),
),
],
@@ -244,10 +243,7 @@ class _NoticeAction extends StatelessWidget {
? BorderSide(color: grid.AppGlass.hair)
: BorderSide.none,
),
- textStyle: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 12,
+ textStyle: terminalTextStyle(
fontWeight: primary ? grid.AppFont.semibold : grid.AppFont.regular,
),
),
@@ -456,7 +452,7 @@ class _UpdateDialog extends StatelessWidget {
// it belongs to the menu panel, not to a dialog.
child: ConstrainedBox(
constraints: BoxConstraints(
- maxWidth: 372 * MediaQuery.textScalerOf(context).scale(12.5) / 12.5,
+ maxWidth: 372 * terminalTextScaleOf(context),
),
child: SingleChildScrollView(
child: Padding(
@@ -489,18 +485,16 @@ class _UpdateDialog extends StatelessWidget {
const SizedBox(height: 12),
Text(
title,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textPrimary,
- fontSize: 15,
fontWeight: grid.AppFont.semibold,
),
),
const SizedBox(height: 5),
Text(
body,
- style: TextStyle(
+ style: terminalTextStyle(
color: grid.AppPalette.textSecondary,
- fontSize: 12.5,
height: 1.5,
),
),
@@ -578,20 +572,15 @@ class _Fact extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
- width: 96 * MediaQuery.textScalerOf(context).scale(11.5) / 11.5,
+ width: 96 * terminalTextScaleOf(context),
child: Text(
label,
- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 11.5),
+ style: terminalTextStyle(color: grid.AppPalette.textFaint),
),
),
Expanded(
child: DefaultTextStyle(
- style: TextStyle(
- color: grid.AppPalette.textSecondary,
- fontSize: 11.5,
- fontFamily: grid.AppFont.mono,
- fontFamilyFallback: grid.AppFont.monoFallback,
- ),
+ style: terminalTextStyle(color: grid.AppPalette.textSecondary),
child: value,
),
),
@@ -611,22 +600,25 @@ class _InstalledVersionState extends State<_InstalledVersion> {
late final Future<String> _info = runningAppVersion();
@override
- Widget build(BuildContext context) => FutureBuilder<String>(
- future: _info,
- builder: (context, snapshot) {
- final version = snapshot.data;
- if (version == null) {
- // Still reading: a blank measured against the ambient mono style the
- // row sets, so it and the version it becomes are the same line.
- // Answered with nothing: the dash, which is a value.
- return snapshot.connectionState == ConnectionState.done
- ? const Text('—')
- : SkeletonText(
- style: DefaultTextStyle.of(context).style,
- width: 44,
- );
- }
- return Text(version);
- },
- );
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return FutureBuilder<String>(
+ future: _info,
+ builder: (context, snapshot) {
+ final version = snapshot.data;
+ if (version == null) {
+ // Still reading: a blank measured against the ambient mono style the
+ // row sets, so it and the version it becomes are the same line.
+ // Answered with nothing: the dash, which is a value.
+ return snapshot.connectionState == ConnectionState.done
+ ? const Text('—')
+ : SkeletonText(
+ style: DefaultTextStyle.of(context).style,
+ width: 44,
+ );
+ }
+ return Text(version);
+ },
+ );
+ }
}
diff --git a/desktop/lib/widgets/verdict_marks.dart b/desktop/lib/widgets/verdict_marks.dart
index 7ab39ef84..cc7c9849a 100644
--- a/desktop/lib/widgets/verdict_marks.dart
+++ b/desktop/lib/widgets/verdict_marks.dart
@@ -3,6 +3,7 @@
// replacing the last — a status, not a history.
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../theme/app_theme.dart';
@@ -25,6 +26,7 @@ class VerdictStatus extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final active = verdict.activePhase;
final last = verdict.currentPhase;
final (icon, color, label, weight) = working
@@ -87,12 +89,7 @@ class VerdictStatus extends StatelessWidget {
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: color,
- fontFamily: AppFonts.sans,
- fontSize: 12,
- fontWeight: weight,
- ),
+ style: terminalTextStyle(color: color, fontWeight: weight),
),
),
],
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index 19763eb63..eb8eff7eb 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart' show AgentVerdict;
import '../core/test_run.dart';
@@ -95,41 +96,42 @@ class _WebPanePanelState extends State<WebPanePanel> {
// WebKit's default media policy wants a click before any playback, which
// leaves a viewer's muted video sitting at 00:00 with a play button; a
// pane whose whole point is the render the harness just made autoplays it.
- final controller = WebViewController.fromPlatformCreationParams(
- WebViewPlatform.instance is WebKitWebViewPlatform
- ? WebKitWebViewControllerCreationParams(
- allowsInlineMediaPlayback: true,
- mediaTypesRequiringUserAction: const <PlaybackMediaTypes>{},
- )
- : const PlatformWebViewControllerCreationParams(),
- )
- ..setJavaScriptMode(JavaScriptMode.unrestricted)
- ..setNavigationDelegate(
- NavigationDelegate(
- onPageStarted: (_) => _set(() {
- _loading = true;
- _failure = null;
- }),
- onPageFinished: (_) {
- _set(() => _loading = false);
- // A fresh document has no stamp; give it the app's appearance before it is looked at.
- _stampedBrightness = null;
- _stampTheme();
- },
- onWebResourceError: (error) {
- // Only the page itself: a harness's viewer pulls fonts, models
- // and images of its own, and one of those failing is its business
- // to show, not ours to call a dead viewer.
- if (error.isForMainFrame == false) return;
- _set(() {
- _loading = false;
- _failure = error.description.isNotEmpty
- ? error.description
- : 'The viewer did not answer.';
- });
- },
- ),
- );
+ final controller =
+ WebViewController.fromPlatformCreationParams(
+ WebViewPlatform.instance is WebKitWebViewPlatform
+ ? WebKitWebViewControllerCreationParams(
+ allowsInlineMediaPlayback: true,
+ mediaTypesRequiringUserAction: const <PlaybackMediaTypes>{},
+ )
+ : const PlatformWebViewControllerCreationParams(),
+ )
+ ..setJavaScriptMode(JavaScriptMode.unrestricted)
+ ..setNavigationDelegate(
+ NavigationDelegate(
+ onPageStarted: (_) => _set(() {
+ _loading = true;
+ _failure = null;
+ }),
+ onPageFinished: (_) {
+ _set(() => _loading = false);
+ // A fresh document has no stamp; give it the app's appearance before it is looked at.
+ _stampedBrightness = null;
+ _stampTheme();
+ },
+ onWebResourceError: (error) {
+ // Only the page itself: a harness's viewer pulls fonts, models
+ // and images of its own, and one of those failing is its business
+ // to show, not ours to call a dead viewer.
+ if (error.isForMainFrame == false) return;
+ _set(() {
+ _loading = false;
+ _failure = error.description.isNotEmpty
+ ? error.description
+ : 'The viewer did not answer.';
+ });
+ },
+ ),
+ );
_controller = controller;
_load();
}
@@ -171,7 +173,9 @@ class _WebPanePanelState extends State<WebPanePanel> {
_stampedBrightness = brightness;
final theme = brightness == Brightness.dark ? 'dark' : 'light';
controller
- .runJavaScript("document.documentElement.setAttribute('data-theme','$theme')")
+ .runJavaScript(
+ "document.documentElement.setAttribute('data-theme','$theme')",
+ )
.catchError((_) {});
}
@@ -231,10 +235,7 @@ class _WebPanePanelState extends State<WebPanePanel> {
// would only repeat what the pane shows. A status, not a history.
Expanded(
child: Tooltip(
- message: [
- widget.ownerName,
- ?widget.pane.url,
- ].join('\n'),
+ message: [widget.ownerName, ?widget.pane.url].join('\n'),
waitDuration: const Duration(milliseconds: 700),
child: Row(
children: [
@@ -243,10 +244,8 @@ class _WebPanePanelState extends State<WebPanePanel> {
widget.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 13,
fontWeight: FontWeight.w600,
),
),
@@ -254,9 +253,8 @@ class _WebPanePanelState extends State<WebPanePanel> {
if (widget.verdict case final verdict?) ...[
Text(
' · ',
- style: TextStyle(
+ style: terminalTextStyle(
color: AppColors.mutedStrong,
- fontSize: 13,
fontWeight: FontWeight.w500,
),
),
@@ -354,6 +352,7 @@ class _ViewerActions extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
Widget action(String tooltip, IconData icon, VoidCallback? callback) =>
IconButton(
tooltip: tooltip,
@@ -413,39 +412,35 @@ class _Notice extends StatelessWidget {
final Widget? action;
@override
- Widget build(BuildContext context) => Center(
- child: Padding(
- padding: const EdgeInsets.all(20),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(icon, size: 26, color: AppColors.mutedStrong),
- const SizedBox(height: 10),
- Text(
- title,
- style: TextStyle(
- color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 12.5,
- fontWeight: FontWeight.w600,
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return Center(
+ child: Padding(
+ padding: const EdgeInsets.all(20),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(icon, size: 26, color: AppColors.mutedStrong),
+ const SizedBox(height: 10),
+ Text(
+ title,
+ style: terminalTextStyle(
+ color: AppColors.text,
+ fontWeight: FontWeight.w600,
+ ),
),
- ),
- const SizedBox(height: 4),
- Text(
- detail,
- textAlign: TextAlign.center,
- maxLines: 3,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: AppColors.mutedStrong,
- fontFamily: AppFonts.mono,
- fontFamilyFallback: AppFonts.monoFallback,
- fontSize: 11,
+ const SizedBox(height: 4),
+ Text(
+ detail,
+ textAlign: TextAlign.center,
+ maxLines: 3,
+ overflow: TextOverflow.ellipsis,
+ style: terminalTextStyle(color: AppColors.mutedStrong),
),
- ),
- if (action != null) ...[const SizedBox(height: 8), action!],
- ],
+ if (action != null) ...[const SizedBox(height: 8), action!],
+ ],
+ ),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/lib/widgets/welcome_project_example.dart b/desktop/lib/widgets/welcome_project_example.dart
index 1957e8b53..cf597fe1c 100644
--- a/desktop/lib/widgets/welcome_project_example.dart
+++ b/desktop/lib/widgets/welcome_project_example.dart
@@ -1,6 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import 'box_chrome.dart';
@@ -21,47 +22,49 @@ class WelcomeProjectOutput extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
if (example != WelcomeProjectExample.code) {
return SizedBox.expand(
child: CustomPaint(painter: _RobotComponent(example)),
);
}
final syntax = grid.AppPalette.teal;
- return FittedBox(
- fit: BoxFit.scaleDown,
- alignment: Alignment.topLeft,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text('controller.ts', style: boxMonoStyle(size: 10, color: faint)),
- const SizedBox(height: 10),
- Text.rich(
- TextSpan(
- children: [
- TextSpan(
- text: 'const ',
- style: TextStyle(color: syntax),
- ),
- const TextSpan(text: 'arm = new RobotArm();\n\n'),
- for (final command in [
- 'arm.moveTo(pickup);',
- 'arm.gripper.close();',
- 'arm.moveTo(dropoff);',
- 'arm.gripper.open();',
- ]) ...[
+ return SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ child: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text('controller.ts', style: boxMonoStyle(color: faint)),
+ const SizedBox(height: 10),
+ Text.rich(
+ TextSpan(
+ children: [
TextSpan(
- text: 'await ',
+ text: 'const ',
style: TextStyle(color: syntax),
),
- TextSpan(text: '$command\n'),
+ const TextSpan(text: 'arm = new RobotArm();\n\n'),
+ for (final command in [
+ 'arm.moveTo(pickup);',
+ 'arm.gripper.close();',
+ 'arm.moveTo(dropoff);',
+ 'arm.gripper.open();',
+ ]) ...[
+ TextSpan(
+ text: 'await ',
+ style: TextStyle(color: syntax),
+ ),
+ TextSpan(text: '$command\n'),
+ ],
],
- ],
+ ),
+ softWrap: false,
+ style: boxMonoStyle(color: ink),
),
- softWrap: false,
- style: boxMonoStyle(size: 12, color: ink),
- ),
- ],
+ ],
+ ),
),
);
}
diff --git a/desktop/lib/widgets/window_chrome.dart b/desktop/lib/widgets/window_chrome.dart
index 8c3a76aab..743be7acf 100644
--- a/desktop/lib/widgets/window_chrome.dart
+++ b/desktop/lib/widgets/window_chrome.dart
@@ -2,6 +2,7 @@ import 'dart:io' show Platform;
import 'package:flutter/widgets.dart';
import 'package:window_manager/window_manager.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../core/desktop_window.dart';
import '../shared/theme/app_theme.dart' as grid;
@@ -59,8 +60,7 @@ class HarnessTopBar extends StatelessWidget {
alignment: Alignment.centerLeft,
child: Text(
'Harness',
- style: TextStyle(
- fontSize: 12.5,
+ style: terminalTextStyle(
fontWeight: FontWeight.w600,
color: grid.AppPalette.textSecondary,
),
@@ -92,6 +92,7 @@ class WindowDragArea extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return GestureDetector(
// Translucent, like DragToMoveArea: the drag has to be available from
// the gaps between whatever the region draws.
@@ -114,6 +115,7 @@ class WindowDragStrip extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return DragToMoveArea(
child: SizedBox(
height: Platform.isMacOS ? windowDragBandHeight : 0,
@@ -136,6 +138,7 @@ class FullWindowScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
return Stack(
children: [
Positioned.fill(child: child),
diff --git a/desktop/lib/widgets/workspace_quick_start.dart b/desktop/lib/widgets/workspace_quick_start.dart
index ce1c359a3..6f5127393 100644
--- a/desktop/lib/widgets/workspace_quick_start.dart
+++ b/desktop/lib/widgets/workspace_quick_start.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shortcuts/app_keymap.dart';
import '../state/workspace_learning.dart';
@@ -18,6 +19,7 @@ class WorkspaceQuickStart extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final next = learning.next;
final (command, label) = switch (next) {
WorkspaceLesson.agent => ('swarm.new', 'Open your first agent'),
@@ -47,11 +49,11 @@ class WorkspaceQuickStart extends StatelessWidget {
next == null
? 'quick start [done]'
: 'quick start ${next.index + 1}/4',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
Semantics(
liveRegion: true,
- child: Text(label, style: boxMonoStyle(size: 12)),
+ child: Text(label, style: boxMonoStyle()),
),
TextButton(
key: const ValueKey('quick-start-action'),
@@ -60,7 +62,7 @@ class WorkspaceQuickStart extends StatelessWidget {
next == null
? 'Keyboard practice'
: '${hint == null ? '' : '$hint '}${next == WorkspaceLesson.commands ? 'Search commands' : 'Try it'}',
- style: boxMonoStyle(size: 12),
+ style: boxMonoStyle(),
),
),
TextButton(
@@ -68,7 +70,7 @@ class WorkspaceQuickStart extends StatelessWidget {
onPressed: learning.pause,
child: Text(
next == null ? 'Done' : 'Pause guide',
- style: boxMonoStyle(size: 12, color: kBoxFaint),
+ style: boxMonoStyle(color: kBoxFaint),
),
),
],
diff --git a/desktop/lib/widgets/workspace_start_guide.dart b/desktop/lib/widgets/workspace_start_guide.dart
index 1696518ce..bd86bd0f6 100644
--- a/desktop/lib/widgets/workspace_start_guide.dart
+++ b/desktop/lib/widgets/workspace_start_guide.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:harness/terminal/terminal_text.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shortcuts/app_keymap.dart';
@@ -7,35 +8,6 @@ import '../shortcuts/keymap_commands.dart';
import 'box_chrome.dart';
import 'welcome_project_example.dart';
-/// The everyday New Tab page leaves the dock as the only action surface.
-class NewTabStartPage extends StatelessWidget {
- const NewTabStartPage({super.key});
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return ColoredBox(
- key: const ValueKey('new-tab-start-page'),
- color: grid.AppPalette.swarmWelcome,
- child: Center(
- child: Padding(
- padding: const EdgeInsets.all(32),
- child: Text(
- 'Follow your curiosity.',
- key: const ValueKey('new-tab-tagline'),
- textAlign: TextAlign.center,
- style: boxMonoStyle(
- size: 24,
- color: const Color(0xffd3d0ca),
- weight: FontWeight.w600,
- ),
- ),
- ),
- ),
- );
- }
-}
-
/// A quiet, live keyboard map for an empty workspace. The drawing illustrates
/// tabs and panes. Only the full shortcuts link is interactive.
class WorkspaceStartGuide extends StatelessWidget {
@@ -65,7 +37,7 @@ class WorkspaceStartGuide extends StatelessWidget {
color: grid.AppPalette.swarmWelcome,
child: LayoutBuilder(
builder: (context, constraints) {
- final scale = MediaQuery.textScalerOf(context).scale(13) / 13;
+ final scale = terminalTextScaleOf(context);
final compact = constraints.maxWidth < 680 * scale;
final short = constraints.maxHeight < 420 * scale;
Widget callout(String command, String label, String explanation) =>
@@ -85,13 +57,10 @@ class WorkspaceStartGuide extends StatelessWidget {
TextSpan(text: label),
],
),
- style: boxMonoStyle(size: 13, color: ink),
+ style: boxMonoStyle(color: ink),
),
const SizedBox(height: 4),
- Text(
- explanation,
- style: boxMonoStyle(size: 12, color: faint),
- ),
+ Text(explanation, style: boxMonoStyle(color: faint)),
],
),
);
@@ -103,11 +72,7 @@ class WorkspaceStartGuide extends StatelessWidget {
child: Text(
'Follow your curiosity. Build across disciplines.',
textAlign: TextAlign.center,
- style: boxMonoStyle(
- size: 20,
- color: ink,
- weight: FontWeight.w600,
- ),
+ style: boxMonoStyle(color: ink, weight: FontWeight.w600),
),
),
Row(
@@ -158,33 +123,24 @@ class WorkspaceStartGuide extends StatelessWidget {
'robot arm',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(
- size: 12,
- color: faint,
- ),
+ style: boxMonoStyle(color: faint),
),
),
if (!compact) ...[
const SizedBox(width: 32),
Text(
'launch video',
- style: boxMonoStyle(
- size: 12,
- color: faint,
- ),
+ style: boxMonoStyle(color: faint),
),
],
const SizedBox(width: 20),
- Text(
- '+',
- style: boxMonoStyle(size: 14, color: faint),
- ),
+ Text('+', style: boxMonoStyle(color: faint)),
],
),
),
Text(
compact ? 'Store' : 'Harness Store',
- style: boxMonoStyle(size: 12, color: faint),
+ style: boxMonoStyle(color: faint),
),
],
),
@@ -269,7 +225,7 @@ class WorkspaceStartGuide extends StatelessWidget {
child: Text(
'${_hint(context, 'keyboard.help')} All Keyboard Shortcuts'
.trimLeft(),
- style: boxMonoStyle(size: 11, color: faint),
+ style: boxMonoStyle(color: faint),
),
),
),
@@ -295,10 +251,8 @@ class WorkspaceStartGuide extends StatelessWidget {
vertical: 12,
),
child: Center(
- // The dock owns its actual height. Scale the entire original
- // diagram together, including the tagline and all its arrows.
- child: FittedBox(
- fit: BoxFit.scaleDown,
+ // Scroll the reference without shrinking its text.
+ child: SingleChildScrollView(
child: SizedBox(
key: const ValueKey('workspace-welcome-diagram'),
width: (constraints.maxWidth - horizontalPadding * 2).clamp(
@@ -332,6 +286,7 @@ class _DrawnPane extends StatelessWidget {
final bool showLocation;
@override
Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
final copy = Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -340,7 +295,7 @@ class _DrawnPane extends StatelessWidget {
name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 14, color: ink),
+ style: boxMonoStyle(color: ink),
),
if (showLocation) ...[
const SizedBox(height: 6),
@@ -348,7 +303,7 @@ class _DrawnPane extends StatelessWidget {
'This Mac:~/work/robot-arm',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 11, color: faint),
+ style: boxMonoStyle(color: faint),
),
],
const SizedBox(height: 10),
@@ -364,7 +319,7 @@ class _DrawnPane extends StatelessWidget {
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
- style: boxMonoStyle(size: 12, color: ink),
+ style: boxMonoStyle(color: ink),
),
],
);
diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dart
new file mode 100644
index 000000000..6d9d6456d
--- /dev/null
+++ b/desktop/lib/widgets/workspace_welcome.dart
@@ -0,0 +1,161 @@
+import 'package:flutter/material.dart';
+
+import '../core/app_version.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import '../shortcuts/app_keymap.dart';
+import '../shortcuts/keymap.dart';
+import '../shortcuts/keymap_commands.dart';
+import '../terminal/terminal_text.dart';
+import 'box_chrome.dart';
+
+/// A quiet terminal welcome. Opening a command is always an explicit action.
+class WorkspaceWelcome extends StatefulWidget {
+ const WorkspaceWelcome({super.key, required this.onCommand});
+
+ final ValueChanged<String> onCommand;
+
+ @override
+ State<WorkspaceWelcome> createState() => _WorkspaceWelcomeState();
+}
+
+class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {
+ late final _version = runningAppVersion().catchError((_) => 'development');
+
+ static const _actions = [
+ ('agent.new', 'New Harness', 'to start a new harness'),
+ ('agent.open', 'Open Harness', 'to open a harness'),
+ ('swarm.new', 'New Tab', 'to open a new tab'),
+ ('app.store', 'Harness Store', 'to explore the store'),
+ ];
+
+ @override
+ Widget build(BuildContext context) {
+ TerminalFontScope.watch(context);
+ return ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => _buildWelcome(context),
+ );
+ }
+
+ Widget _buildWelcome(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final palette = grid.AppTheme.palette.value;
+ final ink = palette.foreground.withValues(alpha: .75);
+ final accent = Theme.of(context).brightness == Brightness.dark
+ ? const Color(0xffa5d786)
+ : const Color(0xff356522);
+ final style = boxMonoStyle(
+ color: ink,
+ weight: FontWeight.w400,
+ ).copyWith(height: 1.5);
+ final keymap = KeymapTheme.of(context)?.current ?? harnessDefaultKeymap;
+ final rows = [
+ for (final (command, label, description) in _actions)
+ (
+ command: command,
+ label: label,
+ description: description,
+ hint: keymap
+ .bindingsFor(KeymapContext.workspace)
+ .where((binding) => binding.command == command)
+ .map(describeKeyBinding)
+ .firstOrNull,
+ ),
+ ];
+ double widthOf(String text) {
+ final painter = TextPainter(
+ text: TextSpan(text: text, style: style),
+ textDirection: TextDirection.ltr,
+ textScaler: MediaQuery.textScalerOf(context),
+ )..layout();
+ final width = painter.width;
+ painter.dispose();
+ return width;
+ }
+
+ final prefixWidth = widthOf('press ');
+ final keyWidth = rows
+ .map((row) => widthOf('${row.hint ?? row.label} '))
+ .reduce((a, b) => a > b ? a : b);
+ final descriptionWidth = widthOf('to start a new harness');
+ final line = MediaQuery.textScalerOf(context).scale(style.fontSize!) * 1.5;
+ return Material(
+ key: const ValueKey('workspace-welcome'),
+ color: grid.AppPalette.swarmWelcome,
+ child: LayoutBuilder(
+ builder: (context, constraints) => SingleChildScrollView(
+ padding: const EdgeInsets.all(24),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: (constraints.maxHeight - 48).clamp(0, double.infinity),
+ ),
+ child: Center(
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: prefixWidth + keyWidth + descriptionWidth,
+ ),
+ child: DefaultTextStyle(
+ style: style,
+ textAlign: TextAlign.center,
+ child: Column(
+ key: const ValueKey('workspace-welcome-text'),
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Text('HARNESS'),
+ SizedBox(height: line),
+ FutureBuilder<String>(
+ future: _version,
+ builder: (context, snapshot) =>
+ Text('version ${snapshot.data ?? '…'}'),
+ ),
+ const Text('Open source software and hardware'),
+ SizedBox(height: line * 2),
+ for (final row in rows)
+ TextButton(
+ key: ValueKey('welcome-${row.command}'),
+ onPressed: () => widget.onCommand(row.command),
+ style: TextButton.styleFrom(
+ foregroundColor: ink,
+ textStyle: style,
+ padding: const EdgeInsets.symmetric(vertical: 2),
+ minimumSize: Size.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ shape: const RoundedRectangleBorder(),
+ ),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: prefixWidth,
+ child: Text(
+ row.hint == null ? 'click' : 'press',
+ ),
+ ),
+ SizedBox(
+ width: keyWidth,
+ child: Text(
+ row.hint ?? row.label,
+ style: TextStyle(color: accent),
+ textAlign: TextAlign.left,
+ ),
+ ),
+ Expanded(
+ child: Text(
+ row.description,
+ textAlign: TextAlign.left,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 58eebf29e..67cd383ec 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -2,6 +2,41 @@ import Cocoa
import FlutterMacOS
import ImageIO
+/// The native chrome uses the same typography payload as Flutter's terminal.
+enum HarnessTypography {
+ private static var families = [".AppleSystemUIFontMonospaced"]
+ private(set) static var size: CGFloat = 13
+
+ @discardableResult
+ static func update(_ state: [String: Any]) -> Bool {
+ let previousFamilies = families
+ let previousSize = size
+ if let family = state["fontFamily"] as? String {
+ families = [family] + (state["fontFallbacks"] as? [String] ?? [])
+ }
+ if let value = state["fontSize"] as? NSNumber, value.doubleValue.isFinite, value.doubleValue >= 9, value.doubleValue <= 22 {
+ size = CGFloat(value.doubleValue)
+ }
+ return families != previousFamilies || size != previousSize
+ }
+
+ static func apply(to menu: NSMenu) {
+ menu.font = font()
+ for item in menu.items {
+ if let submenu = item.submenu { apply(to: submenu) }
+ }
+ }
+
+ static func font(weight: NSFont.Weight = .regular) -> NSFont {
+ let base = families.first == ".AppleSystemUIFontMonospaced"
+ ? NSFont.monospacedSystemFont(ofSize: size, weight: weight)
+ : families.compactMap { NSFont(name: $0, size: size) }.first
+ ?? NSFont.monospacedSystemFont(ofSize: size, weight: weight)
+ return weight == .bold || weight == .semibold
+ ? NSFontManager.shared.convert(base, toHaveTrait: .boldFontMask) : base
+ }
+}
+
/// Real AppKit controls in the title bar, beside the system traffic lights.
/// https://developer.apple.com/documentation/appkit/nstitlebaraccessoryviewcontroller/layoutattribute
final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
@@ -42,7 +77,10 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
switch call.method {
case "configure":
let state = call.arguments as? [String: Any] ?? [:]
+ HarnessTypography.update(state)
self.configure(palette: state["palette"] as? [String: Any])
+ self.strip.updateTypography()
+ if let main = NSApp.mainMenu { HarnessTypography.apply(to: main) }
result(true)
case "update":
let state = call.arguments as? [String: Any] ?? [:]
@@ -52,6 +90,13 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
self.canClosePane = state["canClosePane"] as? Bool == true
self.canGoBack = state["canGoBack"] as? Bool == true
self.canGoForward = state["canGoForward"] as? Bool == true
+ let fontChanged = HarnessTypography.update(state)
+ if fontChanged {
+ self.rebuildHistoryMenu()
+ self.rebuildModelsMenu()
+ self.rebuildMachinesMenu()
+ if let main = NSApp.mainMenu { HarnessTypography.apply(to: main) }
+ }
self.updateHistory(state["history"] as? [[String: Any]] ?? [], closed: state["closedHistory"] as? [[String: Any]] ?? [])
self.strip.update(state)
self.window?.backgroundColor = self.strip.palette.tabBar
@@ -255,6 +300,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
if let file = main.item(withTitle: "File") { main.removeItem(file) }
let file = NSMenu(title: "File")
+ file.font = HarnessTypography.font()
add(file, "New Tab", "t", "new")
add(file, "New Pane…", "p", "addAgent")
// ⌘⇧T, as in a terminal app. It used to be Reopen Last Closed (History menu), which keeps its
@@ -292,9 +338,11 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
rebuildMachinesMenu()
install(machinesMenu, at: main.items.firstIndex(where: { $0.title == "Window" }) ?? main.numberOfItems)
installTerminalFindMenu(main)
+ HarnessTypography.apply(to: main)
}
func menuWillOpen(_ menu: NSMenu) {
+ menu.font = HarnessTypography.font()
syncMenuKeys()
if menu === historyMenu {
for item in menu.items {
@@ -321,6 +369,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
private func rebuildMachinesMenu() {
+ machinesMenu.font = HarnessTypography.font()
machinesMenu.removeAllItems()
machinesMenu.minimumWidth = 0
let labels = machines.map { machine -> (name: String, owner: String, presence: String, status: String, count: String) in
@@ -369,7 +418,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
let paragraph = NSMutableParagraphStyle()
paragraph.tabStops = [NSTextTab(textAlignment: .right, location: trailingEdge)]
let label = NSMutableAttributedString(string: parts.name,
- attributes: [.font: NSFont.menuFont(ofSize: 0), .paragraphStyle: paragraph])
+ attributes: [.font: HarnessTypography.font(), .paragraphStyle: paragraph])
// After the name: the node presence ("Online"). Trailing (tab-aligned
// right): the agent count, or the link/offline status when there is no
// count. The two are independent slots, so a machine can read
@@ -377,11 +426,12 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
let afterName = parts.owner + (parts.presence.isEmpty ? "" : " " + parts.presence)
let trailing = parts.count.isEmpty ? parts.status : parts.count
label.append(NSAttributedString(string: afterName + "\t" + trailing,
- attributes: [.font: NSFont.menuFont(ofSize: 0), .paragraphStyle: paragraph,
+ attributes: [.font: HarnessTypography.font(), .paragraphStyle: paragraph,
.foregroundColor: NSColor.secondaryLabelColor]))
item.attributedTitle = label
item.image = NSImage(systemSymbolName: machine.shared ? "person.2" : machine.local ? "laptopcomputer" : "desktopcomputer", accessibilityDescription: machine.shared ? "Shared machine" : nil)
let submenu = NSMenu(title: machine.name)
+ submenu.font = HarnessTypography.font()
for agent in machine.agents {
let child = NSMenuItem(title: agent.title + (machine.shared ? " · View only" : ""), action: #selector(machineAgentAction(_:)), keyEquivalent: "")
child.target = self
@@ -502,6 +552,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
private var localSections: [MenuGridSection] = []
private func rebuildModelsMenu() {
+ modelsMenu.font = HarnessTypography.font()
modelsMenu.removeAllItems()
func label(_ title: String, in menu: NSMenu) {
let item = NSMenuItem(title: title, action: nil, keyEquivalent: "")
@@ -590,6 +641,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
run.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + "runLocalModel")
if machines.filter({ !$0.shared }).count > 1 {
let pick = NSMenu(title: run.title)
+ pick.font = HarnessTypography.font()
for machine in machines where !machine.shared {
let item = NSMenuItem(title: machine.local ? "\(machine.name) (this computer)" : machine.name,
action: #selector(runLocalModelAction(_:)), keyEquivalent: "")
@@ -619,6 +671,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
private func rebuildHistoryMenu() {
+ historyMenu.font = HarnessTypography.font()
historyMenu.removeAllItems()
historyMenu.minimumWidth = 0
let visited = Array(history.prefix(15))
@@ -694,6 +747,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
guard let edit = main.items.first(where: { $0.title == "Edit" })?.submenu,
let find = edit.items.first(where: { $0.title == "Find" }) else { return }
let menu = NSMenu(title: "Find")
+ menu.font = HarnessTypography.font()
for (title, key, action, modifiers) in [
("Find in Terminal…", "f", "findTerminal", NSEvent.ModifierFlags.command),
("Find Next", "g", "findNext", NSEvent.ModifierFlags.command),
@@ -855,12 +909,12 @@ private struct SwarmSubscriptionEntry: Equatable {
/// follows starts something instead. Without it the action read as one more model, which is the
/// mistake the in-app menu made before it grew this block.
private final class SwarmMenuCaptionView: NSView {
- private static let font = NSFont.menuFont(ofSize: NSFont.smallSystemFontSize - 1)
+ private static var font: NSFont { HarnessTypography.font() }
private let caption: NSTextField
init(text: String, width: CGFloat) {
caption = NSTextField(labelWithString: text)
- super.init(frame: NSRect(x: 0, y: 0, width: width, height: 24))
+ super.init(frame: NSRect(x: 0, y: 0, width: width, height: max(24, ceil(HarnessTypography.size * 1.35) + 6)))
autoresizingMask = [.width]
caption.font = Self.font
caption.textColor = .secondaryLabelColor
@@ -904,12 +958,12 @@ private final class SwarmMenuCaptionView: NSView {
/// both are done here: the fill follows `isHighlighted`, and the mouse dispatches the item's own
/// target/action the way the menu would have.
private final class SwarmMenuButtonView: NSView {
- private static let font = NSFont.menuFont(ofSize: 0)
+ private static var font: NSFont { HarnessTypography.font() }
private let label: NSTextField
init(title: String, width: CGFloat) {
label = NSTextField(labelWithString: title)
- super.init(frame: NSRect(x: 0, y: 0, width: width, height: 34))
+ super.init(frame: NSRect(x: 0, y: 0, width: width, height: max(34, ceil(HarnessTypography.size * 1.35) + 12)))
autoresizingMask = [.width]
label.font = Self.font
label.textColor = .labelColor
@@ -970,7 +1024,7 @@ private final class SwarmMenuButtonView: NSView {
/// Read-only account information, with aligned trailing balances. There is no
/// action or submenu to suggest another step just to read the remaining usage.
private final class SwarmSubscriptionView: NSView {
- private static let rowFont = NSFont.menuFont(ofSize: 0)
+ private static var rowFont: NSFont { HarnessTypography.font() }
let identity = NSTextField(labelWithString: "")
let balance = NSTextField(labelWithString: "")
private let icon = NSImageView()
@@ -1002,7 +1056,7 @@ private final class SwarmSubscriptionView: NSView {
/// which AppKit greys wholesale, so a served model looked unavailable beside the accounts above.
init(title primary: String, account: String, status: String, icon: NSImage?, width: CGFloat,
accessibility: String, tint: NSColor? = nil) {
- super.init(frame: NSRect(x: 0, y: 0, width: width, height: 26))
+ super.init(frame: NSRect(x: 0, y: 0, width: width, height: max(26, ceil(HarnessTypography.size * 1.35) + 8)))
autoresizingMask = [.width]
self.icon.image = icon
self.icon.imageScaling = .scaleProportionallyDown
@@ -1056,13 +1110,15 @@ private final class SwarmHistoryMenuRow: NSView {
var highlighted = false { didSet { needsDisplay = true } }
var machineFrame: NSRect {
let width = ceil(SwarmMenuText.width(entry.menuMachine))
- return NSRect(x: bounds.width - 18 - width, y: 4, width: width, height: 18)
+ let font = HarnessTypography.font()
+ let height = ceil(font.ascender - font.descender + font.leading)
+ return NSRect(x: bounds.width - 18 - width, y: (bounds.height - height) / 2, width: width, height: height)
}
init(item: NSMenuItem, entry: SwarmHistoryEntry, width: CGFloat) {
self.item = item
self.entry = entry
- super.init(frame: NSRect(x: 0, y: 0, width: width, height: 24))
+ super.init(frame: NSRect(x: 0, y: 0, width: width, height: max(24, ceil(HarnessTypography.size * 1.35) + 6)))
autoresizingMask = [.width]
setAccessibilityElement(true)
setAccessibilityRole(.menuItem)
@@ -1084,7 +1140,7 @@ private final class SwarmHistoryMenuRow: NSView {
}
let color = !item.isEnabled ? NSColor.disabledControlTextColor
: selected ? .selectedMenuItemTextColor : .labelColor
- let attributes: [NSAttributedString.Key: Any] = [.font: NSFont.menuFont(ofSize: 0), .foregroundColor: color]
+ let attributes: [NSAttributedString.Key: Any] = [.font: HarnessTypography.font(), .foregroundColor: color]
if item.state == .on {
let mark = NSImage(systemSymbolName: "checkmark", accessibilityDescription: nil)!
let tinted = mark.copy() as! NSImage
@@ -1107,7 +1163,7 @@ private final class SwarmHistoryMenuRow: NSView {
}
let right = entry.menuMachine.isEmpty ? bounds.width - 18 : machineFrame.minX - 20
let name = SwarmMenuText.fitted(entry.title, width: max(0, right - 48))
- (name as NSString).draw(at: NSPoint(x: 48, y: 4), withAttributes: attributes)
+ (name as NSString).draw(at: NSPoint(x: 48, y: machineFrame.minY), withAttributes: attributes)
(entry.menuMachine as NSString).draw(at: machineFrame.origin, withAttributes: attributes)
}
override func mouseUp(with event: NSEvent) {
@@ -1128,7 +1184,7 @@ private final class SwarmHistoryMenuRow: NSView {
/// Keep native menu columns aligned without reserving a fixed, empty span.
private enum SwarmMenuText {
static func width(_ text: String) -> CGFloat {
- (text as NSString).size(withAttributes: [.font: NSFont.menuFont(ofSize: 0)]).width
+ (text as NSString).size(withAttributes: [.font: HarnessTypography.font()]).width
}
static func fitted(_ text: String, width limit: CGFloat) -> String {
@@ -1160,11 +1216,11 @@ private struct SwarmHistoryEntry: Equatable {
let engine: String?
let iconAsset: String?
let canReopen: Bool
- var menuName: String { SwarmMenuText.fitted(title, width: machineName.isEmpty ? 330 : 250) }
- var menuMachine: String { SwarmMenuText.fitted(machineName, width: 110) }
+ var menuName: String { SwarmMenuText.fitted(title, width: (machineName.isEmpty ? 330 : 250) * HarnessTypography.size / 13) }
+ var menuMachine: String { SwarmMenuText.fitted(machineName, width: 140 * HarnessTypography.size / 13) }
func menuTitle(trailingEdge: CGFloat? = nil) -> NSAttributedString {
- let font = NSFont.menuFont(ofSize: 0)
+ let font = HarnessTypography.font()
let name = menuName
let machine = menuMachine
let paragraph = NSMutableParagraphStyle()
@@ -1270,6 +1326,7 @@ private final class SwarmHistoryIcons {
let name = id.split(separator: "/").last.map(String.init) ?? id
let initial = String(name.first ?? "A").uppercased() as NSString
let attributes: [NSAttributedString.Key: Any] = [
+ // Raster artwork for a fixed 16px fallback icon, not a UI text label.
.font: NSFont.monospacedSystemFont(ofSize: 11, weight: .bold),
.foregroundColor: NSColor.black,
]
@@ -1361,7 +1418,7 @@ private final class SwarmStoreButton: SwarmIconButton {
var palette = SwarmNativePalette() { didSet { needsDisplay = true } }
var preferredWidth: CGFloat {
ceil((title as NSString).size(withAttributes: [
- .font: font ?? NSFont.monospacedSystemFont(ofSize: 12, weight: .medium),
+ .font: font ?? HarnessTypography.font(weight: .medium),
]).width) + 48
}
@@ -1380,7 +1437,7 @@ private final class SwarmStoreButton: SwarmIconButton {
from: .zero, operation: .sourceOver, fraction: isEnabled ? 1 : 0.45,
respectFlipped: true, hints: [.interpolation: NSImageInterpolation.high])
let attributes: [NSAttributedString.Key: Any] = [
- .font: font ?? NSFont.monospacedSystemFont(ofSize: 12, weight: .medium),
+ .font: font ?? HarnessTypography.font(weight: .medium),
.foregroundColor: palette.accent.withAlphaComponent(isEnabled ? 1 : 0.45),
]
let text = title as NSString
@@ -1477,7 +1534,7 @@ private final class SwarmTabStrip: NSView {
storeButton.isBordered = false
storeButton.palette = palette
storeButton.image = icons.image(engine: "store", asset: "assets/store/polymath.png")
- storeButton.font = NSFont.monospacedSystemFont(ofSize: 12, weight: .medium)
+ storeButton.font = HarnessTypography.font(weight: .medium)
storeButton.target = self
storeButton.action = #selector(openStore)
storeButton.isEnabled = false
@@ -1518,16 +1575,21 @@ private final class SwarmTabStrip: NSView {
}
}
+ func updateTypography() {
+ storeButton.font = HarnessTypography.font(weight: .medium)
+ for tab in tabs {
+ tab.labelFont = HarnessTypography.font()
+ if let menu = tab.menu { HarnessTypography.apply(to: menu) }
+ }
+ needsLayout = true
+ }
+
func update(_ state: [String: Any]) {
// Workspace teardown clears its controls without changing appearance.
if let palette = state["palette"] as? [String: Any] { updatePalette(palette) }
actionsEnabled = state["enabled"] as? Bool == true
- let families = [state["fontFamily"] as? String].compactMap { $0 }
- + (state["fontFallbacks"] as? [String] ?? [])
- storeButton.font = families.first == ".AppleSystemUIFontMonospaced"
- ? NSFont.monospacedSystemFont(ofSize: 12, weight: .medium)
- : families.compactMap { NSFont(name: $0, size: 12) }.first
- ?? NSFont.monospacedSystemFont(ofSize: 12, weight: .medium)
+ HarnessTypography.update(state)
+ storeButton.font = HarnessTypography.font(weight: .medium)
let rows = state["tabs"] as? [[String: Any]] ?? []
let nextActiveId = state["activeId"] as? String ?? ""
revealActiveAfterLayout = revealActiveAfterLayout || nextActiveId != activeId
@@ -1541,12 +1603,8 @@ private final class SwarmTabStrip: NSView {
guard let id = row["id"] as? String else { return nil }
let tab = previous[id] ?? SwarmTabButton(id: id)
tab.palette = palette
- let families = [state["fontFamily"] as? String].compactMap { $0 }
- + (state["fontFallbacks"] as? [String] ?? [])
- tab.labelFont = families.first == ".AppleSystemUIFontMonospaced"
- ? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
- : families.compactMap { NSFont(name: $0, size: 13) }.first
- ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
+ tab.labelFont = HarnessTypography.font()
+ tab.menu?.font = HarnessTypography.font()
tab.name = row["name"] as? String ?? "New Tab"
let count = row["agentCount"] as? Int ?? 0
// The Harness Store tab holds no agents; without its own mark it would wear New Tab's plus.
@@ -1714,8 +1772,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
get { iconView.image }
set { iconView.image = newValue }
}
- // 14.3: a tenth up from the 13 the rest of the chrome uses (owner, 2026-09-21).
- var labelFont = NSFont.monospacedSystemFont(ofSize: 14.3, weight: .regular) {
+ var labelFont = HarnessTypography.font() {
didSet { if oldValue != labelFont { invalidateLabel() } }
}
private var cachedLabel: NSAttributedString?
@@ -1755,6 +1812,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
closeButton.action = #selector(closeSwarm)
addSubview(closeButton)
let menu = NSMenu()
+ menu.font = HarnessTypography.font()
for (title, action) in [("Rename Tab…", #selector(renameSwarm)), ("Close Tab", #selector(closeSwarm))] {
let item = NSMenuItem(title: title, action: action, keyEquivalent: "")
item.target = self
@@ -1858,8 +1916,11 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
if !compact {
let label = self.label
let labelHeight = label.size().height
+ let trailing = shortcut.map { value in
+ max(42, ceil(("⌘\(value)" as NSString).size(withAttributes: [.font: labelFont]).width) + 22)
+ } ?? 42
label.draw(in: NSRect(x: 46, y: contentCenterY - labelHeight / 2,
- width: bounds.width - 88, height: labelHeight))
+ width: max(0, bounds.width - 46 - trailing), height: labelHeight))
}
if attention {
NSColor.systemOrange.setFill()
@@ -1872,10 +1933,11 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .right
let badge = NSAttributedString(string: "⌘\(shortcut)",
- attributes: [.font: NSFont.monospacedDigitSystemFont(ofSize: 11, weight: .medium),
+ attributes: [.font: labelFont,
.foregroundColor: NSColor(white: 1, alpha: selected ? 0.7 : 0.5), .paragraphStyle: paragraph])
let badgeHeight = badge.size().height
- badge.draw(in: NSRect(x: bounds.width - 46, y: contentCenterY - badgeHeight / 2, width: 32, height: badgeHeight))
+ let badgeWidth = max(32, ceil(badge.size().width))
+ badge.draw(in: NSRect(x: bounds.width - 14 - badgeWidth, y: contentCenterY - badgeHeight / 2, width: badgeWidth, height: badgeHeight))
}
}
// Overflowed tabs might not be drawn. Their names and selection still need
diff --git a/desktop/test/advanced_agent_keyboard_test.dart b/desktop/test/advanced_agent_keyboard_test.dart
index a3dd73a1a..b086ba774 100644
--- a/desktop/test/advanced_agent_keyboard_test.dart
+++ b/desktop/test/advanced_agent_keyboard_test.dart
@@ -216,6 +216,7 @@ void main() {
app.adoptSessionForTest(terminal('a0', []));
await mount(tester, app);
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await key(tester, LogicalKeyboardKey.enter);
await key(tester, LogicalKeyboardKey.period, cmd: true);
await tester.pumpAndSettle();
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 75fdf5186..bbeecfe80 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -110,6 +110,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
case 'new tab':
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
case 'search shortcut':
await chord(tester, LogicalKeyboardKey.keyP);
@@ -133,6 +134,11 @@ void main() {
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
+ if (entry == 'new tab') {
+ expect(app.swarms, hasLength(2));
+ expect(app.panes, isEmpty);
+ await chord(tester, LogicalKeyboardKey.keyW);
+ }
expect(app.focusedPane, same(pane));
expect(app.activeSwarmId, original);
expect(app.swarms, hasLength(1));
diff --git a/desktop/test/app_select_field_test.dart b/desktop/test/app_select_field_test.dart
index 2c0c90b68..e272b3b2c 100644
--- a/desktop/test/app_select_field_test.dart
+++ b/desktop/test/app_select_field_test.dart
@@ -239,7 +239,7 @@ void main() {
find.descendant(of: row, matching: find.text('System')),
);
expect(note.style?.color, isNot(label.style?.color));
- expect(note.style!.fontSize!, lessThan(label.style!.fontSize!));
+ expect(note.style!.fontSize!, equals(label.style!.fontSize!));
});
testWidgets('a row mark gets its own slot, so labels never shift', (
@@ -335,8 +335,7 @@ void main() {
testWidgets('the picker uses the roomy row, a context menu keeps compact', (
tester,
) async {
- // Two sizes exist on purpose (see AppMenuRowMetrics). This is the line
- // between them: a picker's list is read down, a ⋯ menu is glanced at.
+ // Both variants use the terminal font; only spacing and icon size differ.
await tester.pumpWidget(
_host(
Column(
@@ -369,7 +368,7 @@ void main() {
expect(pickerRow.metrics, AppMenuRowMetrics.roomy);
expect(
AppMenuRowMetrics.roomy.fontSize,
- greaterThan(AppMenuRowMetrics.compact.fontSize),
+ equals(AppMenuRowMetrics.compact.fontSize),
);
expect(
AppMenuRowMetrics.roomy.iconSize,
diff --git a/desktop/test/appearance_prefs_store_test.dart b/desktop/test/appearance_prefs_store_test.dart
index ed9012869..0b0403f7b 100644
--- a/desktop/test/appearance_prefs_store_test.dart
+++ b/desktop/test/appearance_prefs_store_test.dart
@@ -1,7 +1,5 @@
-import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/local_key_value_store.dart';
-import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/appearance_prefs_store.dart';
/// An in-memory store that can be told to fail, so the recovery paths are
@@ -36,9 +34,7 @@ void main() {
const prefs = AppearancePrefs();
expect(prefs.uiFamily, isNull);
expect(prefs.uiSize, 14);
- // The whole point of the default: scale is exactly 1, so every control
- // keeps the geometry the design system specifies.
- expect(prefs.uiSize / grid.AppFont.uiSizeDefault, 1.0);
+ // Legacy fields remain readable, but no longer control app typography.
});
test('an empty store loads the defaults', () async {
@@ -143,39 +139,4 @@ void main() {
expect(chosen.copyWith(uiFamily: null).uiFamily, 'Menlo');
});
});
-
- group('the size reaches the theme', () {
- tearDown(grid.AppFont.reset);
-
- test('a chosen size resizes every control box in the app', () {
- double controlHeight() => grid
- .buildAppTheme(brightness: Brightness.dark)
- .inputDecorationTheme
- .constraints!
- .minHeight;
-
- expect(controlHeight(), 36);
-
- grid.AppTheme.fonts.apply(
- uiScale: 19 / grid.AppFont.uiSizeDefault,
- codeSize: grid.AppFont.codeSize,
- );
- // Proof the wiring in `main.dart` has something to act on: `buildAppTheme`
- // bakes `AppControl.heightFieldScaled` into a plain number, so this is
- // what a UI-size change actually moves.
- expect(controlHeight(), closeTo(36 * 19 / 14, 0.001));
- });
-
- test('apply reports whether anything actually moved', () {
- expect(
- grid.AppFont.apply(uiScale: 1.2, codeSize: grid.AppFont.codeSize),
- isTrue,
- );
- expect(
- grid.AppFont.apply(uiScale: 1.2, codeSize: grid.AppFont.codeSize),
- isFalse,
- reason: 'setting the same value twice must not dirty the tree',
- );
- });
- });
}
diff --git a/desktop/test/benchmarks/swarm_benchmark.dart b/desktop/test/benchmarks/swarm_benchmark.dart
index 04ba7ad73..42ca44121 100644
--- a/desktop/test/benchmarks/swarm_benchmark.dart
+++ b/desktop/test/benchmarks/swarm_benchmark.dart
@@ -119,7 +119,7 @@ void main() {
final reopen = await timed(
() async {
- await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.pump();
expect(field, findsOneWidget);
},
@@ -147,14 +147,14 @@ void main() {
final retarget = await timed(() async {
await key(tester, LogicalKeyboardKey.keyP, cmd: true);
await tester.pump();
- await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.pump();
});
expect(tester.widget<TextField>(field).controller!.text, 'harness');
expect(usedTransport, isFalse);
expect(tester.takeException(), isNull);
debugPrint(
- 'SWARM_BENCH ${jsonEncode({'kind': 'headless_debug_widget_elapsed', 'operation': 'command_dock', 'agents': agentCount, 'reopen': reopen, 'broadQuery': query, 'queryGrowth': queryGrowth, 'narrowQuery': narrow, 'arrow': move, 'cmdPThenCmdT': retarget})}',
+ 'SWARM_BENCH ${jsonEncode({'kind': 'headless_debug_widget_elapsed', 'operation': 'command_dock', 'agents': agentCount, 'reopen': reopen, 'broadQuery': query, 'queryGrowth': queryGrowth, 'narrowQuery': narrow, 'arrow': move, 'cmdPThenCmdO': retarget})}',
);
if (profile != null) {
await tester.runAsync(
diff --git a/desktop/test/box_flows_test.dart b/desktop/test/box_flows_test.dart
index 6e8c7a5b7..c3df064b4 100644
--- a/desktop/test/box_flows_test.dart
+++ b/desktop/test/box_flows_test.dart
@@ -209,6 +209,7 @@ void main() {
addTearDown(app.dispose);
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
final start = find.byKey(const ValueKey('swarm-search-input'));
await tester.tap(start);
await tester.pump();
@@ -417,6 +418,7 @@ void main() {
// Explicit text in search starts the requested task using the source's
// defaults, without touching another context's draft.
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Implement a new redirect',
@@ -428,6 +430,7 @@ void main() {
expect(creation.machineId, 'm');
expect(creation.project.folder, sourceAgent.project!.cwd);
await cancel();
+ await chord(tester, LogicalKeyboardKey.keyW);
app.focusPane(other.id);
expect((await resume()).task, 'Update feature documentation');
await cancel();
diff --git a/desktop/test/box_polish_test.dart b/desktop/test/box_polish_test.dart
index 725e000d6..284886891 100644
--- a/desktop/test/box_polish_test.dart
+++ b/desktop/test/box_polish_test.dart
@@ -80,7 +80,7 @@ void main() {
await tester.enterText(input, 'Agent 1');
await tester.pump();
aligned(search);
- expect(tester.getRect(input).bottom, y);
+ expect(tester.getRect(input).bottom, closeTo(y, .001));
await key(tester, LogicalKeyboardKey.slash, ctrl: true);
aligned(search);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
diff --git a/desktop/test/box_render_preview_test.dart b/desktop/test/box_render_preview_test.dart
index 0fe193fcb..8d548b39c 100644
--- a/desktop/test/box_render_preview_test.dart
+++ b/desktop/test/box_render_preview_test.dart
@@ -212,6 +212,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
await shot('02-new-pane-typed');
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await shot('03-new-tab-empty');
await type(search, 'Agent 12');
await shot('04-new-tab-typed');
@@ -404,6 +405,7 @@ void main() {
tester.platformDispatcher.textScaleFactorTestValue = 1.7;
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
final largeBox = tester
@@ -530,6 +532,7 @@ void main() {
pendingApp.adoptSessionForTest(terminal('a0', []));
await mount(tester, pendingApp);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
diff --git a/desktop/test/command_dock_interaction_test.dart b/desktop/test/command_dock_interaction_test.dart
index e01f2df3f..44e9df2eb 100644
--- a/desktop/test/command_dock_interaction_test.dart
+++ b/desktop/test/command_dock_interaction_test.dart
@@ -582,10 +582,16 @@ void main() {
await key(tester, LogicalKeyboardKey.slash, ctrl: true);
expect(preview, findsNothing);
expect(search.selected, same(best));
- expect(tester.getRect(input), queryBounds);
+ expect(
+ tester.getRect(input),
+ rectMoreOrLessEquals(queryBounds, epsilon: .001),
+ );
await key(tester, LogicalKeyboardKey.slash, ctrl: true);
expect(preview, findsOneWidget);
- expect(tester.getRect(input), queryBounds);
+ expect(
+ tester.getRect(input),
+ rectMoreOrLessEquals(queryBounds, epsilon: .001),
+ );
await key(tester, LogicalKeyboardKey.arrowUp);
expect(search.cursor, 2);
final selectedRow = find.byKey(ValueKey(search.selected!.id));
@@ -610,16 +616,25 @@ void main() {
expect(search.selected, same(best));
await key(tester, LogicalKeyboardKey.keyJ, ctrl: true);
expect(search.selected!.isCreate, isTrue);
- expect(tester.getRect(createRow), createBounds);
+ expect(
+ tester.getRect(createRow),
+ rectMoreOrLessEquals(createBounds, epsilon: .001),
+ );
await tester.drag(
find.byKey(const ValueKey('swarm-search-result-list')),
const Offset(0, 180),
);
await tester.pumpAndSettle();
- expect(tester.getRect(createRow), createBounds);
+ expect(
+ tester.getRect(createRow),
+ rectMoreOrLessEquals(createBounds, epsilon: .001),
+ );
await tester.enterText(input, '');
await tester.pump();
- expect(tester.getRect(createRow), createBounds);
+ expect(
+ tester.getRect(createRow),
+ rectMoreOrLessEquals(createBounds, epsilon: .001),
+ );
await key(tester, LogicalKeyboardKey.tab);
expect(
FocusManager.instance.primaryFocus?.context
diff --git a/desktop/test/desktop_window_test.dart b/desktop/test/desktop_window_test.dart
index c43e5c775..f7207ad37 100644
--- a/desktop/test/desktop_window_test.dart
+++ b/desktop/test/desktop_window_test.dart
@@ -1,3 +1,5 @@
+import 'package:harness/terminal/terminal_font_store.dart';
+
import 'dart:async';
import 'dart:io';
@@ -126,6 +128,9 @@ void main() {
expect(nativeCalls.single.method, 'configure');
expect(nativeCalls.single.arguments, {
'palette': HarnessPalette.graphite.nativeColors,
+ 'fontFamily': terminalFontStore.value.fontFamily,
+ 'fontSize': terminalFontStore.size,
+ 'fontFallbacks': terminalFontStore.value.fontFamilyFallback,
});
expect(calls.indexOf('native:configure'), lessThan(calls.indexOf('show')));
}, skip: !Platform.isMacOS);
@@ -139,7 +144,12 @@ void main() {
final setup = configureDesktopWindow(palette: palette);
await tester.pump();
await setup;
- expect(nativeCalls.single.arguments, {'palette': palette.nativeColors});
+ expect(nativeCalls.single.arguments, {
+ 'palette': palette.nativeColors,
+ 'fontFamily': terminalFontStore.value.fontFamily,
+ 'fontSize': terminalFontStore.size,
+ 'fontFallbacks': terminalFontStore.value.fontFamilyFallback,
+ });
expect(
calls.indexOf('native:configure'),
lessThan(calls.indexOf('show')),
diff --git a/desktop/test/harness_command_bar_test.dart b/desktop/test/harness_command_bar_test.dart
index e8a2598ee..60daeb9b5 100644
--- a/desktop/test/harness_command_bar_test.dart
+++ b/desktop/test/harness_command_bar_test.dart
@@ -363,8 +363,7 @@ void main() {
expect(app.activeSwarmId, isNot(previousTab));
expect(app.activeSwarm.isBlankNewTab, isTrue);
final picker = find.byKey(const ValueKey('swarm-search-input'));
- expect(picker, findsOneWidget);
- expect(tester.widget<TextField>(picker).focusNode!.hasFocus, isTrue);
+ expect(picker, findsNothing);
expect(input, findsNothing);
// The exact app command opens the tab even without a provider decision.
expect(calls, 1);
diff --git a/desktop/test/harness_customize_test.dart b/desktop/test/harness_customize_test.dart
index b829495fe..e347ac0a7 100644
--- a/desktop/test/harness_customize_test.dart
+++ b/desktop/test/harness_customize_test.dart
@@ -458,7 +458,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Color palette'), findsOneWidget);
expect(find.byKey(const ValueKey('palette-graphite')), findsOneWidget);
- expect(find.byKey(const Key('appearance-ui-size-field')), findsOneWidget);
+ expect(find.byKey(const Key('appearance-ui-size-field')), findsNothing);
expect(tester.takeException(), isNull);
await _capture(tester, boundary, '${width.toInt()}-appearance');
diff --git a/desktop/test/harness_picker_entry_test.dart b/desktop/test/harness_picker_entry_test.dart
index 6d9116780..92166e35a 100644
--- a/desktop/test/harness_picker_entry_test.dart
+++ b/desktop/test/harness_picker_entry_test.dart
@@ -118,7 +118,10 @@ void main() {
expect(app.focusedPane, same(pane));
await tester.enterText(field, 'idempotency');
await tester.pump();
- expect(tester.getRect(field), before);
+ expect(
+ tester.getRect(field),
+ rectMoreOrLessEquals(before, epsilon: .001),
+ );
expect(tester.widget<TextField>(field).controller, same(controller));
expect(
find.textContaining('Payment retries now reuse'),
diff --git a/desktop/test/harness_placement_test.dart b/desktop/test/harness_placement_test.dart
index 9ab51bdde..8efce3c86 100644
--- a/desktop/test/harness_placement_test.dart
+++ b/desktop/test/harness_placement_test.dart
@@ -178,6 +178,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
await chord(tester, LogicalKeyboardKey.period);
@@ -270,21 +271,20 @@ void main() {
// honoring the newly requested destination.
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
+ await chord(tester, LogicalKeyboardKey.keyW);
final inPane = dismiss == 'outside';
await chord(
tester,
inPane ? LogicalKeyboardKey.keyP : LogicalKeyboardKey.keyT,
);
+ if (!inPane) await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
box = tester
.widget<NewHarnessBox>(find.byType(NewHarnessBox))
.controller;
expect(box.profileLabel, profile);
- expect(
- box.placement,
- inPane ? HarnessPlacement.currentTab : HarnessPlacement.newTab,
- );
+ expect(box.placement, HarnessPlacement.currentTab);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
final request = connection.requests.single;
@@ -341,6 +341,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
final input = find.byKey(const ValueKey('new-harness-input'));
@@ -423,6 +424,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
final input = find.byKey(const ValueKey('new-harness-input'));
@@ -766,6 +768,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
final search = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(search, 'fix the login regression');
await tester.pump();
@@ -775,7 +778,7 @@ void main() {
.widget<NewHarnessBox>(find.byType(NewHarnessBox))
.controller;
expect(box.task, 'fix the login regression');
- expect(box.placement, HarnessPlacement.newTab);
+ expect(box.placement, HarnessPlacement.currentTab);
box.setFolder('/work/project');
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
@@ -860,6 +863,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
tester
@@ -921,7 +925,7 @@ void main() {
for (final placement in HarnessPlacement.values) {
testWidgets(
- '${placement.title} cancels without altering layout and carries inherited creation context',
+ '${placement.title} keeps its tab on Escape and carries inherited creation context',
(tester) async {
newHarnessOpensInBox = true;
addTearDown(() => newHarnessOpensInBox = false);
@@ -942,21 +946,31 @@ void main() {
? LogicalKeyboardKey.keyT
: LogicalKeyboardKey.keyP;
await chord(tester, key);
+ if (placement == HarnessPlacement.newTab) {
+ await chord(tester, LogicalKeyboardKey.keyO);
+ }
await tester.pump();
expect(app.swarms, contains(original));
expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);
expect(find.text(placement.title), findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
+ expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);
+ if (placement == HarnessPlacement.newTab) {
+ await chord(tester, LogicalKeyboardKey.keyW);
+ }
expect(app.swarms, [original]);
await chord(tester, key);
+ if (placement == HarnessPlacement.newTab) {
+ await chord(tester, LogicalKeyboardKey.keyO);
+ }
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
final box = tester
.widget<NewHarnessBox>(find.byType(NewHarnessBox))
.controller;
- expect(box.placement, placement);
+ expect(box.placement, HarnessPlacement.currentTab);
expect(box.engine, 'codex');
expect(box.machineId, 'm');
expect(box.project.folder, '/work/project');
@@ -964,8 +978,8 @@ void main() {
expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
- expect(app.activeSwarm, same(original));
- expect(app.closedHistory, isEmpty);
+ expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);
+ expect(app.swarms, contains(original));
// The creation box was opened from a search editor that is now gone.
// Returning focus to that detached editor would disable shortcuts.
await chord(tester, LogicalKeyboardKey.keyP, shift: true);
diff --git a/desktop/test/keyboard_practice_test.dart b/desktop/test/keyboard_practice_test.dart
index cbcb3d06f..286b5b848 100644
--- a/desktop/test/keyboard_practice_test.dart
+++ b/desktop/test/keyboard_practice_test.dart
@@ -268,6 +268,8 @@ void main() {
findsOneWidget,
);
await command(tester, 'Quick start');
+ await tester.tap(find.text('Try the keyboard tour'));
+ await tester.pumpAndSettle();
expect(find.byType(WorkspaceQuickStart), findsOneWidget);
expect(learning.next, WorkspaceLesson.agent);
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
diff --git a/desktop/test/keymap_native_test.dart b/desktop/test/keymap_native_test.dart
index 09c009a97..bdc0f77d4 100644
--- a/desktop/test/keymap_native_test.dart
+++ b/desktop/test/keymap_native_test.dart
@@ -30,6 +30,16 @@ void main() {
final keymap = MemoryKeymap();
addTearDown(keymap.dispose);
final defaults = nativeKeymapSnapshot(keymap);
+ for (final context in ['workspace', 'terminal']) {
+ final rows = ((defaults['contexts'] as Map)[context] as List)
+ .cast<Map>();
+ expect(
+ rows.singleWhere(
+ (row) => (row['keys'] as List).join(' ') == 'cmd+o',
+ )['command'],
+ 'agent.open',
+ );
+ }
keymap.apply('''{"bindings":[
{"keys":"cmd+t","command":null},
{"keys":"cmd+o","command":"swarm.new"},
diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dart
index e6b09c2a5..97e7356c9 100644
--- a/desktop/test/keymap_runtime_test.dart
+++ b/desktop/test/keymap_runtime_test.dart
@@ -114,17 +114,20 @@ void main() {
: LogicalKeyboardKey.keyL;
await key(tester, shortcut, cmd: true, shift: !remapped);
await tester.pumpAndSettle();
- if (remapped)
+ if (remapped) {
await key(tester, LogicalKeyboardKey.keyL, cmd: true, shift: true);
+ }
// Fast repeated chords can arrive before the next rendered frame.
await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);
- if (!remapped)
+ if (!remapped) {
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
+ }
await tester.sendKeyEvent(shortcut);
await tester.sendKeyEvent(shortcut);
await tester.sendKeyEvent(shortcut);
- if (!remapped)
+ if (!remapped) {
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
+ }
await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);
await tester.pump();
expect(find.byType(Dialog), findsOneWidget);
@@ -202,6 +205,8 @@ void main() {
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
expect(app.swarms, hasLength(2));
expect(app.activeSwarm, isNot(same(original)));
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
expect(
tester
.widget<TextField>(find.byKey(const ValueKey('swarm-search-input')))
@@ -749,7 +754,7 @@ void main() {
await tester.pump();
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
expect(app.swarms, hasLength(2));
- expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
await tester.pumpWidget(const SizedBox());
app.dispose();
map.dispose();
@@ -800,6 +805,9 @@ void main() {
await native(tester, 'keymapCommand', {'command': 'swarm.new'});
await tester.pump();
final field = find.byKey(const ValueKey('swarm-search-input'));
+ expect(field, findsNothing);
+ await native(tester, 'keymapCommand', {'command': 'agent.open'});
+ await tester.pump();
await tester.tap(field);
await tester.enterText(field, 'Agent 0');
await tester.pump();
diff --git a/desktop/test/new_harness_entry_rules_test.dart b/desktop/test/new_harness_entry_rules_test.dart
index a07d9de71..1c97c832a 100644
--- a/desktop/test/new_harness_entry_rules_test.dart
+++ b/desktop/test/new_harness_entry_rules_test.dart
@@ -170,7 +170,7 @@ void main() {
for (final shortcut in [
LogicalKeyboardKey.keyN,
LogicalKeyboardKey.keyP,
- LogicalKeyboardKey.keyT,
+ LogicalKeyboardKey.keyO,
]) {
testWidgets(
'${shortcut.keyLabel} starts a pane with no extra launch controls',
@@ -182,9 +182,7 @@ void main() {
await key(tester, LogicalKeyboardKey.enter);
}
final controller = box(tester);
- final initial = shortcut == LogicalKeyboardKey.keyT
- ? HarnessPlacement.newTab
- : HarnessPlacement.currentTab;
+ const initial = HarnessPlacement.currentTab;
expect(controller.placement, initial);
for (final removed in ['task', 'placement']) {
expect(
@@ -281,7 +279,7 @@ void main() {
'product entry from a pane does not inherit workspace projects or search tasks',
(tester) async {
await mount(tester, store: false);
- await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Review the API',
@@ -388,13 +386,13 @@ void main() {
for (final newTab in [true, false]) {
testWidgets(
- 'switching to Cmd-${newTab ? 'T' : 'P'} keeps the highlighted existing harness',
+ 'switching to Cmd-${newTab ? 'O' : 'P'} keeps the highlighted existing harness',
(tester) async {
await mount(tester, store: false);
final origin = app.activeSwarm;
await key(
tester,
- newTab ? LogicalKeyboardKey.keyP : LogicalKeyboardKey.keyT,
+ newTab ? LogicalKeyboardKey.keyP : LogicalKeyboardKey.keyO,
cmd: true,
);
final search = find.byKey(const ValueKey('swarm-search-input'));
@@ -412,7 +410,7 @@ void main() {
expect(picker.selected?.agentId, 'a1');
await key(
tester,
- newTab ? LogicalKeyboardKey.keyT : LogicalKeyboardKey.keyP,
+ newTab ? LogicalKeyboardKey.keyO : LogicalKeyboardKey.keyP,
cmd: true,
);
final updated = tester
@@ -422,9 +420,8 @@ void main() {
expect(updated.selected?.agentId, 'a1');
await key(tester, LogicalKeyboardKey.enter);
expect(app.focusedPane?.agentId, 'a1');
- // Cmd-P operates on the visible tab, including a tab just opened by Cmd-T.
- expect(app.activeSwarm, isNot(same(origin)));
- expect(app.swarms.length, 2);
+ expect(app.activeSwarm, same(origin));
+ expect(app.swarms.length, 1);
expect(connections.values.expand((c) => c.starts), isEmpty);
await tester.pumpWidget(const SizedBox());
},
@@ -432,12 +429,12 @@ void main() {
for (final switchDestination in [false, true]) {
testWidgets(
- 'Cmd-${newTab ? 'T' : 'P'} ${switchDestination ? 'switches destination' : 'repeats'} without losing the search task',
+ 'Cmd-${newTab ? 'O' : 'P'} ${switchDestination ? 'switches shortcut' : 'repeats'} without losing the search task',
(tester) async {
await mount(tester, store: false);
final origin = app.activeSwarm;
final shortcut = newTab
- ? LogicalKeyboardKey.keyT
+ ? LogicalKeyboardKey.keyO
: LogicalKeyboardKey.keyP;
final nextTab = switchDestination ? !newTab : newTab;
await key(tester, shortcut, cmd: true);
@@ -452,7 +449,7 @@ void main() {
);
await key(
tester,
- nextTab ? LogicalKeyboardKey.keyT : LogicalKeyboardKey.keyP,
+ nextTab ? LogicalKeyboardKey.keyO : LogicalKeyboardKey.keyP,
cmd: true,
);
final updated = tester.widget<SwarmSearchInput>(
@@ -466,13 +463,10 @@ void main() {
expect(updated.focusNode.hasFocus, isTrue);
expect(find.text(nextTab ? 'New Tab' : 'New Pane'), findsNothing);
expect(app.swarms.first, same(origin));
- expect(app.swarms.length, newTab || nextTab ? 2 : 1);
+ expect(app.swarms.length, 1);
await key(tester, LogicalKeyboardKey.enter);
expect(box(tester).task, 'Check the keyboard workflow');
- expect(
- box(tester).placement,
- nextTab ? HarnessPlacement.newTab : HarnessPlacement.currentTab,
- );
+ expect(box(tester).placement, HarnessPlacement.currentTab);
await key(tester, LogicalKeyboardKey.enter);
expect(
connections['m']!.starts.single['prompt'],
@@ -481,7 +475,7 @@ void main() {
connections['m']!.created();
await tester.pump();
await tester.pump(const Duration(milliseconds: 200));
- expect(app.swarms.length, newTab || nextTab ? 2 : 1);
+ expect(app.swarms.length, 1);
expect(app.focusedPane?.agentId, 'created-1');
await tester.pumpWidget(const SizedBox());
},
@@ -489,7 +483,7 @@ void main() {
}
testWidgets(
- 'Cmd-${newTab ? 'T' : 'P'} keeps drafts separate when the focused source pane changes',
+ 'Cmd-${newTab ? 'O' : 'P'} keeps drafts separate when the focused source pane changes',
(tester) async {
await mount(tester, store: false);
final first = app.focusedPane!;
@@ -497,7 +491,7 @@ void main() {
app.focusPane(first.id);
await tester.pump();
final shortcut = newTab
- ? LogicalKeyboardKey.keyT
+ ? LogicalKeyboardKey.keyO
: LogicalKeyboardKey.keyP;
await key(tester, shortcut, cmd: true);
await key(tester, LogicalKeyboardKey.enter);
@@ -529,12 +523,12 @@ void main() {
);
testWidgets(
- 'Cmd-${newTab ? 'T' : 'P'} inherits its source and resumes edits into the requested destination',
+ 'Cmd-${newTab ? 'O' : 'P'} inherits its source and resumes edits via either open shortcut',
(tester) async {
await mount(tester, store: false);
final origin = app.activeSwarm;
final shortcut = newTab
- ? LogicalKeyboardKey.keyT
+ ? LogicalKeyboardKey.keyO
: LogicalKeyboardKey.keyP;
await key(tester, shortcut, cmd: true);
await key(tester, LogicalKeyboardKey.enter);
@@ -543,7 +537,7 @@ void main() {
expect(draft.machineId, 'm');
expect(draft.project.folder, '/work/openharness');
expect(app.swarms.first, same(origin));
- expect(app.swarms.length, newTab ? 2 : 1);
+ expect(app.swarms.length, 1);
draft.focusField(NewHarnessField.task);
await tester.pump();
await tester.enterText(input, 'Check keyboard focus');
@@ -554,17 +548,14 @@ void main() {
expect(app.activeSwarm, same(origin));
await key(
tester,
- newTab ? LogicalKeyboardKey.keyP : LogicalKeyboardKey.keyT,
+ newTab ? LogicalKeyboardKey.keyP : LogicalKeyboardKey.keyO,
cmd: true,
);
await key(tester, LogicalKeyboardKey.enter);
draft = box(tester);
expect(draft.task, 'Check keyboard focus');
expect(draft.project.name, 'keyboard-review');
- expect(
- draft.placement,
- newTab ? HarnessPlacement.currentTab : HarnessPlacement.newTab,
- );
+ expect(draft.placement, HarnessPlacement.currentTab);
await key(tester, LogicalKeyboardKey.enter);
final connection = connections['m']!;
expect(connection.starts, hasLength(1));
@@ -576,7 +567,7 @@ void main() {
await tester.pump();
await tester.pump(const Duration(milliseconds: 200));
expect(find.byType(NewHarnessBox), findsNothing);
- expect(app.swarms.length, newTab ? 1 : 2);
+ expect(app.swarms.length, 1);
expect(app.activeSwarm.panes.last.agentId, 'created-1');
expect(app.focusedPane?.agentId, 'created-1');
await tester.pumpWidget(const SizedBox());
@@ -588,7 +579,7 @@ void main() {
'switching the picker keeps its project scope and Escape goes back',
(tester) async {
await mount(tester, store: false);
- await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
final search = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(search, '# openharness');
await key(tester, LogicalKeyboardKey.enter);
diff --git a/desktop/test/orchestrator_controls_test.dart b/desktop/test/orchestrator_controls_test.dart
index c0f25facd..477fda1c7 100644
--- a/desktop/test/orchestrator_controls_test.dart
+++ b/desktop/test/orchestrator_controls_test.dart
@@ -329,7 +329,7 @@ void main() {
final folder = find.byWidgetPredicate(
(w) =>
w is TextField &&
- w.decoration?.labelText == 'Project folder (optional)',
+ w.decoration?.hintText == 'Absolute path to an existing folder',
);
await tester.ensureVisible(folder);
await tester.enterText(folder, ' /tmp/fixture-project ');
diff --git a/desktop/test/pane_lattice_test.dart b/desktop/test/pane_lattice_test.dart
index b8acd7ce1..8af67a978 100644
--- a/desktop/test/pane_lattice_test.dart
+++ b/desktop/test/pane_lattice_test.dart
@@ -39,6 +39,10 @@ Future<void> _pump(WidgetTester tester, int n, Size size) async {
await tester.pump();
}
+bool hasScrollableContent(WidgetTester tester) => tester
+ .stateList<ScrollableState>(find.byType(Scrollable))
+ .any((state) => state.position.maxScrollExtent > 0);
+
void main() {
test('machine starters can contain more than nine agents', () {
expect(PaneLayoutStore.maxPanes, 9);
@@ -65,13 +69,13 @@ void main() {
// beat nine unusable ones in view.
await _pump(tester, 9, const Size(1750, 420));
expect(tester.takeException(), isNull);
- expect(find.byType(SingleChildScrollView), findsWidgets);
+ expect(hasScrollableContent(tester), isTrue);
},
);
testWidgets('a window with the room does not scroll', (tester) async {
await _pump(tester, 6, const Size(1750, 900));
- expect(find.byType(SingleChildScrollView), findsNothing);
+ expect(hasScrollableContent(tester), isFalse);
});
testWidgets('four tiles keep the shape they were tuned to', (tester) async {
@@ -79,6 +83,6 @@ void main() {
// and no uniform grid can say that — so the hand-tuned shapes stay.
await _pump(tester, 4, const Size(1750, 900));
expect(tester.takeException(), isNull);
- expect(find.byType(SingleChildScrollView), findsNothing);
+ expect(hasScrollableContent(tester), isFalse);
});
}
diff --git a/desktop/test/pane_machine_unknown_test.dart b/desktop/test/pane_machine_unknown_test.dart
index 78554d51b..9ea796284 100644
--- a/desktop/test/pane_machine_unknown_test.dart
+++ b/desktop/test/pane_machine_unknown_test.dart
@@ -33,6 +33,9 @@ class _Api extends ApiClient {
);
final lists = <Completer<List<Machine>>>[];
+ @override
+ Future<Map<String, dynamic>?> desk() async => null;
+
@override
Future<Map<String, dynamic>?> me() async => null;
diff --git a/desktop/test/quick_access_test.dart b/desktop/test/quick_access_test.dart
index 81cb2fb9d..e03561fce 100644
--- a/desktop/test/quick_access_test.dart
+++ b/desktop/test/quick_access_test.dart
@@ -126,6 +126,9 @@ void main() {
addTearDown(map.dispose);
await configured.mount(tester, app, map);
await key(tester, entry, cmd: true);
+ if (entry == LogicalKeyboardKey.keyT) {
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
+ }
final tabs = app.swarms.length;
final input = find.byKey(const ValueKey('swarm-search-input'));
final field = tester.widget<TextField>(input);
diff --git a/desktop/test/settings_screen_test.dart b/desktop/test/settings_screen_test.dart
index 9d243040e..8ddd7a74c 100644
--- a/desktop/test/settings_screen_test.dart
+++ b/desktop/test/settings_screen_test.dart
@@ -98,7 +98,7 @@ void main() {
}
await tester.tap(find.byKey(const ValueKey('customize-appearance')));
await tester.pumpAndSettle();
- expect(find.byKey(const Key('appearance-ui-size-field')), findsOneWidget);
+ expect(find.byKey(const Key('appearance-ui-size-field')), findsNothing);
await tester.tap(find.byKey(const ValueKey('customize-terminal')));
await tester.pumpAndSettle();
expect(
diff --git a/desktop/test/stop_keyboard_test.dart b/desktop/test/stop_keyboard_test.dart
index 3e32d075d..4cabad5af 100644
--- a/desktop/test/stop_keyboard_test.dart
+++ b/desktop/test/stop_keyboard_test.dart
@@ -202,13 +202,25 @@ void main() {
await key(tester, LogicalKeyboardKey.pageDown);
expect(body.controller!.offset, greaterThan(0));
expect(find.text('Cancel').hitTestable(), findsOneWidget);
- await key(tester, LogicalKeyboardKey.pageDown);
+ for (
+ var i = 0;
+ i < 12 &&
+ find
+ .textContaining('Close Pane keeps it running.')
+ .hitTestable()
+ .evaluate()
+ .isEmpty;
+ i++
+ ) {
+ await key(tester, LogicalKeyboardKey.pageDown);
+ }
expect(
find.textContaining('Close Pane keeps it running.').hitTestable(),
findsOneWidget,
);
- await key(tester, LogicalKeyboardKey.pageUp);
- await key(tester, LogicalKeyboardKey.pageUp);
+ for (var i = 0; i < 12 && body.controller!.offset > 0; i++) {
+ await key(tester, LogicalKeyboardKey.pageUp);
+ }
expect(body.controller!.offset, 0);
expect(tester.takeException(), isNull);
await key(tester, LogicalKeyboardKey.enter);
diff --git a/desktop/test/stopped_harness_test.dart b/desktop/test/stopped_harness_test.dart
index 600b9efbe..18a549ca8 100644
--- a/desktop/test/stopped_harness_test.dart
+++ b/desktop/test/stopped_harness_test.dart
@@ -302,6 +302,9 @@ void main() {
final originalTab = app.activeSwarmId;
await mount(tester, app);
await chord(tester, key);
+ if (key == LogicalKeyboardKey.keyT) {
+ await chord(tester, LogicalKeyboardKey.keyO);
+ }
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -341,6 +344,7 @@ void main() {
) async {
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
diff --git a/desktop/test/stopped_tab_cleanup_test.dart b/desktop/test/stopped_tab_cleanup_test.dart
index 96c7fb4c3..4c8a93efb 100644
--- a/desktop/test/stopped_tab_cleanup_test.dart
+++ b/desktop/test/stopped_tab_cleanup_test.dart
@@ -169,7 +169,7 @@ void main() {
connection.create.complete({'error': 'FIXTURE_FAILURE'});
await creation;
});
- testWidgets('Escape restores onboarding if the draft return tab stopped', (
+ testWidgets('a quiet New Tab stays open when the previous tab stops', (
tester,
) async {
app.status = AppStatus.authenticated;
@@ -186,13 +186,13 @@ void main() {
await tester.pump();
await tester.pump(const Duration(milliseconds: 200));
expect(app.swarms, hasLength(1));
- expect(app.activeSwarmId, isNot(draft));
- expect(app.activeSwarm.isNewTabPage, isFalse);
+ expect(app.activeSwarmId, draft);
+ expect(app.activeSwarm.isNewTabPage, isTrue);
expect(app.activeSwarm.isEmptyStarter, isTrue);
- expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
await tester.pumpWidget(const SizedBox());
});
- testWidgets('last stopped tab becomes one welcome page with its dock open', (
+ testWidgets('last stopped tab becomes one quiet welcome page', (
tester,
) async {
// The same entry condition as an authenticated, connected workspace.
@@ -207,7 +207,7 @@ void main() {
expect(app.swarms, hasLength(1));
expect(app.activeSwarmId, isNot(oldId));
expect(app.activeSwarm.isEmptyStarter, isTrue);
- expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
await stopped();
expect(app.swarms, hasLength(1));
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index 00f9150a0..a7b5af9b9 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -182,7 +182,7 @@ void main() {
for (final dismissal in ['outside', 'escape']) {
testWidgets(
- 'New Tab discards its empty draft after $dismissal (native=$native)',
+ 'New Tab stays open after dismissing its picker with $dismissal (native=$native)',
(tester) async {
final app = createApp();
final frames = <TerminalBinaryFrame>[];
@@ -193,6 +193,9 @@ void main() {
await tester.pump();
expect(app.activeSwarmId, isNot(original));
expect(app.activeSwarm.isNewTabPage, isTrue);
+ final created = app.activeSwarmId;
+ expect(_results, findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(_results, findsOneWidget);
expect(_startInput, findsNothing);
if (dismissal == 'outside') {
@@ -202,9 +205,11 @@ void main() {
}
await tester.pump();
expect(_results, findsNothing);
- expect(app.activeSwarmId, original);
- expect(app.swarms, hasLength(1));
+ expect(app.activeSwarmId, created);
+ expect(app.swarms, hasLength(2));
expect(app.closedHistory, isEmpty);
+ app.selectSwarm(original);
+ await tester.pump();
expect(app.focusedPane, same(pane));
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
diff --git a/desktop/test/swarm_immediate_input_test.dart b/desktop/test/swarm_immediate_input_test.dart
index fec4d5b5b..dcdafb52c 100644
--- a/desktop/test/swarm_immediate_input_test.dart
+++ b/desktop/test/swarm_immediate_input_test.dart
@@ -108,13 +108,8 @@ void main() {
expect(app.swarms, hasLength(2));
expect(firstInput, isEmpty);
expect(
- tester
- .widget<TextField>(
- find.byKey(const ValueKey('swarm-search-input')),
- )
- .focusNode!
- .hasFocus,
- isTrue,
+ find.byKey(const ValueKey('swarm-search-input')),
+ findsNothing,
);
} else if (action == 'waiting composer') {
expect(app.focusedPane, same(first));
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index 2d537c390..e52212555 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -70,7 +70,7 @@ Future<void> chord(
void main() {
for (final native in [false, true]) {
testWidgets(
- 'New Tab opens a minimal draft and Escape removes only that draft (native: $native)',
+ 'every New Tab entry opens a quiet welcome and preserves work (native: $native)',
(tester) async {
const channel = MethodChannel('harness/swarm_tabs');
const codec = StandardMethodCodec();
@@ -134,26 +134,27 @@ void main() {
expect(app.activeSwarmId, isNot(work));
expect(app.activeSwarm.isNewTabPage, isTrue);
expect(app.swarms, hasLength(3));
- expect(find.text('Follow your curiosity.'), findsWidgets);
expect(
- find.text('Follow your curiosity. Build across disciplines.'),
- findsNothing,
+ find.byKey(const ValueKey('workspace-welcome')),
+ findsOneWidget,
);
final input = find.byKey(const ValueKey('swarm-search-input'));
+ expect(input, findsNothing);
+ final created = app.activeSwarmId;
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(tester.widget<TextField>(input).focusNode!.hasFocus, isTrue);
await tester.enterText(input, 'Agent 1');
await tester.pump();
- await chord(tester, LogicalKeyboardKey.keyT);
- expect(app.swarms, hasLength(3));
- expect(tester.widget<TextField>(input).controller!.text, 'Agent 1');
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
expect(input, findsNothing);
- expect(app.activeSwarmId, work);
+ expect(app.activeSwarmId, created);
+ await chord(tester, LogicalKeyboardKey.keyW);
expect(app.swarms, hasLength(2));
}
await newFromChrome();
await tester.pump();
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Agent 0',
@@ -415,8 +416,9 @@ void main() {
expect(app.activeSwarmId, isNot(starter));
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
- expect(app.swarms, hasLength(1));
- expect(app.activeSwarmId, starter);
+ expect(app.swarms, hasLength(2));
+ expect(app.activeSwarmId, isNot(starter));
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
expect(input, hasLength(2));
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index f7b458ab1..40f4a06b5 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -164,6 +164,8 @@ void main() {
await tester.pump();
await tester.pump(const Duration(milliseconds: 300));
expect(app.swarms, hasLength(31));
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyO);
final input = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(input, 'Agent 1');
await tester.pump();
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 90fa83fc7..98b84fa5a 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -64,6 +64,8 @@ void main() {
expect(original.panes, [pane]);
expect(find.byType(AlertDialog), findsNothing);
final field = find.byKey(const ValueKey('swarm-search-input'));
+ expect(field, findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
await tester.enterText(field, 'Agent 0');
await tester.pump();
@@ -129,6 +131,8 @@ void main() {
expect(app.panes, isEmpty);
expect(app.swarms, hasLength(2));
expect(app.allPanes, contains(pane));
+ expect(jumpField, findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(jumpField, findsOneWidget);
final search = tester
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
diff --git a/desktop/test/terminal_catalog_test.dart b/desktop/test/terminal_catalog_test.dart
index c9866a341..a584b7a02 100644
--- a/desktop/test/terminal_catalog_test.dart
+++ b/desktop/test/terminal_catalog_test.dart
@@ -109,6 +109,7 @@ void main() {
}
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.enterText(input, 'login claude M2');
await tester.pump();
await key(tester, LogicalKeyboardKey.enter);
diff --git a/desktop/test/terminal_tail_lifecycle_test.dart b/desktop/test/terminal_tail_lifecycle_test.dart
index 3989701cc..028fb1bb7 100644
--- a/desktop/test/terminal_tail_lifecycle_test.dart
+++ b/desktop/test/terminal_tail_lifecycle_test.dart
@@ -257,6 +257,7 @@ void main() {
view.widget.scrollController!.jumpTo(100);
await tester.pump();
await chord(tester, LogicalKeyboardKey.keyT);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Agent 0',
diff --git a/desktop/test/terminal_ui_scale_isolation_test.dart b/desktop/test/terminal_ui_scale_isolation_test.dart
index eec4841d9..2d91e55b8 100644
--- a/desktop/test/terminal_ui_scale_isolation_test.dart
+++ b/desktop/test/terminal_ui_scale_isolation_test.dart
@@ -15,28 +15,7 @@ import 'package:harness/widgets/terminal_composer.dart';
import 'package:harness/widgets/terminal_panel.dart';
import 'package:xterm/xterm.dart';
-/// The app's UI type settings must not reach the terminal.
-///
-/// The user drew that line themselves — the terminal carries its OWN font
-/// settings (Settings ▸ Terminal) because its type is a grid a remote program
-/// draws into, not a label the app writes. The cost of getting it wrong is not
-/// cosmetic: a changed cell size or a changed pane height re-derives `rows`,
-/// and `Terminal.resize` fires `onResize` unconditionally, which puts a
-/// `terminal_resize` frame on the wire and a SIGWINCH at the far end.
-///
-/// There are TWO independent channels that could carry the setting across, and
-/// they need different fences, so both are measured here:
-///
-/// 1. `MediaQuery`'s text scaler — reaches the xterm grid through
-/// `TerminalView`'s `textScaler ?? MediaQuery.textScalerOf(context)`.
-/// 2. `AppFont.uiScale` — a plain static the THEME reads
-/// (`AppControl.heightFieldScaled`, and a padding multiplied by it), so no
-/// scaling scope can hold it back. It reaches the terminal by growing the
-/// composer's box and shrinking the pane above it.
-///
-/// Geometry is MEASURED with `getRect`/`getSize` rather than argued from the
-/// source, per §14.1 of the design-system doc.
-
+/// OS text scaling must not apply a second multiplier to terminal cells or input.
AppNotifier _notifier() {
final app = AppNotifier(
config: AppConfig.dev,
@@ -92,8 +71,7 @@ Future<TerminalSession> _liveSession() async {
return session;
}
-/// The pane, under a given app-wide UI text scale — the same mechanism
-/// `MaterialApp.builder` uses in `main.dart`.
+/// An isolated pane under OS text scaling, outside the app-wide no-scaling scope.
Widget _host(AppNotifier app, TerminalSession session, {double uiScale = 1}) =>
MaterialApp(
theme: grid.buildAppTheme(brightness: Brightness.dark),
@@ -123,17 +101,11 @@ Widget _host(AppNotifier app, TerminalSession session, {double uiScale = 1}) =>
),
);
-/// The top of the UI-size range the Appearance screen offers (19 / 14). The
-/// isolation is measured at the extreme, because that is where a leak is
-/// largest and where a row is actually lost.
-const double _maxScale = 19 / 14;
+/// A large OS text scale makes an accidental second multiplier visible.
+const double _maxScale = 1.5;
void main() {
- // `AppFont`'s settings are process-wide statics, so a test that moves them
- // would otherwise leak into every test that runs after it.
- tearDown(grid.AppFont.reset);
-
- testWidgets('the terminal grid refuses the app-wide text scale', (
+ testWidgets('the terminal grid does not apply a second text scale', (
tester,
) async {
final app = _notifier();
@@ -143,12 +115,12 @@ void main() {
final view = tester.widget<TerminalView>(find.byType(TerminalView));
// Explicit, not inherited: without this the view falls back to the ambient
- // scaler and the UI setting would land on the cell size.
+ // scaler would multiply the chosen cell size again.
expect(
view.textScaler,
TextScaler.noScaling,
reason:
- 'TerminalView must pin its own scaler, not inherit the app UI one',
+ 'TerminalView must use the chosen point size without a second scale',
);
session.dispose();
app.dispose();
@@ -157,11 +129,7 @@ void main() {
testWidgets('the terminal is drawn ONLY from its own settings', (
tester,
) async {
- // A standing fence, not a scaling one. The pane a remote agent draws into is
- // reviewed with the terminal, never with the app's design system — so every
- // input that decides what the grid looks like has to come from
- // `terminalFontStore` and nothing else. If a future design pass reaches in
- // here, this is what says no.
+ // The renderer and app controls share the persisted terminal preference.
final app = _notifier();
final session = await _liveSession();
await tester.pumpWidget(_host(app, session, uiScale: _maxScale));
@@ -181,7 +149,7 @@ void main() {
});
testWidgets(
- 'the composer renders its type at the terminal size, not the UI one',
+ 'the composer uses the terminal point size without a second scale',
(tester) async {
final app = _notifier();
final session = await _liveSession();
@@ -208,11 +176,9 @@ void main() {
);
testWidgets(
- 'AppFont.uiScale cannot change the pane height the terminal gets',
+ 'ambient text scaling cannot change the pane height the terminal gets',
(tester) async {
- // This is the channel a scaling scope does NOT cover: the theme reads
- // `AppFont.uiScale` directly, so the composer's BOX would grow with it
- // and steal rows from the terminal.
+ // Ambient scaling must not silently take rows away from the terminal.
final app = _notifier();
final session = await _liveSession();
@@ -221,16 +187,11 @@ void main() {
final restingComposer = tester.getSize(find.byType(TerminalComposer));
final restingTerminal = tester.getSize(find.byType(TerminalView));
- grid.AppTheme.fonts.apply(uiScale: _maxScale, codeSize: 12.5);
await tester.pumpWidget(_host(app, session, uiScale: _maxScale));
await tester.pumpAndSettle();
final scaledComposer = tester.getSize(find.byType(TerminalComposer));
final scaledTerminal = tester.getSize(find.byType(TerminalView));
- // Proof the setting really moved, so a no-op apply cannot make the two
- // assertions below pass for the wrong reason.
- expect(grid.AppControl.heightFieldScaled, greaterThan(40));
-
expect(
scaledComposer.height,
restingComposer.height,
diff --git a/desktop/test/terminal_ui_typography_test.dart b/desktop/test/terminal_ui_typography_test.dart
new file mode 100644
index 000000000..4fd14efbe
--- /dev/null
+++ b/desktop/test/terminal_ui_typography_test.dart
@@ -0,0 +1,287 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shortcuts/app_keymap.dart';
+import 'package:harness/state/app_state.dart';
+import 'package:harness/state/new_harness.dart';
+import 'package:harness/state/swarm_catalog.dart';
+import 'package:harness/terminal/terminal_text.dart';
+import 'package:harness/widgets/delete_agent_dialog.dart';
+import 'package:harness/widgets/new_harness_box.dart';
+import 'package:harness/widgets/swarm_dialogs.dart';
+import 'package:harness/widgets/swarm_search_preview.dart';
+import 'package:harness/widgets/workspace_welcome.dart';
+import 'package:package_info_plus/package_info_plus.dart';
+import 'package:xterm/xterm.dart';
+
+import 'keymap_host_test.dart' show MemoryKeymap, key;
+import 'swarm_screen_test.dart' show terminal;
+import 'swarm_state_test.dart' show createApp;
+
+void main() {
+ late TerminalStyle original;
+ setUp(() {
+ original = terminalFontStore.value;
+ newHarnessOpensInBox = true;
+ PackageInfo.setMockInitialValues(
+ appName: 'Harness',
+ packageName: 'ai.autonomous.harness',
+ version: '1.1.25',
+ buildNumber: '25',
+ buildSignature: '',
+ );
+ });
+ tearDown(() {
+ terminalFontStore.value = original;
+ newHarnessOpensInBox = false;
+ });
+
+ void selectFont(
+ double size, [
+ TerminalFontChoice choice = TerminalFontChoice.menlo,
+ ]) {
+ // In memory only: tests never alter the user's persisted preferences.
+ terminalFontStore.value = TerminalStyle(
+ fontSize: size,
+ fontFamily: choice.fontFamily,
+ fontFamilyFallback: choice.fontFamilyFallback,
+ );
+ }
+
+ void checkText(WidgetTester tester) {
+ var count = 0;
+ void check(InlineSpan span, TextStyle inherited) {
+ final style = inherited.merge(span.style);
+ if (span is TextSpan) {
+ if (span.text?.trim().isNotEmpty == true &&
+ ![
+ 'MaterialIcons',
+ 'lucide',
+ 'LucideIcons',
+ ].any((icon) => style.fontFamily?.contains(icon) == true)) {
+ expect(style.fontSize, terminalFontStore.size, reason: span.text);
+ expect(
+ style.fontFamily,
+ terminalFontStore.value.fontFamily,
+ reason: span.text,
+ );
+ count++;
+ }
+ for (final child in span.children ?? <InlineSpan>[]) {
+ check(child, style);
+ }
+ }
+ }
+
+ for (final widget in tester.widgetList<RichText>(find.byType(RichText))) {
+ check(widget.text, const TextStyle());
+ }
+ for (final widget in tester.widgetList<EditableText>(
+ find.byType(EditableText),
+ )) {
+ expect(widget.style.fontSize, terminalFontStore.size);
+ expect(widget.style.fontFamily, terminalFontStore.value.fontFamily);
+ }
+ expect(count, greaterThan(3));
+ expect(tester.takeException(), isNull);
+ }
+
+ Future<void> mount(
+ WidgetTester tester,
+ AppNotifier app,
+ MemoryKeymap map, {
+ bool native = false,
+ }) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1280, 800);
+ addTearDown(tester.view.reset);
+ final projects = SwarmProjectStore();
+ addTearDown(projects.dispose);
+ await tester.pumpWidget(
+ ListenableBuilder(
+ listenable: terminalFontStore,
+ builder: (context, _) => MaterialApp(
+ debugShowCheckedModeBanner: false,
+ themeAnimationDuration: Duration.zero,
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ builder: (_, child) => MediaQuery.withNoTextScaling(
+ child: grid.BrightnessScope(
+ child: KeymapProvider(keymap: map, child: child!),
+ ),
+ ),
+ home: SwarmScreen(
+ notifier: app,
+ nativeTabs: native,
+ projectStore: projects,
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ }
+
+ test('all theme roles and control styles use the selected terminal font', () {
+ for (final size in [9.0, 13.0, 18.0, 22.0]) {
+ selectFont(size);
+ final theme = grid.buildAppTheme(brightness: Brightness.dark);
+ final t = theme.textTheme;
+ for (final style in [
+ t.displayLarge,
+ t.displayMedium,
+ t.displaySmall,
+ t.headlineLarge,
+ t.headlineMedium,
+ t.headlineSmall,
+ t.titleLarge,
+ t.titleMedium,
+ t.titleSmall,
+ t.bodyLarge,
+ t.bodyMedium,
+ t.bodySmall,
+ t.labelLarge,
+ t.labelMedium,
+ t.labelSmall,
+ grid.kFieldTextStyle,
+ grid.AppFont.codeStyle(),
+ ]) {
+ expect(style!.fontSize, size);
+ expect(style.fontFamily, 'Menlo');
+ }
+ expect(
+ theme.inputDecorationTheme.contentPadding!
+ .resolve(TextDirection.ltr)
+ .vertical,
+ isNonNegative,
+ );
+ expect(grid.AppControl.heightFieldScaled, closeTo(36 * size / 13, .001));
+ }
+ });
+
+ testWidgets(
+ 'tabs, panes, welcome, Cmd-N, Cmd-O and Cmd-P update while open',
+ (tester) async {
+ final app = createApp();
+ final map = MemoryKeymap();
+ addTearDown(app.dispose);
+ addTearDown(map.dispose);
+ app.adoptSessionForTest(terminal('a0', []));
+ selectFont(13);
+ await mount(tester, app, map);
+ checkText(tester);
+ selectFont(18, TerminalFontChoice.monaco);
+ await tester.pumpAndSettle();
+ checkText(tester);
+
+ await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ expect(find.byType(WorkspaceWelcome), findsOneWidget);
+ checkText(tester);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ expect(find.byType(NewHarnessBox), findsOneWidget);
+ checkText(tester);
+ selectFont(22);
+ await tester.pumpAndSettle();
+ checkText(tester);
+ await key(tester, LogicalKeyboardKey.escape);
+ for (final shortcut in [
+ LogicalKeyboardKey.keyO,
+ LogicalKeyboardKey.keyP,
+ ]) {
+ await key(tester, shortcut, cmd: true);
+ final input = find.byKey(const ValueKey('swarm-search-input'));
+ await tester.enterText(input, 'Agent');
+ await key(tester, LogicalKeyboardKey.arrowUp);
+ await tester.pumpAndSettle();
+ expect(find.byType(SwarmSearchPreview), findsOneWidget);
+ checkText(tester);
+ selectFont(
+ shortcut == LogicalKeyboardKey.keyO ? 9 : 18,
+ TerminalFontChoice.monaco,
+ );
+ await tester.pumpAndSettle();
+ expect(tester.widget<TextField>(input).controller!.text, 'Agent');
+ expect(tester.widget<TextField>(input).focusNode!.hasFocus, isTrue);
+ checkText(tester);
+ await key(tester, LogicalKeyboardKey.escape);
+ }
+ await tester.pumpWidget(const SizedBox());
+ },
+ );
+
+ testWidgets(
+ 'rename and stop forms follow family and size without reopening',
+ (tester) async {
+ final app = createApp();
+ final map = MemoryKeymap();
+ addTearDown(app.dispose);
+ addTearDown(map.dispose);
+ app.adoptSessionForTest(terminal('a0', []));
+ selectFont(13);
+ await mount(tester, app, map);
+ final context = tester.element(find.byType(SwarmScreen));
+ unawaited(showSwarmRenameDialog(context, 'My project', keymap: map));
+ await tester.pumpAndSettle();
+ checkText(tester);
+ selectFont(22, TerminalFontChoice.monaco);
+ await tester.pumpAndSettle();
+ checkText(tester);
+ expect(
+ tester
+ .widget<TextField>(find.byKey(const Key('tab-rename-input')))
+ .controller!
+ .text,
+ 'My project',
+ );
+ await key(tester, LogicalKeyboardKey.escape);
+ unawaited(
+ confirmDeleteAgent(
+ context,
+ app,
+ 'm',
+ 'a0',
+ 'My project',
+ engine: 'codex',
+ keymap: map,
+ ),
+ );
+ await tester.pumpAndSettle();
+ checkText(tester);
+ selectFont(9);
+ await tester.pumpAndSettle();
+ checkText(tester);
+ await key(tester, LogicalKeyboardKey.escape);
+ await tester.pumpWidget(const SizedBox());
+ },
+ );
+
+ testWidgets('native tab payload follows the same font live', (tester) async {
+ final updates = <Map<dynamic, dynamic>>[];
+ const channel = MethodChannel('harness/swarm_tabs');
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (
+ call,
+ ) async {
+ if (call.method == 'update') updates.add(call.arguments as Map);
+ return true;
+ });
+ addTearDown(
+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ null,
+ ),
+ );
+ final app = createApp();
+ final map = MemoryKeymap();
+ addTearDown(app.dispose);
+ addTearDown(map.dispose);
+ app.adoptSessionForTest(terminal('a0', []));
+ await mount(tester, app, map, native: true);
+ selectFont(22, TerminalFontChoice.monaco);
+ await tester.pumpAndSettle();
+ expect(updates.last['fontFamily'], 'Monaco');
+ expect(updates.last['fontSize'], 22);
+ await tester.pumpWidget(const SizedBox());
+ });
+}
diff --git a/desktop/test/workspace_start_guide_test.dart b/desktop/test/workspace_start_guide_test.dart
index 30b5690cf..2af0d2ea1 100644
--- a/desktop/test/workspace_start_guide_test.dart
+++ b/desktop/test/workspace_start_guide_test.dart
@@ -1,4 +1,3 @@
-import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
@@ -7,7 +6,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness/auth/auth_session.dart';
import 'package:harness/core/config.dart';
import 'package:harness/core/engine_availability.dart';
-import 'package:harness/core/local_key_value_store.dart';
import 'package:harness/core/models.dart';
import 'package:harness/core/project_folder.dart';
import 'package:harness/screens/swarm_screen.dart';
@@ -17,27 +15,18 @@ import 'package:harness/shortcuts/keyboard_practice.dart';
import 'package:harness/shortcuts/keymap.dart';
import 'package:harness/shortcuts/keymap_native.dart';
import 'package:harness/state/app_state.dart';
-import 'package:harness/state/first_harness_launch.dart';
import 'package:harness/state/harness_placement.dart';
import 'package:harness/state/new_harness.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/widgets/new_harness_box.dart';
import 'package:harness/widgets/workspace_start_guide.dart';
+import 'package:harness/widgets/workspace_welcome.dart';
+import 'package:package_info_plus/package_info_plus.dart';
import 'package:xterm/xterm.dart';
import 'keymap_host_test.dart' show MemoryKeymap, key;
import 'swarm_screen_test.dart' show terminal;
-class _Memory implements LocalKeyValueStore {
- final values = <String, String>{};
- @override
- Future<String?> read(String key) async => values[key];
- @override
- Future<void> write(String key, String value) async => values[key] = value;
- @override
- Future<void> delete(String key) async => values.remove(key);
-}
-
class _FirstApp extends AppNotifier {
_FirstApp()
: super(
@@ -57,7 +46,6 @@ class _FirstApp extends AppNotifier {
..nodeOnline = true
..agentLoadStatus = AgentLoadStatus.loaded;
}
- Completer<void>? detection;
List<String> installed = ['codex'];
final launches =
<
@@ -69,7 +57,6 @@ class _FirstApp extends AppNotifier {
>[];
@override
Future<void> probeEngines(String machineId, {bool force = false}) async {
- await detection?.future;
machineStates[machineId]!.engines.replace([
for (final engine in ['claude', 'codex', 'opencode'])
EngineAvailability(
@@ -117,8 +104,7 @@ class _FirstApp extends AppNotifier {
Future<void> _mount(
WidgetTester tester,
- _FirstApp app,
- FirstHarnessLaunch entry, {
+ _FirstApp app, {
bool nativeTabs = false,
}) async {
tester.view.devicePixelRatio = 1;
@@ -128,11 +114,7 @@ Future<void> _mount(
await tester.pumpWidget(
MaterialApp(
theme: grid.buildAppTheme(brightness: Brightness.dark),
- home: SwarmScreen(
- notifier: app,
- nativeTabs: nativeTabs,
- firstLaunch: entry,
- ),
+ home: SwarmScreen(notifier: app, nativeTabs: nativeTabs),
),
);
await tester.pump();
@@ -140,101 +122,56 @@ Future<void> _mount(
}
void main() {
- setUp(() => newHarnessOpensInBox = true);
+ setUp(() {
+ newHarnessOpensInBox = true;
+ PackageInfo.setMockInitialValues(
+ appName: 'Harness',
+ packageName: 'ai.autonomous.harness',
+ version: '1.1.25',
+ buildNumber: '1',
+ buildSignature: '',
+ );
+ });
tearDown(() => newHarnessOpensInBox = false);
- test(
- 'a decision made during preference loading survives and persists',
- () async {
- final storage = _Memory();
- final first = FirstHarnessLaunch(storage: storage);
- final loading = first.load();
- first.handle();
- await loading;
- await first.flush();
- expect(first.handled, isTrue);
- final again = FirstHarnessLaunch(storage: storage);
- await again.load();
- expect(again.handled, isTrue);
- },
- );
-
- testWidgets(
- 'first entry detects the installed agent and starts once on Enter',
- (tester) async {
- final app = _FirstApp()..detection = Completer<void>();
- addTearDown(app.dispose);
- final entry = FirstHarnessLaunch();
- await _mount(tester, app, entry);
- final box = tester
- .widget<NewHarnessBox>(find.byType(NewHarnessBox))
- .controller;
- expect(box.detectingAgent, isTrue);
- expect(find.text('Start Harness'), findsOneWidget);
- expect(find.text('Detecting installed agents…'), findsOneWidget);
- final start = find.byKey(const ValueKey('new-harness-field-create'));
- expect(tester.widget<InkWell>(start).onTap, isNull);
- await tester.tap(start);
- await tester.pump();
- expect(app.launches, isEmpty);
- expect(box.projectLabel, startsWith('~/harnesses/claude-'));
- expect(box.projectFolderRequest!.isGenerated, isTrue);
- expect(app.launches, isEmpty);
- await key(tester, LogicalKeyboardKey.enter);
- expect(app.launches, isEmpty);
- app.detection!.complete();
- await tester.pump();
- await tester.pump(const Duration(milliseconds: 150));
- expect(box.engine, 'codex');
- expect(find.text('Start Harness'), findsOneWidget);
- expect(find.text('New Harness'), findsNothing);
- expect(
- find.byKey(const ValueKey('new-harness-field-placement')),
- findsNothing,
- );
- await key(tester, LogicalKeyboardKey.enter);
- await tester.pump();
- expect(app.launches, hasLength(1));
- expect(app.launches.single.engine, 'codex');
- expect(app.launches.single.project!.name, startsWith('codex-'));
- expect(app.launches.single.project!.isGenerated, isTrue);
- expect(app.launches.single.placement, HarnessPlacement.newTab);
- expect(find.byType(NewHarnessBox), findsNothing);
- await tester.pumpWidget(const SizedBox());
- },
- );
-
- testWidgets(
- 'Escape stays dismissed during a visit; reopening offers the starter',
- (tester) async {
- final app = _FirstApp();
- addTearDown(app.dispose);
- final storage = _Memory();
- final entry = FirstHarnessLaunch(storage: storage);
- await _mount(tester, app, entry);
- expect(find.byType(NewHarnessBox), findsOneWidget);
- await key(tester, LogicalKeyboardKey.escape);
- await app.probeEngines('m');
- await tester.pump(const Duration(milliseconds: 200));
- expect(find.byType(NewHarnessBox), findsNothing);
- expect(find.byType(WorkspaceStartGuide), findsOneWidget);
- await entry.flush();
- await tester.pumpWidget(const SizedBox());
- await _mount(tester, app, FirstHarnessLaunch(storage: storage));
- expect(find.byType(NewHarnessBox), findsOneWidget);
- expect(
- find.text('⌘/ All Keyboard Shortcuts').hitTestable(),
- findsOneWidget,
- );
- await key(tester, LogicalKeyboardKey.slash, cmd: true);
- await tester.pumpAndSettle();
- expect(find.byType(Dialog), findsOneWidget);
- await tester.pumpWidget(const SizedBox());
- },
- );
+ testWidgets('welcome and New Tab stay quiet until an action is chosen', (
+ tester,
+ ) async {
+ final app = _FirstApp();
+ addTearDown(app.dispose);
+ await _mount(tester, app);
+ final search = find.byKey(const ValueKey('swarm-search-input'));
+ expect(find.byType(WorkspaceWelcome), findsOneWidget);
+ expect(find.text('version 1.1.25'), findsOneWidget);
+ expect(find.byType(NewHarnessBox), findsNothing);
+ expect(search, findsNothing);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ expect(find.byType(NewHarnessBox), findsOneWidget);
+ await key(tester, LogicalKeyboardKey.escape);
+ expect(find.byType(NewHarnessBox), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyT, cmd: true);
+ final tab = app.activeSwarmId;
+ expect(find.byType(WorkspaceWelcome), findsOneWidget);
+ expect(find.text('version 1.1.25'), findsOneWidget);
+ expect(search, findsNothing);
+ await tester.tap(find.byKey(const ValueKey('welcome-agent.open')));
+ await tester.pump();
+ expect(search, findsOneWidget);
+ await key(tester, LogicalKeyboardKey.escape);
+ expect(app.activeSwarmId, tab);
+ expect(search, findsNothing);
+ await tester.tap(find.byKey(const ValueKey('welcome-agent.new')));
+ await tester.pump();
+ expect(find.byType(NewHarnessBox), findsOneWidget);
+ await key(tester, LogicalKeyboardKey.escape);
+ expect(app.activeSwarmId, tab);
+ expect(find.byType(NewHarnessBox), findsNothing);
+ expect(app.launches, isEmpty);
+ await tester.pumpWidget(const SizedBox());
+ });
testWidgets(
- 'an empty tab with an existing harness opens search once per visit',
+ 'Command-O and Command-P explicitly open the same existing-harness picker',
(tester) async {
final app = _FirstApp();
addTearDown(app.dispose);
@@ -246,34 +183,37 @@ void main() {
terminalAvailable: true,
),
];
- await _mount(tester, app, FirstHarnessLaunch());
+ await _mount(tester, app);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
expect(find.byType(NewHarnessBox), findsNothing);
expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
expect(find.text('Existing work'), findsOneWidget);
- expect(find.byType(WorkspaceStartGuide).hitTestable(), findsOneWidget);
+ expect(find.byType(WorkspaceWelcome).hitTestable(), findsOneWidget);
await key(tester, LogicalKeyboardKey.escape);
app.notifyListeners();
await tester.pump();
expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyP, cmd: true);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
+ expect(find.text('Existing work'), findsOneWidget);
await tester.pumpWidget(const SizedBox());
},
);
- testWidgets('restored work bypasses the automatic starter', (tester) async {
+ testWidgets('restored work keeps its focused pane', (tester) async {
final app = _FirstApp();
addTearDown(app.dispose);
final pane = app.adoptSessionForTest(terminal('a0', []));
- final entry = FirstHarnessLaunch();
- await _mount(tester, app, entry);
+ await _mount(tester, app);
expect(find.byType(NewHarnessBox), findsNothing);
expect(app.focusedPane, same(pane));
- expect(entry.handled, isTrue);
await tester.pumpWidget(const SizedBox());
});
for (final native in [false, true]) {
testWidgets(
- 'onboarding review reuses a welcome tab and preserves live work (native=$native)',
+ 'welcome review uses New Tab and preserves live work (native=$native)',
(tester) async {
const channel = MethodChannel('harness/swarm_tabs');
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
@@ -306,7 +246,7 @@ void main() {
final second = app.activeSwarm;
final other = app.adoptSessionForTest(terminal('a1', []));
app.selectSwarm(first.id);
- await _mount(tester, app, FirstHarnessLaunch(), nativeTabs: native);
+ await _mount(tester, app, nativeTabs: native);
final view = find.byWidgetPredicate(
(widget) =>
widget is TerminalView && widget.terminal == session.terminal,
@@ -342,28 +282,23 @@ void main() {
await review();
final welcome = app.activeSwarm;
- expect(welcome.name, 'Welcome');
+ expect(welcome.isNewTabPage, isTrue);
expect(app.swarms, [first, second, welcome]);
expect(app.allPanes, [pane, other]);
- expect(find.byType(WorkspaceStartGuide).hitTestable(), findsOneWidget);
+ expect(find.byType(WorkspaceWelcome).hitTestable(), findsOneWidget);
expect(find.byType(NewHarnessBox), findsNothing);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
expect(
find.byKey(const ValueKey('swarm-search-input')),
findsOneWidget,
);
void expectGuideAboveDock(Finder dock) {
final drawing = tester.getRect(
- find.byKey(const ValueKey('workspace-welcome-diagram')).last,
- );
- final shortcuts = tester.getRect(
- find.byKey(const ValueKey('workspace-all-shortcuts')).last,
+ find.byKey(const ValueKey('workspace-welcome-text')).last,
);
expect(drawing.top, greaterThanOrEqualTo(0));
expect(drawing.bottom, lessThanOrEqualTo(tester.getTopLeft(dock).dy));
- expect(
- shortcuts.bottom,
- lessThanOrEqualTo(tester.getTopLeft(dock).dy),
- );
expect(tester.takeException(), isNull);
}
@@ -381,20 +316,6 @@ void main() {
expectGuideAboveDock(find.byKey(const ValueKey('new-harness-box')));
await key(tester, LogicalKeyboardKey.escape);
await tester.pump();
- await review();
- expect(
- find.byKey(const ValueKey('swarm-search-input')),
- findsOneWidget,
- );
- expect(app.activeSwarm, same(welcome));
- expect(app.swarms, [first, second, welcome]);
- app.selectSwarm(first.id);
- await tester.pump();
- await review();
- expect(app.activeSwarm, same(welcome));
- expect(app.swarms, [first, second, welcome]);
-
- await key(tester, LogicalKeyboardKey.escape);
await key(tester, LogicalKeyboardKey.keyW, cmd: true);
await tester.pump();
expect(app.swarms, [first, second]);
@@ -412,43 +333,6 @@ void main() {
);
}
- testWidgets('reviewing Welcome with no harnesses reopens New Harness', (
- tester,
- ) async {
- final app = _FirstApp();
- addTearDown(app.dispose);
- await _mount(tester, app, FirstHarnessLaunch());
- await key(tester, LogicalKeyboardKey.escape);
- for (var visit = 0; visit < 2; visit++) {
- await key(
- tester,
- LogicalKeyboardKey.keyO,
- cmd: true,
- alt: true,
- shift: true,
- );
- await tester.pump(const Duration(milliseconds: 150));
- expect(app.activeSwarm.name, 'Welcome');
- expect(app.swarms.where((tab) => tab.name == 'Welcome'), hasLength(1));
- expect(find.byType(NewHarnessBox), findsOneWidget);
- expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
- expect(
- tester
- .getBottomRight(
- find.byKey(const ValueKey('workspace-welcome-diagram')).last,
- )
- .dy,
- lessThanOrEqualTo(
- tester.getTopLeft(find.byKey(const ValueKey('new-harness-box'))).dy,
- ),
- );
- expect(app.launches, isEmpty);
- await key(tester, LogicalKeyboardKey.escape);
- await tester.pump();
- }
- await tester.pumpWidget(const SizedBox());
- });
-
testWidgets(
'onboarding review key is native-exported but absent from help and practice',
(tester) async {
@@ -489,35 +373,6 @@ void main() {
},
);
- test('installed saved preference wins; explicit editing wins over late discovery', () async {
- final app = _FirstApp()..installed = ['claude', 'codex'];
- addTearDown(app.dispose);
- await app.agentPreference.select('codex');
- final first = NewHarnessController(
- app,
- machineId: 'm',
- firstRun: true,
- autoProject: true,
- );
- await Future<void>.delayed(Duration.zero);
- expect(first.engine, 'codex');
- first.dispose();
- app.detection = Completer<void>();
- final second = NewHarnessController(
- app,
- machineId: 'm',
- firstRun: true,
- autoProject: true,
- );
- second.focusField(NewHarnessField.agent);
- second.setQuery('Claude');
- second.accept();
- app.detection!.complete();
- await Future<void>.delayed(Duration.zero);
- expect(second.engine, 'claude');
- second.dispose();
- });
-
testWidgets(
'the keyboard drawing follows remaps and fits narrow, scaled layouts',
(tester) async {
@@ -567,18 +422,18 @@ void main() {
);
testWidgets(
- 'New Tab caption stays centered in the visible area above each dock',
+ 'compact welcome stays centered in the visible area above each dock',
(tester) async {
final app = _FirstApp();
addTearDown(app.dispose);
app.machineStates['m']!.agents = [
Agent(id: 'saved', name: 'Robot arm', engine: 'claude'),
];
- await _mount(tester, app, FirstHarnessLaunch());
+ await _mount(tester, app);
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
await tester.pumpAndSettle();
- final page = find.byKey(const ValueKey('new-tab-start-page')).last;
- final tagline = find.byKey(const ValueKey('new-tab-tagline')).last;
+ final page = find.byType(WorkspaceWelcome).last;
+ final tagline = find.byKey(const ValueKey('workspace-welcome-text')).last;
void expectCentered() {
expect(tester.getCenter(tagline), tester.getRect(page).center);
expect(
@@ -590,6 +445,8 @@ void main() {
expectCentered();
final search = find.byKey(const ValueKey('swarm-search-input'));
+ expect(search, findsNothing);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
await tester.enterText(search, 'nothing matches');
await tester.pumpAndSettle();
expectCentered();
@@ -635,8 +492,8 @@ void main() {
),
];
}
- await _mount(tester, app, FirstHarnessLaunch());
- final name = hasHarnesses ? 'welcome-search' : 'first-harness';
+ await _mount(tester, app);
+ final name = hasHarnesses ? 'welcome-existing' : 'welcome-new';
await expectLater(
find.byType(MaterialApp),
matchesGoldenFile(Uri.file('$output/$name.png')),
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 58f546d72..c1dfc3185 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -119,6 +119,29 @@ private extension SwarmTabStrip {
try checkTitlebar(tabs[0] === tab && tab.icon === engineIcon, "Closing back to one agent restores the cached engine icon")
}
+ func checkSharedTypography() throws {
+ defer { HarnessTypography.update(["fontFamily": ".AppleSystemUIFontMonospaced", "fontSize": 13]) }
+ for size in [CGFloat(9), 13, 22] {
+ update(["tabs": [["id": "font-tab", "name": "Typography"]], "activeId": "font-tab",
+ "enabled": true, "fontFamily": "Menlo", "fontSize": size])
+ let tab = tabs[0]
+ try checkTitlebar(tab.labelFont.pointSize == size && tab.labelFont.familyName == "Menlo",
+ "Native tab uses the terminal face and size")
+ try checkTitlebar(storeButton.font?.pointSize == size && storeButton.font?.familyName == "Menlo",
+ "Native store action uses the terminal face and size")
+ try checkTitlebar(tab.menu?.font.pointSize == size,
+ "Native tab menu follows the terminal font")
+ let history = SwarmHistoryEntry(["id": "font", "title": "Project", "machineName": "Machine"])!
+ let font = history.menuTitle().attribute(.font, at: 0, effectiveRange: nil) as! NSFont
+ try checkTitlebar(font.pointSize == size && font.familyName == "Menlo",
+ "Native history uses the terminal face and size")
+ let item = NSMenuItem()
+ let row = SwarmHistoryMenuRow(item: item, entry: history, width: 400)
+ try checkTitlebar(row.machineFrame.minY >= 0 && row.machineFrame.maxY <= row.bounds.height,
+ "Native history text fits at every supported point size")
+ }
+ }
+
func checkStartupPalette(_ expected: SwarmNativePalette) throws {
try checkTitlebar(palette == expected && newButton.contentTintColor == expected.accent && notificationButton.contentTintColor == expected.accent &&
newButton.contentTintColor == expected.accent,
@@ -654,7 +677,7 @@ private extension SwarmTitlebar {
try checkTitlebar(window.firstResponder === window.contentInput,
"Adding toolbar buttons does not take initial keyboard focus from the workspace")
try checkTitlebar(main.items.map(\.title) == ["Harness", "File", "Edit", "View", "History", "Models", "Machines", "Window", "Help"], "File leads the standard macOS menus, with Machines after Models")
- let settings = appItem.submenu!.items[0]
+ let settings = appItem.submenu!.items.first { $0.representedObject as? String == "settings" }!
try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")
let agent = main.item(withTitle: "File")!.submenu!
let addHarness = agent.items.first(where: { $0.representedObject as? String == "addAgent" })!
@@ -663,7 +686,7 @@ private extension SwarmTitlebar {
try checkTitlebar(agent.items.contains { $0.title == "New Terminal" && $0.keyEquivalent == "t" && $0.keyEquivalentModifierMask == [.command, .shift] && $0.representedObject as? String == "newTerminal" },
"New Terminal has its Command-Shift-T menu action")
let historyMenu = main.item(withTitle: "History")!.submenu!
- try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "addAgent", "newTerminal", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups tab, terminal and pane actions")
+ try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "addAgent", "newTerminal", "cloneAgent", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups tab, terminal and pane actions")
for (action, title, key) in [("splitRight", "Split Right…", "r"), ("splitDown", "Split Down…", "d")] {
let split = agent.items.first(where: { $0.representedObject as? String == action })!
try checkTitlebar(split.title == title && split.keyEquivalent == key && split.keyEquivalentModifierMask == [.command],
@@ -717,9 +740,9 @@ private extension SwarmTitlebar {
try checkTitlebar(messenger.calls.last?.method == "machineList",
"Machines Manager opens through the Flutter command bridge")
let destinations = machineMenu.items.filter { $0.action == #selector(machineAction(_:)) }
- try checkTitlebar(machineMenu.minimumWidth == 0 && machineMenu.size.width < 432 &&
+ try checkTitlebar(machineMenu.minimumWidth == 0 && machineMenu.size.width < SwarmMenuText.width(String(repeating: "M", count: 80)) &&
destinations.first?.attributedTitle?.string.hasSuffix("\t2 harnesses") == true,
- "Machines gives labels twenty percent more room with aligned counts")
+ "Machines sizes with the selected font and aligns harness counts")
try checkTitlebar(destinations.map { $0.representedObject as? String } == ["office", "home"],
"Machines lists each linked computer as a destination")
try checkTitlebar(destinations[0].attributedTitle?.string.contains("Online") == true &&
@@ -1152,6 +1175,7 @@ do {
let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 52))
try strip.runChecks()
try strip.checkAgentIdentity()
+ try strip.checkSharedTypography()
try checkTitlebar(titlebarCheckApp.windows.isEmpty, "Checks never open an application window")
if CommandLine.arguments.contains("--window-layout") {
let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1280, height: 700),
diff --git a/docs/keyboard.md b/docs/keyboard.md
index b7669b1ad..078dfd344 100644
--- a/docs/keyboard.md
+++ b/docs/keyboard.md
@@ -6,7 +6,8 @@ The defaults, in the workspace:
| Keys | Action |
|---|---|
-| ⌘T | New Tab — choose an existing harness or select the pinned New agent row. The tab is allocated only after selection or successful creation; Escape leaves the layout unchanged |
+| ⌘T | New Tab — opens the same quiet welcome page shown at startup. Use ⌘N to create a harness, ⌘O to open one, or ⌘S for the store |
+| ⌘O | Open Harness — the same picker and placement as ⌘P; opens in the current tab, or focuses its pane if already here |
| ⌘P | New Pane — the same picker, adding to the current tab and automatically tiling its panes. Search by harness name, project, machine, or session content. Selecting a harness already here focuses its pane |
| ⌘R / ⌘D | Split right / down — open the New Pane picker with the requested direction, then choose an existing harness or create one |
| ⌘N | New Harness directly — the box opens on the task: type what it should do and press Return, and it starts as another of the pane you were in (labeled agent, machine, project, and mode defaults stay visible above `task >`). Tab and ⇧Tab step out to those answers; each is a list you filter by typing, with a ✓ on the current one. One verb per field: in a list Return **chooses** and comes back to the task, on the task Return **makes it**, and ⌘↵ makes it from anywhere with the highlighted row. In the project field a word names a new project, `owner/repo` clones it, a path completes the way zsh's does (Tab: common prefix, then walk the candidates, ⇧Tab back; `/` goes in) and Browse… opens the folder chooser. ⌥↵ breaks the line in the task; ⌥1–⌥9 pick a row; ⌘. opens the full form. Escape keeps what you typed for the next ⌘N |
@@ -21,18 +22,19 @@ The defaults, in the workspace:
| ⌘H ⌘J ⌘K ⌘L · ⌘arrows | Focus the pane left · below · above · right |
| ⇧⌘arrows | Move the focused pane |
| ⌘⏎ · ⌘; · ⇧⌘W | Zoom or restore · last pane · close pane |
-| ⌘S | Layout palette |
+| ⌘S | Harness Store |
+| ⇧⌘L | Layout palette |
| ⌘F · ⌘G · ⇧⌘G | Find in terminal · next · previous match |
| ⇧⌘I | Agents needing input |
| ⌘, · ⌘/ | Settings · keyboard shortcuts |
-In the New Tab and New Pane pickers, New agent is selected when the query is empty. Typing selects the best matching existing harness; the creation row stays pinned above it and carries the query into the first task. Projects and machines filter individual harnesses rather than opening whole groups. The destination is shown in the picker and carried into creation. A harness can have views in several tabs, with one view per tab; closing a pane only removes that view.
+In the harness picker, New agent is selected when the query is empty. Typing selects the best matching existing harness; the creation row stays pinned above it and carries the query into the first task. Projects and machines filter individual harnesses rather than opening whole groups. The destination is shown in the picker and carried into creation. A harness can have views in several tabs, with one view per tab; closing a pane only removes that view.
Hover near a pane’s right or bottom edge to reveal its **+** button, or use **File → Split Right… / Split Down…**. The picker shows **New Pane to the Right** or **New Pane Below**. The split is applied after choosing or creating a harness; Escape leaves the layout unchanged.
When a split needs more room, the workspace expands and scrolls to keep both panes readable. Keyboard focus brings the selected pane into view. Splitting remains available up to the tab’s 64-pane limit.
-In a picker: ↓ ⌃N ⌃J and ↑ ⌃P ⌃K move, ⏎ accepts, and Esc, ⌃C, or ⌃G closes. In the New Tab and New Pane pickers, ⌘⏎ accepts into the same requested destination. Preview starts hidden; ⌃/ toggles it and Page Up/Down scroll it without leaving the search input.
+In a picker: ↓ ⌃N ⌃J and ↑ ⌃P ⌃K move, ⏎ accepts, and Esc, ⌃C, or ⌃G closes. In the harness picker, ⌘⏎ accepts into the same requested destination. Preview starts hidden; ⌃/ toggles it and Page Up/Down scroll it without leaving the search input.
The terminal keeps ⌘C, ⌘V, ⌘A, Esc, ⌥⏎ and ⌃C for itself. `pane.pin`, `pane.focus_1…9`,
`pane.resize`, `pane.reset_sizes`, `machine.link` and a few others ship unbound and are in the palette.