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.

Refactor font handling to use Apple font detection instead of platform checks

Dev jacobe0f6bd2ce6f8
diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dart
index 0e87232cd..717912e70 100644
--- a/desktop/lib/shared/theme/app_theme.dart
+++ b/desktop/lib/shared/theme/app_theme.dart
@@ -1,4 +1,4 @@
-import 'dart:io' show Platform;
+import '../../core/apple_fonts.dart';
import 'package:flutter/material.dart';
@@ -1429,7 +1429,7 @@ abstract final class AppFont {
/// 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 =>
- Platform.isMacOS ? _macSansDefault : _linuxSansDefault;
+ hasAppleFonts ? _macSansDefault : _linuxSansDefault;
static const String _macSansDefault = '.AppleSystemUIFont';
static const String _linuxSansDefault = 'Ubuntu Sans';
@@ -1446,7 +1446,7 @@ abstract final class AppFont {
: [sansDefault, ..._sansFallbackDefault];
static List<String> get _sansFallbackDefault =>
- Platform.isMacOS ? _macSansFallback : _linuxSansFallback;
+ hasAppleFonts ? _macSansFallback : _linuxSansFallback;
static const List<String> _macSansFallback = [
'SF Pro Text',
@@ -1483,7 +1483,7 @@ abstract final class AppFont {
/// 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 =>
- Platform.isMacOS ? _macMonoDefault : _linuxMonoDefault;
+ hasAppleFonts ? _macMonoDefault : _linuxMonoDefault;
static const String _macMonoDefault = '.AppleSystemUIFontMonospaced';
static const String _linuxMonoDefault = 'DejaVu Sans Mono';
@@ -1497,7 +1497,7 @@ abstract final class AppFont {
: [monoDefault, ..._monoFallbackDefault];
static List<String> get _monoFallbackDefault =>
- Platform.isMacOS ? _macMonoFallback : _linuxMonoFallback;
+ hasAppleFonts ? _macMonoFallback : _linuxMonoFallback;
static const List<String> _macMonoFallback = [
'Menlo',
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 7b47b517f..257abd14e 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1432,9 +1432,14 @@ class AppNotifier extends ChangeNotifier {
api = _newApiClient();
_skippedDesktopUpdateVersion = _store.skippedDesktopUpdateVersion;
}
- _startUpdateChecking();
- final environmentReady = await _prepareEnvironment();
- if (!environmentReady) return;
+ // A viewer installs nothing and is updated by its store: provisioning and the updater both
+ // serve a computer that runs the harness CLI. The updater is not merely useless there — it
+ // throws on an architecture it has no channel for (`ios_arm64`), from inside bootstrap.
+ if (viewer == null) {
+ _startUpdateChecking();
+ final environmentReady = await _prepareEnvironment();
+ if (!environmentReady) return;
+ }
await _continueAfterEnvironmentReady();
} catch (error, stack) {
debugPrint('bootstrap: fallback to login after error: $error\n$stack');
diff --git a/desktop/lib/terminal/terminal_font_store.dart b/desktop/lib/terminal/terminal_font_store.dart
index 637d3fb51..db623cce3 100644
--- a/desktop/lib/terminal/terminal_font_store.dart
+++ b/desktop/lib/terminal/terminal_font_store.dart
@@ -1,4 +1,4 @@
-import 'dart:io' show Platform;
+import '../core/apple_fonts.dart';
import 'package:flutter/foundation.dart';
import 'package:xterm/xterm.dart';
@@ -86,11 +86,11 @@ enum TerminalFontChoice {
/// at least ends every fallback at the generic `monospace`, which Windows
/// does resolve.
static List<TerminalFontChoice> get available =>
- Platform.isMacOS ? _macChoices : _linuxChoices;
+ hasAppleFonts ? _macChoices : _linuxChoices;
/// What a fresh install opens with, and what `reset()` returns to.
static TerminalFontChoice get defaultForPlatform =>
- Platform.isMacOS ? sfMono : dejaVuSansMono;
+ hasAppleFonts ? sfMono : dejaVuSansMono;
}
/// The user's chosen terminal typography (family + size), remembered across
diff --git a/desktop/lib/terminal/terminal_typography.dart b/desktop/lib/terminal/terminal_typography.dart
index debbc2f34..a60e6662f 100644
--- a/desktop/lib/terminal/terminal_typography.dart
+++ b/desktop/lib/terminal/terminal_typography.dart
@@ -1,4 +1,4 @@
-import 'dart:io' show Platform;
+import '../core/apple_fonts.dart';
/// The default terminal face, per platform.
///
@@ -69,10 +69,10 @@ const linuxTerminalFontFallback = <String>[
/// constants above stay `const` so `TerminalFontChoice` can still name them
/// from its const constructor.
String get terminalFontFamily =>
- Platform.isMacOS ? macTerminalFontFamily : linuxTerminalFontFamily;
+ hasAppleFonts ? macTerminalFontFamily : linuxTerminalFontFamily;
List<String> get terminalFontFallback =>
- Platform.isMacOS ? macTerminalFontFallback : linuxTerminalFontFallback;
+ hasAppleFonts ? macTerminalFontFallback : linuxTerminalFontFallback;
/// The default terminal font size — the same on every platform.
const terminalFontSize = 13.0;