Bug 429390 - Screenshot taken on Wayland via keyboard shortcuts is not copied to clipboard
Summary: Screenshot taken on Wayland via keyboard shortcuts is not copied to clipboard
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 21.08.2
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords: wayland
: 433681 444482 445097 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-11-20 11:34 UTC by Patrick Silva
Modified: 2022-02-19 19:43 UTC (History)
20 users (show)

See Also:
Latest Commit:
Version Fixed In: 22.04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-11-20 11:34:24 UTC
STEPS TO REPRODUCE
1. start Wayland session
2. make sure both "Copy image to clipboard" and "Auto save the image to the default location" options are checked in Spectacle settings
3. take a screenshot by pressing shift+print (full screen) or meta+shift+print (rectangular region) 
4. try to paste the just taken screenshot to an image editor, like KolourPaint or GIMP

OBSERVED RESULT
screenshot can not be pasted. Also clipboard systray applet does not show any copied image despite "Ignore images" is unchecked in its settings.

EXPECTED RESULT
screnshot should be copied to clipboard

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.20.3
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.2
Comment 1 Méven Car 2020-11-25 09:00:27 UTC

*** This bug has been marked as a duplicate of bug 422860 ***
Comment 2 Méven Car 2020-11-25 09:01:29 UTC
Well this seemed to be the same 422860, but you are testing with Qt 5.15.2 where we should have the fix for 422860
Comment 3 Gabriel 2021-08-31 22:26:25 UTC
I experience the problem with these specs:

Operating System: Arch Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.13-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 4 Jamon 2021-09-09 22:09:59 UTC
I'm also having this problem on Manjaro's KDE release, fully updated:

local/plasma-wayland-session 5.22.5-1
local/plasma-desktop 5.22.5-1 (plasma)
local/plasma-framework 5.85.0-2 (kf5)
local/qt5-base 5.15.2+kde+r215-1 (qt qt5)
local/linux514 5.14.0-0
Comment 5 zerocostabstraction 2021-10-20 20:50:14 UTC
Can confirm to still be getting this on 5.23 Wayland:

Operating System: openSUSE Tumbleweed 20211016
KDE Plasma Version: 5.23.0
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.14.11-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 1800X Eight-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX Vega
Comment 6 cg.almehag 2021-10-21 08:23:29 UTC
I'm still affected by this bug.
Comment 7 Méven Car 2021-10-22 07:26:21 UTC
FYI we did the work for Qt6:
https://codereview.qt-project.org/c/qt/qtwayland/+/360355
https://codereview.qt-project.org/c/qt/qtwayland/+/367306

And are now backporting things to KDE Qt Patch collection:

First patch https://invent.kde.org/qt/qt/qtwayland/-/merge_requests/18

Then https://codereview.qt-project.org/c/qt/qtwayland/+/360355 will need to be backported too.

This will be fixed then after the next arch-linux build of the KDE Qt Patch collection.

Unfortunately not all distros uses our KDE Qt Patch collection.
Comment 8 Patrick Silva 2021-10-23 14:14:17 UTC
*** Bug 444038 has been marked as a duplicate of this bug. ***
Comment 9 Méven Car 2021-10-25 07:03:03 UTC
Well the deep down issue is Wayland disallow apps in the background to put things in the clipboard.

The solution for this, is to create a dummy surface to be able to send data to the clipboard like the popup_surface in:
https://github.com/bugaevc/wl-clipboard/blob/master/src/wl-copy.c
Comment 10 Patrick Silva 2021-11-06 23:37:21 UTC
*** Bug 445097 has been marked as a duplicate of this bug. ***
Comment 11 Méven Car 2021-11-15 09:59:02 UTC
*** Bug 444482 has been marked as a duplicate of this bug. ***
Comment 12 Bug Janitor Service 2021-11-16 17:58:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/97
Comment 13 Bug Janitor Service 2021-11-16 17:58:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/97
Comment 14 Méven Car 2021-12-13 10:05:27 UTC
Git commit 877744dfb824785e798ee7f322c4cc8b208a8aea by Méven Car, on behalf of Méven Car.
Committed on 13/12/2021 at 10:03.
Pushed by meven into branch 'master'.

Wayland: Allow to copy to clipboard img while in dbus or background mode

M  +2    -1    CMakeLists.txt
M  +1    -0    src/CMakeLists.txt
M  +11   -24   src/ExportManager.cpp
M  +1    -1    tests/CMakeLists.txt

https://invent.kde.org/graphics/spectacle/commit/877744dfb824785e798ee7f322c4cc8b208a8aea
Comment 15 Nate Graham 2021-12-13 20:44:56 UTC
Do you think this is worth backporting, Méven?
Comment 16 Méven Car 2021-12-14 11:41:41 UTC
(In reply to Nate Graham from comment #15)
> Do you think this is worth backporting, Méven?

This is not simply feasible. This depends on KF 5.89 that just came out, while KDE Gears is already in dependency freeze. https://community.kde.org/Schedules/KDE_Gear_21.12_Schedule

It could be adapted somewhat with #ifdef based on KF version, but expect from rolling distro that should not reach many users.
Comment 17 Nate Graham 2021-12-14 14:31:47 UTC
Ah right, got it.
Comment 18 Elias 2021-12-20 11:14:09 UTC
(In reply to Méven Car from comment #16)
> It could be adapted somewhat with #ifdef based on KF version, but expect
> from rolling distro that should not reach many users.

This is not true. The upcoming Ubuntu 22.04 LTS will have KDE Gears 21.12 in repos and already offers KF 5.89 (will most likely be updated again before release, feature freeze is in february).
Ubuntu is a very well known distro, not rolling release and since the next release is a LTS one, this is what many user over many years will get.
Please reconsider backporting in some form.
Comment 19 Szymon Łągiewka 2021-12-21 08:51:44 UTC
Didn't know this bug was already reported (and fixed!) until I've read Nate's blog post. Great to see it finally fixed. Was bothering me ever since I've started using Wayland. This feature is just to good to use other ways :) 

Backport would be awesome to have! 22.04 seems like it's going to be light years away ;)
Comment 20 Méven Car 2021-12-21 08:58:43 UTC
(In reply to Elias from comment #18)
> (In reply to Méven Car from comment #16)
> > It could be adapted somewhat with #ifdef based on KF version, but expect
> > from rolling distro that should not reach many users.
> 
> This is not true. The upcoming Ubuntu 22.04 LTS will have KDE Gears 21.12 in
> repos and already offers KF 5.89 (will most likely be updated again before
> release, feature freeze is in february).
> Ubuntu is a very well known distro, not rolling release and since the next
> release is a LTS one, this is what many user over many years will get.
> Please reconsider backporting in some form.

This patch needs latest KDE Qt patch collection to work (https://community.kde.org/Qt5PatchCollection), ubuntu does only ships mainline Qt.
Wayland support is simply very degraded without our patch collection.
This is a downstream/packager issue.
Comment 21 Méven Car 2022-01-28 08:47:02 UTC
*** Bug 433681 has been marked as a duplicate of this bug. ***