Support pasting Omarchy screenshots into terminals - #7422
Conversation
There was a problem hiding this comment.
Pull request overview
Adds file-backed screenshot clipboard representations for terminal, graphical, and file-aware applications.
Changes:
- Adds a GTK clipboard provider with multiple MIME representations.
- Stores copy-only screenshots in a content-addressed cache.
- Suppresses duplicate clipboard-history path entries and adds coverage.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
bin/omarchy-capture-screenshot |
Captures cached images and launches the provider. |
bin/omarchy-clipboard-publish-image |
Adds the provider command wrapper. |
shell/plugins/clipboard/publish-image.py |
Publishes image, path, URI, and marker payloads. |
shell/plugins/clipboard/capture.sh |
Suppresses duplicate history text entries. |
test/acceptance.d/screenshot-clipboard-test.sh |
Verifies Wayland clipboard behavior and lifecycle. |
test/shell.d/clipboard-publish-image-test.sh |
Tests provider payloads and runtime selection. |
test/shell.d/clipboard-test.sh |
Tests history suppression. |
test/shell.d/screenshot-clipboard-test.sh |
Tests screenshot publication and caching. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # File-backed screenshots expose their path for terminal paste. The image | ||
| # watcher records the same selection, so do not add a duplicate text entry. | ||
| grep -qx 'application/x-omarchy-file-backed-image' <<<"$types" || emit_text |
There was a problem hiding this comment.
Valid catch, fixed in 0a8f39c. Marked screenshot selections now persist fileBacked: true on the image history entry, preserve it through normalization and the display model, and restore through the multi-representation publisher. Ordinary image history entries still use image-only wl-copy, so the PR scope remains unchanged. I also centralized provider detachment/readiness in omarchy-clipboard-publish-image and added focused coverage for capture, metadata propagation, and both restoration paths.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
shell/plugins/clipboard/capture.sh:41
typesdescribes the clipboard selection that is current when this subprocess runs, not necessarily the selection whose image is arriving on stdin fromwl-paste --watch. If a screenshot is replaced quickly, this invocation can see the replacement's MIME list and omitfileBacked; the analogous check inemit_textcan then also record the screenshot path as a duplicate. The reverse ordering can mark/suppress an ordinary clipboard event. Associate the marker with the watched event itself rather than re-querying the mutable global selection, and add a rapid-replacement regression test.
grep -qx 'application/x-omarchy-file-backed-image' <<<"$types" && file_backed=true
Omarchy screenshots currently place only
image/pngon the clipboard. Graphical applications can paste the image, but terminals cannot request a usable file path.This mirrors the user-facing behavior of CleanShot X on macOS: a captured screenshot pastes as an image into graphical applications and as its backing file path into terminals.
Screenshots are now published as one clipboard selection with multiple representations:
image/pngfor graphical applicationstext/plainfor terminalstext/uri-listfor file-aware applicationsCopy-only screenshots are stored in a content-addressed cache under
$XDG_STATE_HOME/omarchy/clipboard-images. Saved screenshots use their existing file directly.The clipboard provider remains alive only while it owns the selection and exits through GDK native detach lifecycle when another application or screenshot replaces it. Clipboard history records the image while suppressing the duplicate generated path entry.
Why this approach
Related to #7187, but this keeps the existing
Super+Vbinding unchanged and limits the change to screenshots created by Omarchy.Rather than inspecting the clipboard during paste and synthesizing a different shortcut, each receiving application selects the representation it already understands:
This avoids focus and synthetic-key timing concerns while preserving normal text paste behavior.
Scope and limitations
This applies only to screenshots created by Omarchy because their backing files are known at capture time.
Images copied from browsers or other applications are not converted into file-backed clipboard entries. They still require
Ctrl+Vin terminals that support direct image paste.Making
Super+Vhandle arbitrary copied images would require the broader clipboard interception or conditional key-dispatch behavior discussed in #7187. That is intentionally outside this change.Tests
./test/clitest/shell.d/clipboard-publish-image-test.shtest/shell.d/screenshot-clipboard-test.shtest/shell.d/clipboard-test.shgit diff --checkSuper+Vpasted the backing path into a terminalCtrl+Vpasted the screenshot into a graphical applicationThe full
./test/shellrun completed with four unrelated local-environment failures: one bar geometry check and three checks requiring anomarchy-pkgscheckout.