Description
Copying a selection where the content contains [Desktop Entry] fails with no error, status bar says "copied", but nothing shows up in the system clipboard. Everything else in the same buffer copies fine. It's specific to that exact line/content.
Root cause
It's wl-copy's MIME auto-detection. When invoked without --type, wl-copy sniffs the content and if it has [Desktop Entry], it decides this is a .desktop file and advertises the clipboard offer as application/x-desktop only, no text/plain alongside it.
Since basically every other app (and wl-paste by default) requests text/plain, they get nothing, because the clipboard owner isn't offering that format at all.
You can confirm this by pulling the raw type:
wl-paste --type application/x-desktop
which returns the content just fine.
Fix
IMO, micro should invoke wl-copy --type text/plain by default when copying buffer text to the system clipboard, instead of relying on wl-copy's content sniffing. The editor knows the content is text; it shouldn't leave MIME-type inference up to a heuristic that can silently produce a non-text-only offer. This would avoid this failure mode entirely (and any other content wl-copy might auto-classify as something other than plain text).
Environment
- Version: 2.0.15
- OS: CachyOS
- Terminal: Konsole
Description
Copying a selection where the content contains
[Desktop Entry]fails with no error, status bar says "copied", but nothing shows up in the system clipboard. Everything else in the same buffer copies fine. It's specific to that exact line/content.Root cause
It's
wl-copy's MIME auto-detection. When invoked without--type, wl-copy sniffs the content and if it has[Desktop Entry], it decides this is a.desktopfile and advertises the clipboard offer asapplication/x-desktoponly, notext/plainalongside it.Since basically every other app (and
wl-pasteby default) requeststext/plain, they get nothing, because the clipboard owner isn't offering that format at all.You can confirm this by pulling the raw type:
which returns the content just fine.
Fix
IMO, micro should invoke
wl-copy --type text/plainby default when copying buffer text to the system clipboard, instead of relying on wl-copy's content sniffing. The editor knows the content is text; it shouldn't leave MIME-type inference up to a heuristic that can silently produce a non-text-only offer. This would avoid this failure mode entirely (and any other content wl-copy might auto-classify as something other than plain text).Environment