Bug 500042 - Spectacle quits prematurely copying large screenshots when its "New Screenshot Saved" popup is disabled
Summary: Spectacle quits prematurely copying large screenshots when its "New Screensho...
Status: REPORTED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 6.3.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-14 06:21 UTC by S.
Modified: 2025-03-09 03:28 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S. 2025-02-14 06:21:27 UTC
SUMMARY
I have set Spectacle to copy my screenshots to clipboard and quit, when I hit my screenshot shortcuts. Normally this works fine, but I noticed that when taking screenshot with larger resolutions, nothing is copied to my clipboard. Originally this only happened when the screenshot was around the same resolution as my monitor (3072x1980), and I thought it could simply be because klipper doesn't support bigger images; however, after the 6.3.0 update, even screenshots as large as 2000x500 can fail, and I get errors in my journal when checking the clipboard:

```
05:48:22.136 UTC user@1000.service qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/user/.local/share/klipper/data/074b45f03339619145c7e02a5af6e23211f5efdb/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
05:48:22.137 UTC user@1000.service TGAHandler::canRead() error while reading the header
```

If I keep Spectacle in the background then it copies fine. Also, notably, unchecking "Quit after manual Save or Copy" still doesn't prevent it auto quitting after taking the screenshot - I have to keep its config window open in the background as a workaround.

Saving always works. It's copying that doesn't work. Based on the errors I believe it happens because Spectacle is just slow (as in [#442876](https://bugs.kde.org/show_bug.cgi?id=442876)) to save the screenshot, so it just quits before it can finish - saving a full screen makes everything freeze for 5 seconds, and I have an Intel Ultra7-155H CPU! A fullscreen image saved into Klipper Clipboard is only ~500KB in size.

This is making Spectacle borderline unusable for me now so I hope it gets some attention.

STEPS TO REPRODUCE
1. Set Spectacle "After taking a screenshot" to "Copy image to clipboard".
2. Check "Quit after manual Save or Copy" (although as mentioned above this makes no difference).
3. Take a large rectangle screenshot, preferably around 3000x2000; make sure that spectacle auto-quits after copying. Alternatively if your screen resolution is big enough, just hit a screenshot shortcut key and observe the results.
4. Try pasting the screenshot, or at least check the clipboard contents.

OBSERVED RESULT
Either nothing is copied to the clipboard, or there is a broken image.

EXPECTED RESULT
Spectacle should normally be able to copy whatever I took into the clipboard.

SOFTWARE/OS VERSIONS
Linux kernel: 6.12.13-1-lts
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
Graphics Platform: X11

ADDITIONAL INFORMATION
I know there is a Qt bug (https://bugreports.qt.io/browse/QTBUG-133206 - "QThreadStorage: Thread %p exited after QThreadStorage %d destroyed"), and it does show up when I launch Spectacle from a terminal and quit it immediately, but nothing shows up when the screenshot fails to copy, so it is likely not related. Plus this issue existed on older KDE versions on my side too.
Comment 1 S. 2025-02-18 23:19:57 UTC
Some extra observations: this seems to be related to my notification settings.

I have turned off my Spectacle "New Screenshot Saved" popup notification because it somehow makes me unable to paste images before the popup is finished. Originally I wanted to test if the notification still displays, even when Spectacle fails to copy my screenshot, so I turned that back on. Now it copies everything correctly albeit quite slowly ...
Comment 2 Noah Davis 2025-02-19 16:39:46 UTC
Since you say that pasting works after the notification disappears, this seems similar to bug 485096. However, I see that you are using a version that should have the fix (fixed in 24.08.1). Unfortunately, I cannot reproduce the bug, even when taking a 16128x3240 screenshot (tested on Wayland though, will test X11 later). I do notice that it can be slow, but I don't think much can be done about that from Spectacle's side.

Regarding the "Unsupported image format" message, do you have qt6-imageformats or qt6-qtimageformats installed?
Comment 3 Noah Davis 2025-02-19 16:41:40 UTC
I should note that I have tested with WebP and PNG so far.
Comment 4 Noah Davis 2025-02-19 16:52:36 UTC
When you copy, before the notification disappears, what is the output of `xclip -selection clipboard -o -t TARGETS` for you?
Comment 5 Noah Davis 2025-02-19 16:53:16 UTC
This could be related to https://bugs.kde.org/show_bug.cgi?id=497735
Comment 6 S. 2025-02-20 07:28:43 UTC
(In reply to Noah Davis from comment #2)
> Since you say that pasting works after the notification disappears, this
> seems similar to bug 485096. However, I see that you are using a version
> that should have the fix (fixed in 24.08.1). Unfortunately, I cannot
> reproduce the bug, even when taking a 16128x3240 screenshot (tested on
> Wayland though, will test X11 later). I do notice that it can be slow, but I
> don't think much can be done about that from Spectacle's side.
> 
> Regarding the "Unsupported image format" message, do you have
> qt6-imageformats or qt6-qtimageformats installed?

I was using the PNG format (although I have switched to WebP recently) and I have qt6-imageformats installed.

> Regarding the "Unsupported image format" message

I think it was basically from what I had described earlier: Spectacle just quits before it can finish saving the image.

I should also clarify that:
1) This bug is different from what I had expected earlier - originally when I filed this bug report I had thought that it was a generic screenshot copying problem, but it now looks only related to specific notification settings. I will update the title to match this.
2) This is what my Plasma notification settings for Spectacle looked like: [ https://i.imgur.com/Wd4q5XC.png ]. If I specifically disable the "New Screenshot" popup then it just quits prematurely, but if I disable all Spectacle notifications (uncheck the topmost "Show popups") then everything saves correctly (so that is what I'm currently using).

I myself couldn't reproduce the "paste before notification popup is gone" problem now, so I would guess it has been solved.
Comment 7 Bug Janitor Service 2025-03-07 03:47:44 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!