Bug 433441 - Screenshot not copied in clipboard
Summary: Screenshot not copied in clipboard
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 21.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-22 18:56 UTC by Unknown
Modified: 2023-11-22 14:38 UTC (History)
10 users (show)

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


Attachments
Notification center inform picture as in clipboard (79.47 KB, image/png)
2021-02-22 18:56 UTC, Unknown
Details
clipboar_settings (67.61 KB, image/png)
2022-01-21 14:20 UTC, Antonio Prcela
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2021-02-22 18:56:27 UTC
Created attachment 136054 [details]
Notification center inform picture as in clipboard

SUMMARY
Despite the configuration, the image is not always copied to the clipboard.

STEPS TO REPRODUCE
1. Configure spectacle to copy image in clipboard
2. Take screenshot as rectangular selection
3. Try to paste into libreoffice writer or discord, nothing happens

OBSERVED RESULT
Spectable notify (by the notification center) a screenshot as copied in clipboard. The application see the message but I can't paste thye picture.


EXPECTED RESULT
Picture in clipboard and possibility to past anywhere

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon
(available in About System)
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I have to go through the clipboard manager 8 times out of 10 to be able to paste the image where I want it.
Otherwise, nothing happens. I have not found what is the element that disturbs the operation.
Comment 1 Nicolas Fella 2021-02-22 19:23:57 UTC
How exactly are you triggering the screenshot? From the app, via shortcut, from the command line?
Comment 2 Unknown 2021-02-22 20:13:51 UTC
(In reply to Nicolas Fella from comment #1)
> How exactly are you triggering the screenshot? From the app, via shortcut,
> from the command line?

I use meta key + shift + print screen to start capturing zone.
Comment 3 Nicolas Fella 2021-02-22 20:38:25 UTC
Hmm, that seems to work fine for me.

What I do notice is when I run "spectacle -b" the image does not get copied to the clipboard, but the path to the saved image does.
Comment 4 Unknown 2021-02-22 20:47:33 UTC
If there was an option to have a debug log (without having the application running before using the shortcut keys), I think I could provide more information.

For information, I do not encounter this bug with the ksnip application
Comment 5 Unknown 2021-02-22 20:51:44 UTC
I have an idea, could it come from the ignore images option in the KDE Clipboard Manager?
Comment 6 Nicolas Fella 2021-02-22 21:13:19 UTC
> If there was an option to have a debug log (without having the application running before using the shortcut keys), I think I could provide more information.

You can use "spectacle -s" on the command line and then launch it via shortcut

> I have an idea, could it come from the ignore images option in the KDE Clipboard Manager?

It works for me even with that option
Comment 7 Unknown 2021-02-22 21:42:23 UTC
> You can use "spectacle -s" on the command line and then launch it via shortcut
I started Spectacle with the -s option. Where are the dbus logs generated by this option?

Because just after launching spectacle -s in a console (alway opened), I captured an area and couldn't paste anything into LibreOffice Writer.
Comment 8 lvxejay 2021-02-25 05:00:23 UTC
I can confirm this happens for me as well. All signs point to this commit being the culprit:

https://github.com/KDE/spectacle/commit/a232723b35a1c2c2d8f27f6bf4a59f2ff3775863

Commit Msg:
> This fixes the bug that keeps Spectacle running, happens when it's launched via either spectacle --region --background or Meta + Shift + Prt.sc.

It seems like Spectacle isn't working as expected here. Previously the region screenshot -> clipboard via shortcut action worked, but that actually seems like a bug. In other words, Spectacle was able to copy to the clipboard because it was still running in the background.

As of v20.12.2-2, if I have Spectacle open and do a rectangular region capture with the Copy to Clipboard option enabled, the image is copied to the clipboard, as expected. Essentially, it as if Spectacle is closing before it can copy the image to the clipboard when running in background mode, due to the "bugfix" mentioned above.
Comment 9 Antonio Prcela 2021-03-07 18:10:06 UTC
(In reply to lvxejay from comment #8)
> I can confirm this happens for me as well. All signs point to this commit
> being the culprit:
> 
> https://github.com/KDE/spectacle/commit/
> a232723b35a1c2c2d8f27f6bf4a59f2ff3775863
> 
> Commit Msg:
> > This fixes the bug that keeps Spectacle running, happens when it's launched via either spectacle --region --background or Meta + Shift + Prt.sc.
> 
> It seems like Spectacle isn't working as expected here. Previously the
> region screenshot -> clipboard via shortcut action worked, but that actually
> seems like a bug. In other words, Spectacle was able to copy to the
> clipboard because it was still running in the background.
> 
> As of v20.12.2-2, if I have Spectacle open and do a rectangular region
> capture with the Copy to Clipboard option enabled, the image is copied to
> the clipboard, as expected. Essentially, it as if Spectacle is closing
> before it can copy the image to the clipboard when running in background
> mode, due to the "bugfix" mentioned above.

That's my commit, and I just tried with the latest spectacle version build off from the git master branch (21.03.70).
Works now.
With the current version (20.12.3 , arch repo), I can confirm the bug.
Must be something in between that fixed it?
Comment 10 lvxejay 2021-03-23 21:23:04 UTC
I updated to 21.03.80-1 kde-unstable repo and the bug persists.
Comment 11 Antonio Prcela 2021-03-30 05:04:41 UTC
(In reply to lvxejay from comment #10)
> I updated to 21.03.80-1 kde-unstable repo and the bug persists.

Version 21.07.70, latest git build
Works with "meta key + shift + print screen"
Comment 12 lvxejay 2021-04-29 21:00:43 UTC
This is still broken, even with Meta-Shift-Print on the latest version in the Arch stable repos.
Comment 13 lvxejay 2021-04-29 21:07:35 UTC
The ability to capture a rectangular screenshot and copy it to the clipboard without having to open the application is core functionality and convenience for this application. It is the only reason I use Spectacle. Please fix this.

Again, it seems to me like the fact that it was ever working at all was a bug disguised as feature that was "fixed", revealing the fact that there is actually a bug here. Spectacle does not stay running long enough to copy the screenshot to the clipboard. In other words, before this commit, Spectacle was staying "open" (unintentionally) in the background long enough to capture a screenshot and copy it to the clipboard: https://github.com/KDE/spectacle/commit/a232723b35a1c2c2d8f27f6bf4a59f2ff3775863

Subsequently, after this commit was added, Spectacle copy-to-clipboard no longer works.
Comment 14 lvxejay 2021-04-29 21:44:20 UTC
I'm going to mark this as resolved, tentatively. I had a 2-years-old custom shortcut in place that served as a workaround when the Copy to Clipboard feature wasn't working. I disabled the custom shortcut command and now copy to clipboard works. However, it should be noted that prior to commit I mentioned, even with my custom shortcut in place, copy to clipboard was working.

The shortcut: /usr/bin/xclip -selection clipboard -target image/png -i $(ls -1tr /home/$USER/pictures/screenshots/Screenshot_*.png | tail -n 1)
Comment 15 lvxejay 2021-04-29 21:55:25 UTC
Re-opening. I had the Spectacle window Open while taking the screenshot after I had disabled my custom shortcut. It worked. 

Then I tried again, without my custom shortcut command, and with the Spectacle window closed. Now it does not work. Can definitely confirm this is still not working as intended.
Comment 16 Antonio Prcela 2021-05-17 22:00:18 UTC
(In reply to lvxejay from comment #15)
> Re-opening. I had the Spectacle window Open while taking the screenshot
> after I had disabled my custom shortcut. It worked. 
> 
> Then I tried again, without my custom shortcut command, and with the
> Spectacle window closed. Now it does not work. Can definitely confirm this
> is still not working as intended.

What custom keyboard shortcut do you have set and is it set via Spectacle or KDE's System Settings Shortcuts?
Comment 17 kinghat 2021-06-14 17:58:23 UTC
i cant get copy to clipboard to work via shortcut or pressing the copy to clipboard button in spectacle:

Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.0
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.3
Kernel Version: 5.8.0-55-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i7-5600U CPU @ 2.60GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 5500
Comment 18 Alexander Radzishevsky 2022-01-21 13:55:12 UTC
Does not work for me. Notifications stopped to popup also. Image just is not copied to clipboard. File is created though.

spectacle 21.08.1

Operating System: Kubuntu 21.10
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-27-generic (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Xeon® W-11855M CPU @ 3.20GHz
Memory: 62,6 GiB of RAM
Graphics Processor: NVIDIA RTX A2000 Laptop GPU/PCIe/SSE2
Comment 19 Antonio Prcela 2022-01-21 14:20:11 UTC
Created attachment 145703 [details]
clipboar_settings

Do you have these settings in clipboard?
Comment 20 Alexander Radzishevsky 2022-01-21 14:57:18 UTC
Thanks for quick response.
What do you mean saying "clipboar_settings"?
Comment 21 Alexander Radzishevsky 2022-01-21 15:01:44 UTC
Adding more details:
Copying to clipboard works if spectacle GUI is open. If it is closed and region mode is launched via shortcut - it does not work. Notification does not appear either. When GUI closed, after screenshot is made I feel 1-2s freeze (not able to switch to other apps), image is saved as a file, but not copied to clipboard
Comment 22 Alexander Radzishevsky 2022-01-22 12:48:45 UTC
I found what setting caused copying to stop working: I disabled "Show notification in popup" option in Spectacle notifications setting. Reason behind it was not to show notifications. Therefore I figured out that we still can have "Show notification in popup" enabled but "Show popups" disabled - this combination will not show popups and still keep copying to clipboard working.
Comment 23 Antonio Prcela 2022-06-16 21:48:43 UTC
(In reply to Alexander Radzishevsky from comment #20)
> Thanks for quick response.
> What do you mean saying "clipboar_settings"?

Klipper's configuration. Can you check that please?

did some of you try with the latest 22.04.02?
Still works fine for me , tho it autosaves the pic to the default folder even tho it's not configured to do so, but that bugfix is already on it's way.
Comment 24 Noah Davis 2023-11-22 14:38:51 UTC
This seems to be fixed.