Repository navigation
Copy untyped text as text/plain instead of a sniffed type - #90
Open
armandoclaudio wants to merge 1 commit into
Open
armandoclaudio wants to merge 1 commit into
armandoclaudio wants to merge 1 commit into
Conversation
ClipboardWriter's scripts pass ${1:+--type "$1"}, so calculator results,
emoji and other text copies go to wl-copy with no type, and wl-copy sniffs
stdin: "4" is offered only as application/octet-stream and "%PDF-1.4" only
as application/pdf, so neither pastes as text nor reaches Omarchy's
clipboard history. Default the type to text/plain; explicit types from
Clipboard History are unchanged.
armandoclaudio
force-pushed
the
fix/clipboard-text-type
branch
from
November 16, 2026 02:20
d1b236d to
7a22b06
Compare
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.
Copying a one-character value from the launcher, such as the calculator result of
2+2, leaves a clipboard entry that can't be pasted as text. The entry never shows up in Omarchy's clipboard history either.Cause
services/ClipboardWriter.qmlsends the value towl-copyon stdin with no--type, so wl-copy guesses the type from the bytes. A single character is guessed asapplication/octet-stream, and any value that starts like a file signature gets that file's type:Omarchy's clipboard history watches with
wl-paste --type text, so it skips these entries, and so does any app that asks for text.This came in with 5236a6f, which moved the value off the command line and onto stdin. That change is worth keeping. The old
wl-copy -- "$text"form always offered text types; only the type needs to be stated now.Fix
Since #85, both scripts take an optional MIME type in
$1and pass${1:+--type "$1"}. Calculator results, emoji and other text copies pass none, so they are still sniffed. This changes the default to--type "${1:-text/plain}": text with no stated type goes out astext/plain, and Clipboard History's explicit types (image/png,text/uri-list, ...) pass through unchanged. wl-copy adds the other text types itself (text/plain;charset=utf-8,UTF8_STRING,TEXT,STRING), so non-ASCII results such as€92.50still paste correctly. The privacy test now also checks that a copy with no type goes out astext/plain.Testing
node --test tests/*.test.js: 184 passing, 3 skipped. The new assertion fails without the fix.omarchy plugin validate .passes.copyScriptrun by hand against the real wl-copy:4with no type offerstext/plain,UTF8_STRING, etc. (barewl-copygivesapplication/octet-stream), andtext/uri-liststaystext/uri-list.Rebased onto main after #85 and #72 landed; the earlier version of this PR predated them.
Omarchy 4.5.0-3, wl-clipboard 2.3.0