Bug 512183 - Wayland: clipboard sometimes ends up as application/x-kde-onlyReplaceEmpty after Spectacle full-screen 4K PNG
Summary: Wayland: clipboard sometimes ends up as application/x-kde-onlyReplaceEmpty af...
Status: REPORTED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard widget & pop-up (other bugs)
Version First Reported In: 6.5.2
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-16 11:26 UTC by Kirill
Modified: 2025-12-12 21:30 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
kwin-log portal-log wl-after wl-before pw.json (21.43 KB, application/gzip)
2025-11-16 11:26 UTC, Kirill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kirill 2025-11-16 11:26:56 UTC
Created attachment 186839 [details]
kwin-log portal-log wl-after wl-before pw.json

On Plasma Wayland (6.5.2) under openSUSE Tumbleweed with an NVIDIA GPU, copying a full-screen 4K screenshot from Spectacle to the clipboard intermittently breaks the Wayland clipboard pipeline.

After several full-screen captures, the clipboard stops exposing any image MIME types and instead contains only:

application/x-kde-onlyReplaceEmpty

At this point pasting images into browsers or applications fails, and all screenshot tools (including ksnip or Flameshot) can no longer place images into the clipboard. The issue persists until the portals are restarted:

systemctl --user restart xdg-desktop-portal xdg-desktop-portal-gtk

or the user logs out and back in.

Small region captures usually continue to work; the problem is strongly correlated with large 3840×2160 PNG screenshots produced by Spectacle.

Attached logs (wl-before.txt, wl-after.txt, portal-log.txt, kwin-log.txt, pw.json) show:

before the issue: normal clipboard types (image/png, application/x-qt-image, etc.);

after the issue: only application/x-kde-onlyReplaceEmpty;

portal and PipeWire warnings around the moment of failure;

KWin Wayland logs containing related errors.

This suggests a failure when the xdg-desktop-portal / Wayland clipboard stack processes Spectacle’s large PNG buffer, causing KDE’s clipboard to fall back to the internal placeholder MIME type.

I can run additional diagnostics or patches if needed.
Comment 1 mixzt 2025-11-17 18:41:39 UTC
I am experiencing similar issue on EndeavourOS KDE 6.5.2, AMD GPU, 125% fractional scaling. However the case seems a bit different: if copying screenshot to clipboard fails, other apps like Flameshot are not affected. Screenshots fail to copy to clipboard 95% of the time when I try to screenshot my desktop (all apps minimized). Small regions work most of the time.

Brief testing with wl-copy --list showed that Spectacle actually successfully copied the image to clipboard, but something replaced all MIME types with application/x-kde-onlyReplaceEmpty in about 0.5 seconds, leaving the clipboard empty. 

I couldn't find a fix but found a workaround: instead of letting Spectacle copy to the clipboard, I save the screenshot to a temporary PNG file and copy it manually with wl-copy. This completely avoids the issue:

#!/bin/bash
spectacle -r -b -o /tmp/screenshot.png
wl-copy --type image/png < /tmp/screenshot.png

I bound this script to Meta+Shift+S.
This way, clipboard image pasting works reliably in all applications.

I also experienced slight lags after taking big screenshots, and this was solved by switching clipboard manager to CopyQ.
Comment 2 Kirill 2025-11-18 13:25:37 UTC
Adding one more detail that may help diagnose the issue.
If I take a screenshot using Meta+Shift+S, Spectacle shows the “Unsaved Screenshot” window.
In this workflow, clipboard copying always works correctly — the clipboard keeps image/png and other valid image MIME types.
However, if I use the direct capture → auto-copy to clipboard workflow (PrintScreen → frame → copied immediately), the problem appears much more reliably: after one or several full-screen 4K screenshots the clipboard ends up containing only:

application/x-kde-onlyReplaceEmpty

and image pasting stops working in all applications until portals are restarted.
This suggests the issue is related specifically to the immediate-copy code path, not the interactive window path. It may be a timing/race problem when sending large 4K PNGs to xdg-desktop-portal-kde.
Hope this helps narrow it down.
Comment 3 David Redondo 2025-11-19 08:11:09 UTC
unrelated to portal