Copy and paste: the desktop's universal copy key works; Ctrl+C at the terminal login keeps the terminal

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>
This commit is contained in:
2026-11-29 17:57:28 +00:00
parent 58041e06b7
commit 3d739c3bfc
31 changed files with 2090 additions and 17 deletions
+19
View File
@@ -27,6 +27,7 @@ steps: open=<route>[@WxH] wait=<ms> shot=<name> click=<target> waitfor=<target
type=<text> press=<Enter|Escape|Tab|...> scroll=<dy> size=WxH
files=<path>[,<path>] (answers the next file chooser)
film=<target> labels=<name> tabs=<name> eval=<js> expect=<js> hover=<target>
keys=<json events> grant=clipboard
rightclick=<target> (secondary button: context menus)
drag=<target>><dx>,<dy> (JSON: drag, dx, dy, steps, gap, hold)
swipe=<target>><dx>,<dy> pinch=<target>><scale> (with --touch true)
@@ -127,6 +128,24 @@ try {
case 'type': await page.type(String(value)); await delay(step.wait ?? settle); break;
case 'compose': await page.compose(String(value)); await delay(step.wait ?? settle); break;
case 'press': await page.press(String(value)); await delay(step.wait ?? settle); break;
case 'keys': {
// Raw key events (Input.dispatchKeyEvent params), each optionally
// `after` ms after the previous: modifier flags without their key
// events, as a compositor's injected shortcut sends them.
for (const { after = 0, ...event } of Array.isArray(value) ? value : JSON.parse(String(value))) {
if (after) await delay(after);
await browser.send('Input.dispatchKeyEvent', event);
}
await delay(step.wait ?? settle);
break;
}
case 'grant': {
// `grant=clipboard` lets the page read and write the clipboard.
const origin = new URL(await page.evaluate('location.href')).origin;
const permissions = value === 'clipboard' ? ['clipboardReadWrite', 'clipboardSanitizedWrite'] : String(value).split(',');
await browser.sendBrowser('Browser.grantPermissions', { origin, permissions });
break;
}
case 'scroll': {
const at = await page.scroll(Number(value), step.at, { dx: Number(step.dx ?? 0), repeat: Number(step.repeat ?? 1), gap: Number(step.gap ?? 16) });
log(` wheel at ${Math.round(at.x)},${Math.round(at.y)}`);