Bug 412350 - Klipper tray icon is unreliable and clipboard breaks after first use on Wayland
Summary: Klipper tray icon is unreliable and clipboard breaks after first use on Wayland
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard (show other bugs)
Version: 5.15.3
Platform: Arch Linux Linux
: NOR major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland
: 407606 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-09-26 10:49 UTC by tempel.julian
Modified: 2022-01-12 15:19 UTC (History)
5 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 tempel.julian 2019-09-26 10:49:52 UTC
SUMMARY
Clipboard behavior in a Wayland session only works the first time between closed programs.

STEPS TO REPRODUCE
1. Open a document in Kwrite (Wayland), select some text and press ctrl + c.
2. The Klipper icon in the tray doesn't show up, which it correctly does on Xorg after filling it with the first entry.
3. When clicking the arrow button of Plasma's tray, Klipper starts to show up as active/filled.
4. When clicking its icon, it also shows the copied text.
5. I can close Kwrite and insert the text somewhere else.
6. So far, so (mostly) good.

7. I repeat that and now it doesn't work anymore. Additional text fragments copied into clipboard via ctrl + c don't show up in Klipper's entry list.
8. I can still copy and paste text out of Kwrite into other programs, but only if I don't close Kwrite before pasting. When I close Kwrite and try to paste the copied text anywhere, it doesn't work (no matter if Wayland or Xwayland application).
9. Clearing the clipboard doesn't help either. I need to restart the Wayland session to make it work again once between closed programs.


EXPECTED RESULT
It should work as reliable on Xorg. It's 100% reliable there with the same Klipper settings.
Copied fragments should always appear instantly in Klipper's UI (without having to fiddle with the tray) and pasting them should always work, also after closing the program out of which the text was copied.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62
Qt Version: 5.13.1
Arch Linux

I chose major importance, as proper clipboard functionality should be considered as one key element of a usable desktop.
Comment 1 Konrad Materka 2019-10-15 15:17:37 UTC
*** Bug 407606 has been marked as a duplicate of this bug. ***
Comment 2 tempel.julian 2020-09-19 10:28:43 UTC
It has gotten better with 5.19.90 beta from Arch kdeunstable repo. However, it's still not perfect.

-When I mark a desktop icon or the text of it and press ctrl + c, the content gets copied into the clipboard only after clicking the desktop
-I can't paste text into Firefox XWayland from Dolphin Wayland when I first copy the text, then close Dolphin, then start Firefox and then try to paste it.
Comment 3 Bug Janitor Service 2020-10-20 00:30:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/365
Comment 4 Aleix Pol 2020-10-29 14:56:52 UTC
Git commit d335070b80c2f3bc5674355e3edba61bc010bc36 by Aleix Pol.
Committed on 29/10/2020 at 14:56.
Pushed by apol into branch 'master'.

xwl: Do not refresh the x11 Clipboard while fetching

At the moment there was a race condition when putting something into the
keyboard from XWayland apps. The clipboard manager would announce a new
thing before we'd submitted it all resulting in a broken state.

This change detects when it's fetching and will only refresh the source
after everything has been sent.
Related: bug 424754

M  +10   -0    xwl/clipboard.cpp
M  +1    -0    xwl/clipboard.h

https://invent.kde.org/plasma/kwin/commit/d335070b80c2f3bc5674355e3edba61bc010bc36
Comment 5 Justin Zobel 2020-11-20 07:03:51 UTC
Thanks for the report, I've just tested with Plasma 5.20.3 and it's working great for me.

Can you please test and confirm that the commit has resolved the issue. I've set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved" when you respond, thanks.
Comment 6 tempel.julian 2020-11-20 10:47:49 UTC
It now works for xwayland -> close window -> wayland. What still doesn't work:

1. Copy text from Dolphin Wayland into clipboard, then close Dolphin, then start Firefox XWayland and try to paste the text there. It only works if Dolphin is still running.
2. Images in XWayland applications are still ignored. E.g. try to copy an image into clipboard in Firefox XWayland, only a gap is added as clipboard content entry.
Comment 7 Nate Graham 2020-11-20 18:03:30 UTC
(In reply to tempel.julian from comment #6)
> It now works for xwayland -> close window -> wayland. What still doesn't
> work:
> 
> 1. Copy text from Dolphin Wayland into clipboard, then close Dolphin, then
> start Firefox XWayland and try to paste the text there. It only works if
> Dolphin is still running.
This is working for me with current git master. Any chance you could confirm with git master packages?

> 2. Images in XWayland applications are still ignored. E.g. try to copy an
> image into clipboard in Firefox XWayland, only a gap is added as clipboard
> content entry.
Can confirm, this is still broken for me.

Perhaps we should use different bug reports to track these different issues.
Comment 8 Nate Graham 2020-11-28 22:34:50 UTC
Git commit 99b29195b45ecc0de97761f13e7df81dd92b53e7 by Nate Graham, on behalf of Aleix Pol.
Committed on 28/11/2020 at 22:33.
Pushed by ngraham into branch 'Plasma/5.20'.

xwl: Do not refresh the x11 Clipboard while fetching

At the moment there was a race condition when putting something into the
keyboard from XWayland apps. The clipboard manager would announce a new
thing before we'd submitted it all resulting in a broken state.

This change detects when it's fetching and will only refresh the source
after everything has been sent.
Related: bug 424754
(cherry picked from commit d335070b80c2f3bc5674355e3edba61bc010bc36)

M  +10   -0    xwl/clipboard.cpp
M  +1    -0    xwl/clipboard.h

https://invent.kde.org/plasma/kwin/commit/99b29195b45ecc0de97761f13e7df81dd92b53e7
Comment 9 Justin Zobel 2020-11-29 00:54:52 UTC
(In reply to Nate Graham from comment #8)
> Git commit 99b29195b45ecc0de97761f13e7df81dd92b53e7 by Nate Graham, on
> behalf of Aleix Pol.
> Committed on 28/11/2020 at 22:33.
> Pushed by ngraham into branch 'Plasma/5.20'.
> 
> xwl: Do not refresh the x11 Clipboard while fetching
> 
> At the moment there was a race condition when putting something into the
> keyboard from XWayland apps. The clipboard manager would announce a new
> thing before we'd submitted it all resulting in a broken state.
> 
> This change detects when it's fetching and will only refresh the source
> after everything has been sent.
> Related: bug 424754
> (cherry picked from commit d335070b80c2f3bc5674355e3edba61bc010bc36)
> 
> M  +10   -0    xwl/clipboard.cpp
> M  +1    -0    xwl/clipboard.h
> 
> https://invent.kde.org/plasma/kwin/commit/
> 99b29195b45ecc0de97761f13e7df81dd92b53e7

Does this resolve the issue? Have you tested?
Comment 10 tempel.julian 2021-01-21 14:08:50 UTC
The picture clipboard issue is still there with kwin-git v5.19.90.r492.ge370fcb21.

When I copy selected text in Vivaldi (XWayland), I can paste it into Firefox Wayland, as long as I don't close Vivaldi. Once Vivaldi is closed after copying, I can still paste the text in Dolphin, but not in Firefox Wayland anymore.
Comment 11 David Redondo 2022-01-12 15:19:57 UTC
Wayland support has been added to klipper and we rewrote the XWayland cliboard handling, marking as resolved, please file other bugs for any specific bugs you encounter