feat(ui): save a screenshot with the 's' hotkey - #133
Merged
Conversation
Pressing 's' anywhere in the browser tab (outside a text input, and not combined with Ctrl/Cmd/Alt so the browser's own Save-Page-As still works) saves a PNG of the current view, named swift-YYYY-MM-DD_HH-MM-SS.png -- the same download mechanism env.screenshot() already uses, just triggered client-side. Extracted saveScreenshot()/the new timestamp helper out of main.js into their own screenshot.js module, matching how ui.js/comms.js are already split out for unit testing -- main.js itself has DOM/WebGL side effects at import time that make it untestable directly under node:test.
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sanywhere in the browser tab (outside a text input) saves a PNG of the current view, namedswift-YYYY-MM-DD_HH-MM-SS.pngenv.screenshot()already uses (canvas → dataURL → synthetic<a download>click), just triggered client-side with no Python round-tripsaveScreenshot()and the new timestamp helper out ofmain.jsinto their ownscreenshot.jsmodule, matching howui.js/comms.jsare already split out for unit testing undernode --test—main.jsitself has DOM/WebGL side effects at import time that make it untestable directlyREADME.mdanddocs/source/intro.rst's "Playback controls" sections, alongside the existing spacebar/speed-selector bulletsTest plan
node --test src/swift/public/js/*.test.js— newscreenshot.test.jscovers the timestamp format and the download-link wiringpytest— no regressions (one pre-existing, unrelated failure:test_add_path_sends_points_radius_and_linewidth, caused by the installedspatialgeometryPyPI release lagging behind an unreleasedPolylinerename)s, confirm aswift-<timestamp>.pngdownloads🤖 Generated with Claude Code