Bug 442923 - Klipper doesn't show that there are images in the clipboard when they're added via wl-copy
Summary: Klipper doesn't show that there are images in the clipboard when they're adde...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard (show other bugs)
Version: git-master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2021-09-25 01:58 UTC by Thiago Sueto
Modified: 2021-11-24 13:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Sueto 2021-09-25 01:58:56 UTC
SUMMARY
wl-clipboard can be used on Plasma Wayland and Klipper, and is a replacement for xclip.
wl-clipboard includes two subcommands, wl-copy and wl-paste.
Text passed to the clipboard via wl-copy works fine.
However, if you copy an image to wl-copy, while it does get sent to the clipboard (as can be seen by running wl-paste --list-types) and the content can be pasted (both Dolphin and Nautilus acknowledge the image in the clipboard when you press Ctrl+V), Klipper itself does not show that the image is in the clipboard.

STEPS TO REPRODUCE
1. Create an image with spectacle --background --nonotify -o image.png
2. Put the image in the clipboard with wl-copy < image.png
3. Verify that it is in the clipboard with wl-paste --list-types (the output should be image/png)
4. Open Klipper and notice no indication that there is an image in the clipboard
5. Open Dolphin and press Ctrl+V, you should see a field for creating a name for the clipboard content, put any different name
6. Notice how the correct image is pasted
7. Open Klipper and notice no indication that there is an image in the clipboard

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20210916
KDE Plasma Version: 5.23.80
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Kernel Version: 5.14.2-1-default (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i7-5500U CPU @ 2.40GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 5500
Comment 1 David Edmundson 2021-09-25 23:08:22 UTC
>Klipper itself does not show that the image is in the clipboard.


Please confirm your klipper settings do not have "ignore images" set.
Comment 2 Thiago Sueto 2021-09-26 00:09:02 UTC
Actually "Ignore images" was set, but disabling it didn't make a difference.

I also did a full relogin and reboot to confirm, just in case.
Comment 3 David Edmundson 2021-09-26 22:23:02 UTC
Indeed.

It's failing here:

    else if (data->hasImage()) {

despite having the format image/png
Comment 4 David Edmundson 2021-09-26 22:29:36 UTC
Urgh, because some magic happens in QInternalMimeData which we don't inherit from.

We'll need to either use QPlatformHeaders (which is naughty but easy) or copy and paste the relevant image code for: has_format/formats/retrieveData (~100 lines)
Comment 5 Bug Janitor Service 2021-11-19 10:24:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1208
Comment 6 Méven Car 2021-11-24 13:46:40 UTC
Git commit 756d5c51c999df6ec324b794a4eefc9d42e33032 by Méven Car, on behalf of Méven Car.
Committed on 24/11/2021 at 13:46.
Pushed by meven into branch 'master'.

Use KGuiAddons::KSystemClipboard to better handle wayland

Allow klipper to read image data from clipboard

M  +3    -5    klipper/CMakeLists.txt
M  +3    -4    klipper/klipper.cpp
M  +2    -2    klipper/klipper.h
D  +0    -27   klipper/systemclipboard/CMakeLists.txt
D  +0    -31   klipper/systemclipboard/qtclipboard.cpp
D  +0    -17   klipper/systemclipboard/qtclipboard.h
D  +0    -34   klipper/systemclipboard/systemclipboard.cpp
D  +0    -47   klipper/systemclipboard/systemclipboard.h
D  +0    -5    klipper/systemclipboard/tests/CMakeLists.txt
D  +0    -33   klipper/systemclipboard/tests/paste.cpp
D  +0    -424  klipper/systemclipboard/waylandclipboard.cpp
D  +0    -25   klipper/systemclipboard/waylandclipboard.h
D  +0    -278  klipper/systemclipboard/wlr-data-control-unstable-v1.xml

https://invent.kde.org/plasma/plasma-workspace/commit/756d5c51c999df6ec324b794a4eefc9d42e33032