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.

fix(desktop): set the empty tab's welcome page at the terminal's size (#202)

Deeb74f936ae3c1
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index acea80d2b..46fc22e9c 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -250,8 +250,8 @@ its headless debug timings do not establish native display or network latency.
face leads — headings, labels, buttons, rows, fields, tabs, shortcuts and anything copied are
mono — and the system sans is kept for prose alone (`body`, `caption`), which is what stops a
screen reading as a wall of mono. Sizes are fixed: `terminalTextStyle` (the terminal's own size,
- ⌘+/⌘−) is only for the grid, its composer and find field, and `terminalTextScaleOf` only for their
- geometry — UI boxes use `appTextScaleOf`. Native tabs get the terminal face at
+ ⌘+/⌘−) is only for the grid, its composer and find field, and the empty tab's welcome page (it
+ stands where a terminal will), and `terminalTextScaleOf` only for their geometry — UI boxes use `appTextScaleOf`. Native tabs get the terminal face at
`AppType.chromeSize`; native menus keep the system menu font.
- `ThemeModeStore` and `TerminalFontStore` are `ValueNotifier` singletons (they must resolve above the
provider scope and before sign-in).
diff --git a/desktop/lib/shared/theme/app_type.dart b/desktop/lib/shared/theme/app_type.dart
index bdde0f562..10ae5e860 100644
--- a/desktop/lib/shared/theme/app_type.dart
+++ b/desktop/lib/shared/theme/app_type.dart
@@ -19,7 +19,8 @@ import '../../terminal/terminal_font_store.dart';
/// face earns its place.
///
/// Sizes are fixed. The terminal's own size setting (⌘+ / ⌘−) moves the
-/// terminal grid, its composer and its find field — [terminalTextStyle] — and
+/// terminal grid, its composer, its find field and the empty tab's welcome
+/// page, which stands where a terminal will — [terminalTextStyle] — and
/// nothing here. An earlier build set every text in the app in the terminal
/// face at the terminal size, which left a heading and its body copy one size
/// apart only by weight.
diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dart
index 6d9d6456d..837091b65 100644
--- a/desktop/lib/widgets/workspace_welcome.dart
+++ b/desktop/lib/widgets/workspace_welcome.dart
@@ -6,7 +6,6 @@ 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 {
@@ -44,10 +43,13 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {
final accent = Theme.of(context).brightness == Brightness.dark
? const Color(0xffa5d786)
: const Color(0xff356522);
- final style = boxMonoStyle(
+ // The page stands where a terminal will, so it is set like one: the
+ // terminal's face at the terminal's size, following ⌘+ and ⌘−.
+ final style = terminalTextStyle(
color: ink,
- weight: FontWeight.w400,
- ).copyWith(height: 1.5);
+ fontWeight: FontWeight.w400,
+ height: 1.5,
+ );
final keymap = KeymapTheme.of(context)?.current ?? harnessDefaultKeymap;
final rows = [
for (final (command, label, description) in _actions)
diff --git a/desktop/test/terminal_ui_typography_test.dart b/desktop/test/terminal_ui_typography_test.dart
index 53a442456..7d7907ee2 100644
--- a/desktop/test/terminal_ui_typography_test.dart
+++ b/desktop/test/terminal_ui_typography_test.dart
@@ -65,7 +65,7 @@ void main() {
/// terminal's — and never at the terminal's own size unless it is one of the
/// scale's steps. Returns each text's size so a caller can compare them
/// across a terminal zoom.
- Map<String, double> checkText(WidgetTester tester) {
+ Map<String, double> checkText(WidgetTester tester, {int atLeast = 4}) {
final sizes = <String, double>{};
void check(InlineSpan span, TextStyle inherited) {
final style = inherited.merge(span.style);
@@ -91,8 +91,17 @@ void main() {
}
}
- for (final widget in tester.widgetList<RichText>(find.byType(RichText))) {
- check(widget.text, const TextStyle());
+ // The welcome page stands where a terminal will and is set like one, so
+ // it follows the terminal's size instead; see [checkWelcome].
+ final welcome = find.byType(WorkspaceWelcome);
+ for (final element in find.byType(RichText).evaluate()) {
+ if (find
+ .descendant(of: welcome, matching: find.byWidget(element.widget))
+ .evaluate()
+ .isNotEmpty) {
+ continue;
+ }
+ check((element.widget as RichText).text, const TextStyle());
}
for (final widget in tester.widgetList<EditableText>(
find.byType(EditableText),
@@ -103,11 +112,23 @@ void main() {
terminalFontStore.size,
}, contains(widget.style.fontSize));
}
- expect(sizes.length, greaterThan(3));
+ expect(sizes.length, greaterThanOrEqualTo(atLeast));
expect(tester.takeException(), isNull);
return sizes;
}
+ /// The welcome page is terminal text: the terminal's face at its size.
+ void checkWelcome(WidgetTester tester) {
+ final line = tester.widget<Text>(
+ find.text('Open source software and hardware'),
+ );
+ final style = DefaultTextStyle.of(
+ tester.element(find.text('Open source software and hardware')),
+ ).style.merge(line.style);
+ expect(style.fontSize, terminalFontStore.size);
+ expect(style.fontFamily, terminalFontStore.value.fontFamily);
+ }
+
/// Zooming the terminal leaves every UI text where it was.
void expectSameSizes(Map<String, double> before, Map<String, double> after) {
for (final entry in after.entries) {
@@ -217,7 +238,14 @@ void main() {
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
expect(find.byType(WorkspaceWelcome), findsOneWidget);
- checkText(tester);
+ // Only the tab chrome is UI text here; the page itself is checked below.
+ checkText(tester, atLeast: 1);
+ checkWelcome(tester);
+ selectFont(22);
+ await tester.pumpAndSettle();
+ checkWelcome(tester);
+ selectFont(18, TerminalFontChoice.monaco);
+ await tester.pumpAndSettle();
await key(tester, LogicalKeyboardKey.keyN, cmd: true);
expect(find.byType(NewHarnessBox), findsOneWidget);
final box = checkText(tester);