3d739c3bfc
Omarchy's Super+C sends Ctrl+C by setting the modifier state with no Ctrl key event while Super is held. Flutter's web engine only presses a modifier on its own key event, so the app saw a plain "c": the chat selection was not copied and the terminal typed the letter. A key modifier sync in front of the framework's key handler now presses the modifiers the browser event's flags hold (and outside Apple platforms lets go of a held Meta for Ctrl+C/V/X/A/ Insert), installed by the app's binding. The terminal copies a selection on Ctrl+C without sending ^C, treats the injected copy key as copy only, and pastes on Shift+Insert. A refused clipboard write or read now shows a message instead of failing silently. Server: before the login completes, Ctrl+C and Ctrl+\ erase the typed password (Ctrl+U) and Ctrl+Z is dropped, so su is not killed and the terminal no longer ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
2.7 KiB
Dart
86 lines
2.7 KiB
Dart
import '../ui/adaptive/window_margins.dart';
|
|
import '../ui/theme/app_font_controller.dart';
|
|
import '../ui/theme/app_theme.dart';
|
|
import '../ui/scale/ui_scale.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'clipboard_failures.dart';
|
|
|
|
import '../shell/adaptive_shell.dart';
|
|
import '../shell/destination.dart';
|
|
|
|
/// The injectable application shell. Composition supplies the live feature
|
|
/// bodies and, when it owns a route, the selected destination; widget tests
|
|
/// can continue to pass a small map or no bodies at all.
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({
|
|
super.key,
|
|
this.destinationBodies = const {},
|
|
this.destination,
|
|
this.onDestinationSelected,
|
|
this.fonts,
|
|
}) : routerConfig = null;
|
|
|
|
/// A host for a [Router]-owned location, so browser Back/Forward and deep
|
|
/// links use Flutter's multi-entry web history instead of a second, competing
|
|
/// history implementation.
|
|
const MyApp.router({
|
|
super.key,
|
|
required RouterConfig<Object> this.routerConfig,
|
|
this.fonts,
|
|
}) : destinationBodies = const {},
|
|
destination = null,
|
|
onDestinationSelected = null;
|
|
|
|
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
|
|
|
final AppDestination? destination;
|
|
final ValueChanged<AppDestination>? onDestinationSelected;
|
|
final RouterConfig<Object>? routerConfig;
|
|
|
|
/// The device's interface font; defaults to the app's shared controller.
|
|
/// A change rebuilds the themes in place, without a restart.
|
|
final AppFontController? fonts;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final fonts = this.fonts ?? AppFontController.instance;
|
|
return ListenableBuilder(
|
|
listenable: fonts,
|
|
builder: (context, _) => _host(fonts.family),
|
|
);
|
|
}
|
|
|
|
Widget _host(String? fontFamily) {
|
|
final router = routerConfig;
|
|
if (router != null) {
|
|
return MaterialApp.router(
|
|
title: 'Pipelines',
|
|
scaffoldMessengerKey: appScaffoldMessengerKey,
|
|
builder: _scaled,
|
|
theme: appLightTheme(fontFamily: fontFamily),
|
|
darkTheme: appDarkTheme(fontFamily: fontFamily),
|
|
themeMode: ThemeMode.system,
|
|
routerConfig: router,
|
|
);
|
|
}
|
|
return MaterialApp(
|
|
title: 'Pipelines',
|
|
scaffoldMessengerKey: appScaffoldMessengerKey,
|
|
builder: _scaled,
|
|
theme: appLightTheme(fontFamily: fontFamily),
|
|
darkTheme: appDarkTheme(fontFamily: fontFamily),
|
|
themeMode: ThemeMode.system,
|
|
home: AdaptiveShell(
|
|
destinationBodies: destinationBodies,
|
|
destination: destination,
|
|
onDestinationSelected: onDestinationSelected,
|
|
),
|
|
);
|
|
}
|
|
|
|
static Widget _scaled(BuildContext context, Widget? child) => UiScaleHost(
|
|
child: WindowMargins(child: child ?? const SizedBox.shrink()),
|
|
);
|
|
}
|