Skip to content

native2: background paste preparation and file-dialog path entry (#143) - #167

Merged
iamnbutler merged 3 commits into
mainfrom
finder-paste
Oct 20, 2026
Merged

iamnbutler merged 3 commits into
mainfrom
finder-paste

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Closes two native2 tool gaps from native2/CUTOVER.md.

Background paste preparation. native2's background Command-V landed only when the target app was already active. #99 passed earlier only because TextEdit happened to be frontmost, and the #114 Finder paste ended unknown with the clipboard replaced. A paste into an inactive app now prepares the exact window the way Peekaboo does:

  • a SkyLight SLPSPostEventRecordTo activation record;
  • a window-routed click on blank title-bar chrome (Peekaboo's chrome geometry, confirmed with an AX hit test on the window itself);
  • then the keys.

A window whose title row has no blank chrome (Finder's toolbar) is refused before any input, with a desktop_focus hint and the clipboard restored. The shipped stack refuses an inactive Finder too. live-check #114 now focuses Finder first, which Node's foreground desktop_open did implicitly.

desktop_dialog_answer path. Ported from Peekaboo's DialogService+FileDialogPath:

  • focus the panel;
  • expand a collapsed Save panel;
  • set its PathTextField, or use Go to Folder (Command-Shift-G, set or type the path, Return);
  • set a Save panel's name;
  • read the folder and name back.

The panel's focus check accepts a sheet, or Go to Folder's sheet within it, holding focus.

Live (standalone native2 host and MCP, --server):

  • live-check --only 70,77,81,82,83,86,89,92,96,99,107,110,111,114 passes all 26 checks twice. feat: paste an image or files into a native text area with desktop_insert, or leave the clipboard replaced on request #99 passes with Finder frontmost, so the paste is a real background paste.
  • TextEdit "Export as PDF…" Save sheet: the path went in through Go to Folder and the name read back. The outcome was unknown, because this macOS's Save sheet has no PathTextField to read the folder back from (same logic as shipped). The panel was then cancelled. A standalone Open panel is refused, as on the shipped stack. Both are recorded under "Limits both stacks share" in CUTOVER.md.

Tests: native2 RuntimeTests (+ DialogPathTests) and CoreTests pass.

Pastes into an inactive app first make its window key with a SkyLight activation
record and a routed title-bar click, as Peekaboo does; desktop_dialog_answer path
enters a folder and name in an Open or Save panel.

Why: native2/Sources/DesktopMac/BackgroundPreparation.swift | TextEdit and Finder drop a background Command-V unless the window is key; #99 passed earlier only because TextEdit happened to be frontmost
Why: native2/Sources/DesktopMac/Dialogs.swift | a sheet (and Go to Folder inside it) holds keyboard focus itself, so the focused window can be a sheet inside the dialog's window
@iamnbutler
iamnbutler merged commit e34b2ff into main Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant