Skip to content

UI: insert a screenshot of an open window - #605

Open
NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:cursor/insert-screenshot-d175
Open

NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:cursor/insert-screenshot-d175

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • On macOS, Insert ▸ Screenshot opens a gallery of open windows and a Screen Clipping item. Choosing one inserts the PNG with insert.picture.
  • Capture runs off the UI thread. If Screen Recording is off, the menu explains how to allow it in System Settings instead of inserting nothing.
  • The button stays disabled on Linux, Windows, and the web, where the host has no capturer. Pictures breadth moves from 48% to 50%; weighted breadth stays 79%.

Test plan

  • Kittest: the gallery inserts a window PNG, undo removes it, Screen Clipping inserts its PNG, a capture error shows in the menu and inserts nothing, and app.insertScreenshot with a title inserts that window.
  • Live on macOS: the Insert tab menu shows Screen Clipping, Available Windows, and the Screen Recording permission sentence. Starting Screen Clipping does not freeze the window; cancelling clears the status.
  • Insert a real window with Screen Recording allowed (not possible for the unsigned debug build used here).
  • cargo xtask ci is otherwise clean. The only failure is the pre-existing symbol_font_characters_draw_in_the_sym_font test (craft-fonts missing on that machine). Assets, layering, and the wasm32 check passed.

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…orytold#605)

Four squash merges in a row (storytold#450, storytold#414, storytold#451, storytold#351) each re-added the
same 206-line block from storytold#417 to crates/forms/src/tests.rs, so the crate's
tests no longer compiled (E0428: three test functions defined five times)
and main went red on every platform. Keep the first copy. The same merges
repeated one ROADMAP log line four times; keep one.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
* M14: clarify Ukrainian certificate and accessibility wording

Distinguish the certificate holder from the document topic, translate
fixed certificate types, and clarify fingerprints, keyboard access,
table sections and equal field sizes. Validate the complete catalog
with VESUM 6.8.6 and review technical-word exceptions in context.

Fixes storytold#503
Follow-up to storytold#509

Co-authored-by: Codex <noreply@openai.com>

* M14: restore CI after merged test changes

Keep one byte-identical copy of each appearance regression test instead
of five definitions, preserving all three test bodies and assertions.
Correct MCP resource parity evidence to the existing passing test name.

Co-authored-by: Codex <noreply@openai.com>

* ROADMAP: drop the CI follow-up sentence (main fixed the duplicated tests and MCP evidence in storytold#605/storytold#608)

---------

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Insert ▸ Screenshot on macOS lists open windows and offers Screen Clipping.
A click inserts the PNG with insert.picture. The button stays disabled on
Linux, Windows and the web, where the host has no capturer.

Co-authored-by: Cursor <cursoragent@cursor.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: Insert › Screenshot captures an open window. The lock gains a long run of new packages starting with aho-corasick, which the diff shows as new in the application's dependency tree, so the capture path brings a platform capture library and its dependencies. Capturing other windows reads the content of other programs on the user's screen, which on macOS needs the Screen Recording permission and on Wayland goes through the portal; the application must ask for it only when the user uses the command, must not keep the capture beyond the insert, and must say clearly when permission is missing. PowerPoint's Insert Screenshot lists open windows and offers Screen Clipping, so the oracle exists. I read the manifest hunks. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the missing feature The reference application has it and we do not, or only part of it label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

Changes needed:

Adds an Insert ▸ Screenshot gallery of open windows and Screen Clipping on macOS. The capture code avoids panics and handles a missing permission, but a few problems remain.

  • crates/ui-egui/src/ribbon.rs:1243: egui::Image::from_bytes needs an image loader to decode PNGs, and none is installed in the app, so the window thumbnails will probably show an error placeholder. Either decode the PNG and upload it with ctx.load_texture, or install a loader.
  • crates/ui-egui/src/menus.rs:242 and the command palette run app.insertScreenshot with no title. insert_screenshot in crates/ui-egui/src/lib.rs then calls the capture synchronously on the UI thread and inserts the front-most window without a choice. The entry is also enabled on Linux, Windows and the web, where it can only fail.
  • crates/ui-egui/src/ribbon.rs:1243: each menu open makes new bytes://window-shot/{generation}/{i} URIs and never forgets the old ones, so captures pile up in the image cache.
  • crates/ui-egui/src/lib.rs (logic): if the menu closes while a window capture is running, shot_rx is never polled. The app then repaints every 50 ms, and the 'Looking for windows…' status stays until the menu is opened again.
  • ROADMAP.md: the change adds a second 'Last reviewed' header and duplicate Feature breadth, Menu-bar coverage, SmartArt and Pictures rows with older numbers (79%, 33%, 50%). The log entries say Pictures 48% → 50%, but docs/parity-checklist.md now gives 60% → 62% and P2 56%. docs/target-app-parity.md also has the 48% → 50% / 39% wording.
  • apps/deckcraft/Cargo.toml: xcap adds a large set of transitive crates on macOS.

Claims checked:

  • contradicted: On macOS, Insert ▸ Screenshot opens a gallery of open windows and a Screen Clipping item; choosing one inserts the PNG with insert.picture (crates/ui-egui/src/ribbon.rs:1243 shows thumbnails with egui::Image::from_bytes, and no image loader is installed anywhere in the repository, so the thumbnails…
  • contradicted: Capture runs off the UI thread (The ribbon path spawns threads (ensure_window_shots and start_screen_clip in crates/ui-egui/src/lib.rs). But app.insertScreenshot, reached from crates/ui-egui/src/menus.rs:242 and the palette at menus.rs:151, calls capture() directly inside insert_screenshot.)
  • unverified: If Screen Recording is off, the menu explains how to allow it instead of inserting nothing (apps/deckcraft/src/screenshot.rs returns the PERMISSION text when the list is empty or screencapture reports a permission error. crates/ui-egui/src/ribbon.rs screenshot_menu shows the Err text in the menu.)
  • contradicted: The button stays disabled on Linux, Windows and the web (The ribbon button is disabled when no capturer is present (crates/ui-egui/src/ribbon.rs screenshot_button). The menu-bar item at crates/ui-egui/src/menus.rs:242 is enabled because ribbon.rs:43 enabled() returns true for any UI_COMMANDS id, an…
  • contradicted: Pictures breadth moves from 48% to 50%; weighted breadth stays 79% (docs/parity-checklist.md:28 gives Pictures 62% and :12 gives P2 56%. ROADMAP.md:18 still says 84% weighted, while the PR adds duplicate rows at ROADMAP.md:20 (79%) and :79-80 (SmartArt 33%, Pictures 50%).)
  • unverified: app.insertScreenshot with a title inserts that window (crates/ui-egui/src/lib.rs insert_screenshot matches the title exactly (ignoring case), then by substring, and inserts through insert_png.)

Recommendation: update the pull request; it will be reviewed again.

Reviewed at 4b7fc41.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing feature The reference application has it and we do not, or only part of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants