Bug 512178 - Wayland: Spectacle sometimes copies empty clipboard instead of image on 4K NVIDIA setup
Summary: Wayland: Spectacle sometimes copies empty clipboard instead of image on 4K NV...
Status: REPORTED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 6.5.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-16 10:10 UTC by Kirill
Modified: 2026-01-03 11:04 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kirill 2025-11-16 10:10:50 UTC
Description:
I am experiencing a reproducible issue with Spectacle on Plasma 6 (Wayland) when copying full-screen 4K screenshots to the clipboard.

When Spectacle copies a full-screen 4K PNG image to the clipboard, the Wayland clipboard stack breaks:

- `wl-paste --list-types` stops showing any image/* types and returns only text/plain
- applications (browsers, chat clients, editors) can no longer paste images from the clipboard
- other screenshot tools (e.g. ksnip) fail or crash with messages like “No image was available but one was expected”
- only restarting the portals or the whole Wayland session restores clipboard functionality

This happens reliably with full-screen screenshots on a 3840x2160 display. Smaller region screenshots usually work and do not corrupt the clipboard.

It looks like Spectacle is pushing a very large, raw PNG into the Wayland portals / clipboard (via xdg-desktop-portal), which then fail in some way. Other tools such as Flameshot, which seem to optimize or compress their clipboard images, do not trigger this issue under the same conditions.

Steps to reproduce:
1. Start a Plasma 6.5.2 Wayland session on a 3840x2160 (4K) display.
2. Launch Spectacle.
3. Capture a full-screen screenshot (mode: Full Screen).
4. Click “Copy to Clipboard”.
5. Immediately run:
   `wl-paste --list-types`
6. Try pasting the screenshot into any application (e.g. browser, chat, editor).

Expected result:
- Spectacle should place an image into the Wayland clipboard (image/png, application/x-qt-image, etc.).
- Pasting into applications should work normally.
- `wl-paste --list-types` should list at least `image/png` and/or `application/x-qt-image`.

Actual result:
- After copying a full-screen 4K screenshot from Spectacle, the clipboard appears to become corrupted.
- `wl-paste --list-types` shows only text/* types, no image/* types.
- Applications cannot paste images anymore.
- Clipboard functionality is only restored after restarting the portals or logging out and back in.

Environment / System information:
- Distribution: openSUSE Tumbleweed (x86_64)
- OS: openSUSE Tumbleweed x86_64
- Kernel: 6.17.7-1-default
- DE: Plasma 6.5.2 [KF 6.19.0] [Qt 6.10.0] (Wayland)
- WM: kwin_wayland_wr
- Resolution: 3840x2160 (4K)
- GPU: NVIDIA GeForce GTX 1050 Ti
- NVIDIA driver version: 580.105.08
- PipeWire and portals enabled

Command outputs:

spectacle --version:
--------------------------------
$ spectacle --version
spectacle 6.5.2
QThreadStorage: entry 3 destroyed before end of thread 0x55bfe99a5c60
QThreadStorage: entry 2 destroyed before end of thread 0x55bfe99a5c60

plasmashell --version:
--------------------------------
$ plasmashell --version
plasmashell 6.5.2
QThreadStorage: entry 8 destroyed before end of thread 0x55aed60268b0
QThreadStorage: entry 2 destroyed before end of thread 0x55aed60268b0
QThreadStorage: entry 1 destroyed before end of thread 0x55aed60268b0

kwin_wayland --version:
--------------------------------
$ kwin_wayland --version
kwin 6.5.2
QThreadStorage: entry 1 destroyed before end of thread 0x5583946cf0b0
QThreadStorage: entry 0 destroyed before end of thread 0x5583946cf0b0

neofetch:
--------------------------------
$ neofetch
OS: openSUSE Tumbleweed x86_64
Host: TH67B 6.0
Kernel: 6.17.7-1-default
Uptime: 1 hour, 17 mins
Packages: 50 (pip), 2836 (rpm), 16 (flatpak-system)
Shell: bash 5.3.3
Resolution: 3840x2160
DE: Plasma 6.5.2 [KF 6.19.0] [Qt 6.10.0] (wayland)
WM: kwin_wayland_wr
Theme: Breeze [GTK2/3]
Icons: breeze [GTK2/3]
Cursor: breeze_cursors [GTK2/3]
Terminal: konsole
CPU: Intel Core i5-2310 (4) @ 3.2GHz
GPU: NVIDIA GeForce GTX 1050 Ti
Memory: 5.97 GiB / 23.45 GiB

Portal status (after restart, before taking screenshot):
--------------------------------
$ systemctl --user status xdg-desktop-portal xdg-desktop-portal-gtk --no-pager

● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Sun 2025-11-16 12:51:02 MSK; 26s ago
   Main PID: 7362 (xdg-desktop-por)
      Tasks: 7 (limit: 28655)
        CPU: 65ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─7362 /usr/libexec/xdg-desktop-portal

● xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gtk.service; static)
     Active: active (running) since Sun 2025-11-16 12:51:02 MSK; 26s ago
   Main PID: 7366 (xdg-desktop-por)
      Tasks: 6 (limit: 28655)
        CPU: 104ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gtk.service
             └─7366 /usr/libexec/xdg-desktop-portal-gtk

Note: there is no xdg-desktop-portal-kde systemd unit, but there is a running xdg-desktop-portal-kde process shown by nvidia-smi (PID 7373, /usr/libexec/xdg-desktop-portal-kde).

Portal logs (excerpt):
--------------------------------
$ journalctl --user -u xdg-desktop-portal -u xdg-desktop-portal-gtk --no-pager | tail -n 40

Nov 16 11:33:23 localhost.localdomain systemd[1353]: Starting Portal service...
Nov 16 11:33:30 localhost.localdomain systemd[1353]: Starting Portal service (GTK/GNOME implementation)...
Nov 16 11:33:31 localhost.localdomain systemd[1353]: Started Portal service (GTK/GNOME implementation).
Nov 16 11:33:31 localhost.localdomain systemd[1353]: Started Portal service.
Nov 16 11:33:35 localhost.localdomain /usr/libexec/xdg-desktop-portal[1482]: A backend call failed: No such method 'CreateMonitor' in interface 'org.freedesktop.impl.portal.Inhibit' at object path '/org/freedesktop/portal/desktop' (signature 'ooss')
Nov 16 11:33:35 localhost.localdomain /usr/libexec/xdg-desktop-portal[1482]: Failed to close session implementation: GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/portal/desktop/session/1_70/tdesktop1141742856'
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Stopping Portal service...
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Stopped Portal service.
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Starting Portal service...
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Stopping Portal service (GTK/GNOME implementation)...
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Stopped Portal service (GTK/GNOME implementation).
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Starting Portal service (GTK/GNOME implementation)...
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Started Portal service (GTK/GNOME implementation).
Nov 16 12:51:02 localhost.localdomain systemd[1353]: Started Portal service.

KWin logs (excerpt):
--------------------------------
$ journalctl --user -u plasma-kwin_wayland --no-pager | tail -n 40

Nov 16 11:33:23 localhost.localdomain systemd[1353]: Starting KDE Window Manager...
Nov 16 11:33:23 localhost.localdomain systemd[1353]: Started KDE Window Manager.
Nov 16 11:33:24 localhost.localdomain kwin_wayland[1475]: No backend specified, automatically choosing drm
...
Nov 16 11:54:47 localhost.localdomain kwin_wayland_wrapper[1563]: Key repeat discarded, Wayland compositor doesn't seem to be processing events fast enough!
Nov 16 12:42:09 localhost.localdomain kwin_wayland[1475]: QDBusConnection: couldn't handle call to Teardown, no slot matched
Nov 16 12:42:09 localhost.localdomain kwin_wayland[1475]: QDBusConnection: couldn't handle call to Teardown, no slot matched
Nov 16 12:42:09 localhost.localdomain kwin_wayland[1475]: Could not find slot Krunner1Adaptor::Teardown

NVIDIA driver info:
--------------------------------
$ nvidia-smi
Sun Nov 16 12:52:09 2025
NVIDIA-SMI 580.105.08             Driver Version: 580.105.08     CUDA Version: 13.0
GPU  Name                 Persistence-M | Bus-Id          Disp.A
0  NVIDIA GeForce GTX 1050 Ti     On  |   00000000:04:00.0  On

Processes include:
  /usr/bin/kwin_wayland
  /usr/bin/plasmashell
  /usr/bin/spectacle
  /usr/libexec/xdg-desktop-portal-kde

$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  580.105.08  Wed Oct 29 23:15:11 UTC 2025
GCC version:  gcc version 15.2.1 20251006 (SUSE Linux)

Clipboard MIME types AFTER Spectacle full-screen “Copy to Clipboard”:
--------------------------------
$ wl-paste --list-types
text/plain;charset=utf-8
UTF8_STRING
COMPOUND_TEXT
TEXT
text/plain
STRING
text/plain;charset=utf-8
text/plain
SAVE_TARGETS

Note: at this point, no image/* types are present. Before the failure (with small region screenshots), the output included image/png, application/x-qt-image, x-kde-force-image-copy, etc.

Conclusion / suspicion:
It looks like Spectacle is sending a very large full-screen 4K PNG buffer via the portal/clipboard, which in this configuration (Plasma 6.5.2 Wayland, NVIDIA 580.105.08, 4K display) consistently breaks the Wayland clipboard/portal. Smaller screenshots and other tools (e.g. Flameshot) do not cause this issue.

A possible mitigation would be:
- allow choosing JPEG for clipboard export on Wayland, or
- optimize/compress PNG before placing it on the clipboard, or
- otherwise avoid pushing huge raw image buffers through xdg-desktop-portal.

Thank you for looking into this.
Comment 1 Kirill 2025-11-16 10:47:01 UTC
Additional observation about the broken clipboard state:

After some more testing, I noticed that when the issue happens, the clipboard
sometimes ends up with a single KDE-specific placeholder MIME type:

    wl-paste --list-types
    application/x-kde-onlyReplaceEmpty

From what I understand, `application/x-kde-onlyReplaceEmpty` is an internal
KDE MIME type that is only used when the clipboard source is empty or invalid.
In this broken state:

- there is no image/* MIME type at all;
- pasting an image fails in all apps (ChatGPT, browsers, editors, etc.);
- other screenshot tools (e.g. ksnip) also cannot paste anything from the clipboard;
- restarting xdg-desktop-portal / xdg-desktop-portal-gtk fixes the clipboard
  until the next full-screen screenshot from Spectacle.

This suggests that the Wayland portal (xdg-desktop-portal / xdg-desktop-portal-gtk
/ xdg-desktop-portal-kde) is returning an invalid clipboard object after a
large full-screen PNG from Spectacle, and KDE falls back to this
`application/x-kde-onlyReplaceEmpty` pseudo-type.

If needed, I can provide logs from:

  journalctl --user -u xdg-desktop-portal -u xdg-desktop-portal-gtk \
             -u plasma-xdg-desktop-portal-kde

collected just after the problem occurs.
Comment 2 Kirill 2025-11-16 10:48:13 UTC
Additional observation about the broken clipboard state:

After some more testing, I noticed that when the issue happens, the clipboard
sometimes ends up with a single KDE-specific placeholder MIME type:

    wl-paste --list-types
    application/x-kde-onlyReplaceEmpty

From what I understand, `application/x-kde-onlyReplaceEmpty` is an internal
KDE MIME type that is only used when the clipboard source is empty or invalid.
In this broken state:

- there is no image/* MIME type at all;
- pasting an image fails in all apps (ChatGPT, browsers, editors, etc.);
- other screenshot tools (e.g. ksnip) also cannot paste anything from the clipboard;
- restarting xdg-desktop-portal / xdg-desktop-portal-gtk fixes the clipboard
  until the next full-screen screenshot from Spectacle.

This suggests that the Wayland portal (xdg-desktop-portal / xdg-desktop-portal-gtk
/ xdg-desktop-portal-kde) is returning an invalid clipboard object after a
large full-screen PNG from Spectacle, and KDE falls back to this
`application/x-kde-onlyReplaceEmpty` pseudo-type.

If needed, I can provide logs from:

  journalctl --user -u xdg-desktop-portal -u xdg-desktop-portal-gtk \
             -u plasma-xdg-desktop-portal-kde

collected just after the problem occurs.
Comment 3 Cameron Smith 2025-12-25 01:33:11 UTC
I can reproduce something like this, but I'm running an Intel/Intel system. When using spectacle to take a screenshot I select "copy". If I then try to paste this into dolphin (or discord, or most other apps which can have data uploaded to them) it will sometimes fail. Dolphin will show "Cannot paste: The clipboard is empty", discord will just not paste anything. However, if I open the clipboard history with meta+v, I can see a preview of the image.

Dragging and dropping this image from the clipboard window has mixed results between apps, sometimes dropping the image perfectly, sometimes dropping a file named something long like "4fce59a4759f3f4b011a5cb98be155b5698773a8" (which can't be viewed in Discord). After downloading this file, I can display it in Gwenview, but I'm sure this isn't intended functionality.

An annoying element of this bug is that I can't seem to reproduce it consistently. Indeed, sometimes after waiting several minutes the file on the clipboard *can* be pasted. I don't think this is an issue with old hardware, as it happens on both my T480s laptop and my desktop PC.

Plasma 6.5.4
Frameworks 6.21.0
Qt 6.10.1
Kernel 6.18.1-arch1-2
Wayland
Arch Linux

Intel/Intel system, iGPU
Comment 4 Mika Westphal 2025-12-25 19:42:08 UTC
(In reply to Cameron Smith from comment #3)
> I can reproduce something like this, but I'm running an Intel/Intel system.
> When using spectacle to take a screenshot I select "copy". If I then try to
> paste this into dolphin (or discord, or most other apps which can have data
> uploaded to them) it will sometimes fail. Dolphin will show "Cannot paste:
> The clipboard is empty", discord will just not paste anything. However, if I
> open the clipboard history with meta+v, I can see a preview of the image.
> 
> Dragging and dropping this image from the clipboard window has mixed results
> between apps, sometimes dropping the image perfectly, sometimes dropping a
> file named something long like "4fce59a4759f3f4b011a5cb98be155b5698773a8"
> (which can't be viewed in Discord). After downloading this file, I can
> display it in Gwenview, but I'm sure this isn't intended functionality.
> 
> An annoying element of this bug is that I can't seem to reproduce it
> consistently. Indeed, sometimes after waiting several minutes the file on
> the clipboard *can* be pasted. I don't think this is an issue with old
> hardware, as it happens on both my T480s laptop and my desktop PC.
> 
> Plasma 6.5.4
> Frameworks 6.21.0
> Qt 6.10.1
> Kernel 6.18.1-arch1-2
> Wayland
> Arch Linux
> 
> Intel/Intel system, iGPU

I can confirm that on my AMD system
Arch Linux
Wayland
Kernel 6.18.2-arch2-1
KDE Plasma 6.5.4
CPU: AMD Ryzen 7 5800X (16) @ 4.85 
GPU: AMD Radeon RX 7900 XTX [Discrete]
Comment 5 Mika Westphal 2025-12-26 21:32:47 UTC
(In reply to Mika Westphal from comment #4)
> (In reply to Cameron Smith from comment #3)
> > I can reproduce something like this, but I'm running an Intel/Intel system.
> > When using spectacle to take a screenshot I select "copy". If I then try to
> > paste this into dolphin (or discord, or most other apps which can have data
> > uploaded to them) it will sometimes fail. Dolphin will show "Cannot paste:
> > The clipboard is empty", discord will just not paste anything. However, if I
> > open the clipboard history with meta+v, I can see a preview of the image.
> > 
> > Dragging and dropping this image from the clipboard window has mixed results
> > between apps, sometimes dropping the image perfectly, sometimes dropping a
> > file named something long like "4fce59a4759f3f4b011a5cb98be155b5698773a8"
> > (which can't be viewed in Discord). After downloading this file, I can
> > display it in Gwenview, but I'm sure this isn't intended functionality.
> > 
> > An annoying element of this bug is that I can't seem to reproduce it
> > consistently. Indeed, sometimes after waiting several minutes the file on
> > the clipboard *can* be pasted. I don't think this is an issue with old
> > hardware, as it happens on both my T480s laptop and my desktop PC.
> > 
> > Plasma 6.5.4
> > Frameworks 6.21.0
> > Qt 6.10.1
> > Kernel 6.18.1-arch1-2
> > Wayland
> > Arch Linux
> > 
> > Intel/Intel system, iGPU
> 
> I can confirm that on my AMD system
> Arch Linux
> Wayland
> Kernel 6.18.2-arch2-1
> KDE Plasma 6.5.4
> CPU: AMD Ryzen 7 5800X (16) @ 4.85 
> GPU: AMD Radeon RX 7900 XTX [Discrete]

Okay I just now copied an image from Reddit, wanted to post it on Discord and the image was broken. So maybe it is not Spectacle
Comment 6 Cameron Smith 2026-01-03 11:04:43 UTC
Just reproduced this behaviour again (image preview visible on clipboard, but can't paste into most programs). Immediately queried journalctl and got the following:
"Jan 03 20:59:14 [Hostname] plasmashell[1059]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:16:15: QML QQuickItem (parent or ancestor of QQuickDragAttached): Binding loop detected for property "active":
                                           qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:19:9"
Hopefully this is the same bug. There were no further relevant messages in journalctl.