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>
39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
import 'package:flutter/services.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import '../core/keyboard/key_modifier_sync.dart';
|
|
import 'clipboard_failures.dart';
|
|
|
|
/// The app's binding: Flutter's, with clipboard failures reported
|
|
/// ([ClipboardReportingMessenger]) and, on the web, key events carrying the
|
|
/// modifiers their browser events hold ([KeyModifierSync]).
|
|
///
|
|
/// An entry point calls [ensureInitialized] before anything else creates a
|
|
/// binding.
|
|
class PipelinesBinding extends WidgetsFlutterBinding {
|
|
PipelinesBinding._();
|
|
|
|
static bool _created = false;
|
|
|
|
/// The binding, created on the first call.
|
|
static WidgetsBinding ensureInitialized() {
|
|
if (!_created) {
|
|
_created = true;
|
|
PipelinesBinding._();
|
|
}
|
|
return WidgetsBinding.instance;
|
|
}
|
|
|
|
@override
|
|
void initInstances() {
|
|
super.initInstances();
|
|
// The services binding hands key data to the framework only once the
|
|
// keyboard state is synced; the modifier sync goes in front of it then.
|
|
keyboard.syncKeyboardState().then((_) => installKeyModifierSync());
|
|
}
|
|
|
|
@override
|
|
BinaryMessenger createBinaryMessenger() =>
|
|
ClipboardReportingMessenger(super.createBinaryMessenger());
|
|
}
|