Skip to content

Copy clipboard history text as text/plain - #15137

Closed
omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-12662
Closed

omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-12662

Conversation

@omarchybot

@omarchybot omarchybot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Restoring a text entry from clipboard history (Enter or Shift+Enter in Super+Ctrl+V) runs omarchy-clipboard-paste-text, which piped the text to wl-copy without a type. Untyped, wl-copy asks xdg-mime to sniff the bytes, and file classifies some valid UTF-8 text as binary: two spaces, a Cyrillic word and a newline come back as application/x-dtsz. The restored selection then offers only that type, so wl-paste --type text and every text paste consumer refuse it, though the entry is still in history and was stored as text.

Both copies in the helper — the history entry by index, and text given as an argument — now pass --type "text/plain;charset=utf-8", the spelling the open #14688 and #14760 use for their text copies. With a text type, wl-copy also offers text/plain, TEXT, STRING and UTF8_STRING. The history path already refuses anything but a text entry, and capture stores text decoded into JSON strings, so labelling it UTF-8 is accurate. Entries shown as files are stored text too and were never restored as text/uri-list, so nothing about them changes.

On an Omarchy worker in a real Wayland session (wl-clipboard 2.3.0, file 5.48), the helper on quattro offered only application/x-dtsz on both paths and the text read exited 1; with this change both offer the text types and paste back the exact bytes. clipboard-test.sh now records the arguments its wl-copy stub receives and checks both paths pass the type; it fails with the change reverted.

Reviewed by Codex Medium, which found nothing to change.

Fixes #12662

Untyped, wl-copy asks xdg-mime to sniff the bytes, and some valid UTF-8 text (two spaces and a Cyrillic word) comes back as application/x-dtsz, so the restored entry offers no text type and text paste fails.

Fixes #12662

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

omarchy-clipboard-paste-text now copies text with an explicit text/plain;charset=utf-8 type, so content sniffing cannot label restored text as binary.

  • The clipboard helper labels copied text as UTF-8 text.

Reviews (1) · Last reviewed commit: "Copy clipboard history text as text/plai..." · Reviewed by Greptile

@jandrusk

Copy link
Copy Markdown

Same fix as open #12801 (wl-copy --type text/plain… in omarchy-clipboard-paste-text), and kin to #14688 for OCR. Please close one as duplicate of the other so we don’t land it twice.

@omarchybot omarchybot added the bug Something isn't working label Oct 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator Author

Closing this as a duplicate of #12801, which was opened earlier against quattro and makes the same fix.

The change to bin/omarchy-clipboard-paste-text is identical in both, byte for byte: the history-entry copy and the direct-text copy each pass --type "text/plain;charset=utf-8" to wl-copy, so content sniffing can no longer label text such as Тест\n as application/x-dtsz. Both fix #12662, and both extend test/shell.d/clipboard-test.sh to record the stub's wl-copy arguments and assert the type on both paths; this one adds nothing #12801 does not already cover. #12801 is already reproduced on a worker and labelled verified, so the older one keeps the fix. Thanks to @jandrusk for pointing out the overlap.

Checked by Claude Opus 5.5 comparing the two diffs; the classification as a bug was agreed by Codex Medium, and omabot close-duplicate asked Codex Medium separately whether the two make the same change. If this turns out not to be the same change, it can be reopened.

@omarchybot omarchybot added the duplicate This issue or pull request already exists label Oct 17, 2026
@omarchybot omarchybot closed this Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clipboard history: valid UTF-8 text is restored with a binary MIME type and cannot be pasted

2 participants