Bug 458726 - Taking a second screenshot in a row will result in nothing being copied to the clipboard
Summary: Taking a second screenshot in a row will result in nothing being copied to th...
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 22.04.3
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-05 04:47 UTC by jimbo
Modified: 2023-11-24 20:24 UTC (History)
4 users (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 jimbo 2022-09-05 04:47:22 UTC
STEPS TO REPRODUCE
1.  Open and pin the Clipboard
2.  Hit 'Take a New Screenshot' in Spectacle
3.  Screenshot gets saved to the clipboard
4.  Hit 'Take a New Screenshot' in Spectacle again
5.  Clipboard is blank

OBSERVED RESULT
Clipboard is blank after a second consecutive screenshot

EXPECTED RESULT
Clipboard contains the most recent screenshot (i.e. it overwrites the previous screenshot)

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.25
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.15.0-41-generic (64-bit)
Graphics Platform: X11
Comment 1 Bharadwaj Raju 2022-10-03 18:47:03 UTC
Interestingly, this works without problems if the clipboard has something other than an image already in it. If it has just one image then it goes wrong.

So I wonder if the bug isn't actually in Klipper or something.
Comment 2 jimbo 2022-10-22 08:22:39 UTC
Yeah, if you open up the clipboard and pin it then you can see that it's not copying the picture after the first screenshot. You have to manually delete the picture first before being able to take a new screenshot.

Strange thing is that if I copy an image selection in Krita, and then copy another one then the clipboard will update. Seems to be an issue only with the screenshot, so that kinda points back to Spectacle.
Comment 3 Bharadwaj Raju 2022-10-22 08:29:53 UTC
(In reply to jimbo from comment #2)
> Strange thing is that if I copy an image selection in Krita, and then copy
> another one then the clipboard will update. Seems to be an issue only with
> the screenshot, so that kinda points back to Spectacle.

Does Krita copying work fine even if you clear the clipboard before testing?
Comment 4 jimbo 2022-10-24 07:35:43 UTC
(In reply to Bharadwaj Raju from comment #3)
> (In reply to jimbo from comment #2)
> > Strange thing is that if I copy an image selection in Krita, and then copy
> > another one then the clipboard will update. Seems to be an issue only with
> > the screenshot, so that kinda points back to Spectacle.
> 
> Does Krita copying work fine even if you clear the clipboard before testing?

Yes, it works as expected with Krita. With regards to Spectacle, I've found that double-tapping the PrintScreen key will capture the screen, it's a workaround but it doesn't work with other shortcuts (e.g. capture active window).
Comment 5 jimbo 2022-10-24 14:07:34 UTC
(In reply to Bharadwaj Raju from comment #1)
> Interestingly, this works without problems if the clipboard has something
> other than an image already in it. If it has just one image then it goes
> wrong.
> 
> So I wonder if the bug isn't actually in Klipper or something.

I've tried replicating this on my end, and it's not a consistent bug. It will work fine for the first time, but clearing the clipboard and trying the same technique again is inconsistent, sometimes it works, most of the time it doesn't.
Comment 6 jomo 2022-12-23 03:22:58 UTC
In my observations, using the "Take a New Screenshot" button always copies it to the clipboard, but launching Spectacle does not copy it to the clipboard when

1) An instance of Spectacle is already running
*and*
2) Spectacle is configured to "Take a new Screenshot" when the screenshot key is pressed while Spectacle is running

When Spectacle is configured to take a "Rectangular Region" and to "Use last-used capture mode", and I press the screenshot key while an instance of Spectacle is already running, the screenshot is not copied when Spectacle is the currently active window. When it is not the currently active window, it is also not copied immediately, but it is copied when pressing the key again.

When Spectacle is instead configured to use any of the other capture modes, the screenshot is copied when interacting with the Spectacle window after taking the screenshot.

---

Workarounds I've found:
a) Configure -> General -> Press screenshot key to: Open a new Spectacle window (This will actually take a screenshot AND open a new window)
b) For Rectangular Region: Press screenshot key again after taking screenshot, press Esc to cancel second screenshot
c) For other modes: Interact with the Spectacle window
Comment 7 Noah Davis 2023-11-24 20:21:20 UTC
This seems to be fixed.
Comment 8 Noah Davis 2023-11-24 20:24:32 UTC
It is worth noting that the clipboard will not make a new entry if a previous entry is identical. This is OK since you do not need two identical entries in the clipboard.