Bug 470334

Summary: Clipboard issue on Wayland - "Requested clipboard format is not available" in Libre Office
Product: [Plasma] kwin Reporter: Michał Dybczak <michal.dybczak>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: major CC: kde, kde, nate, openusr, xaver.hugl
Priority: NOR    
Version: 5.27.5   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Michał Dybczak 2023-05-27 13:35:07 UTC
Please, move or label this case properly, I couldn't find clipboard section anywhere and since this is a Wayland issue, it is dependent on kwin anyway.

SUMMARY
***
When I try copy-paste anything from the (any) browser with no formatting in Libre Office (ctrl+shift+v) I get the error, that there is no clipboard available. To be precise, it says:

“Requested clipboard format is not available.”

When I try to choose html formatting - the same issue. Copy-pasting with formatting works, but is a disaster to work with.
Initially, I thought at first that this is a general, old bug re-emerging:

https://bugs.documentfoundation.org/show_bug.cgi?id=68765

However, I asked other Manjaro users and they seemed to have no problem. I checked my TEST user with vanilla settings, and the issue was also present there, so I can rule out configs. Then I switched to Xorg and the issue was gone.

So basically, there is some issue happening between Clipboard and Libre Office on Wayland. To bypass this problem, I must either paste the text to any text editor (kwrite), copy it again and paste to LO (then it works). Or leave the formatting and clean it up at the end. So or so, it adds a ton of work and is not a viable option for work purposes. Since I need Libre Office almost every day for work, and I need to use web content quite often, this is a MAJOR break point on Wayland so far. Because of this issue alone, I am forced to switch back to Xorg. Otherwise, Wayland was working for me fine.

Because Libre Office is a main and most often used Office suite on Linux, Wayland not working well with it is a serious problem.
***


STEPS TO REPRODUCE
1. Use Wayland session on any Arch based system.
2. Open libreoffice-fresh or libreoffice-still's Writer.
3. Copy some formatted text from the web browser.
4. Paste it with ctrl+shift+v to the Writer document.

OBSERVED RESULT
It gives an error: “Requested clipboard format is not available.”

EXPECTED RESULT:
The text should be pasted without an error, whatever version I choose (no formatting/html formatting).


SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 6.3.4-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530
Manufacturer: Alienware
Product Name: Alienware 17 R3
System Version: 1.13.1

ADDITIONAL INFORMATION

It also may be a packaging issue on Arch's side, because it doesn't happen when using snap or flatpack Libre Office version. However, from various reasons, those versions are not an option for me.
So in the end it may be an upstream issue on Arch'es or on Libre Office's side, or Wayland or Clipboard... I can't tell so far.
Since there is an upstream issue with pasting images to Libre Office, this one also may be the same as:

https://bugs.kde.org/show_bug.cgi?id=438531

If you need any additional info, let me know.
Comment 1 Michał Dybczak 2023-05-27 13:47:53 UTC
I wanted also to add this issue submitted on Libre Office side:

https://bugs.documentfoundation.org/show_bug.cgi?id=68765


It is happening since 2013, but since currently it appears to be only on Wayland, this may require another case.

Also, please don't disregard quickly this bug on Plasma. In theory, because pasting works to any other app and the clipboard content is available, one could think that this is only Libre Office's problem. However, it could still mean, that Libre Office is doing everything right (or not) and there is some bug in protocol on Plasma's side that could be fixed. Or even it may be upstream issue, there could be some small change on Plasma to avoid it. So or so, this requires digging into what is really happening and who can fix it. Without knowing the cause, it is impossible to tell at this moment.
Comment 2 Zamundaaa 2023-05-28 12:39:05 UTC
You can check the mime types KWin offers in the debug console (search for "kwin" in krunner to open it). For me at least, copying stuff in a text editor has no mime types that copying from Firefox doesn't have, so afaict this is a bug in libreoffice
Comment 3 Michał Dybczak 2023-05-30 09:42:17 UTC
I'm not sure what you are talking about. I know about MIME types, but I can't follow your advice.

In krunner I get only my command to restart kwin and the browser history, so this is a dead end. When searching for kwin in system settings, I get: window's look, desktop effects, screen edges/corners, screen gestures, kwin's scripts, compositor and the night light. None of that will get me to file associations. When I choose file associations manually and search for kwin, there is nothing.  So what has kwin with MIME to do? I have no idea.

I don't know what debug console is. I can find KDebugSettings, but I'm not sure how to use it.

Also, I completely don't understand that part of the sentence "copying stuff in a text editor has no mime types that copying from Firefox doesn't have, so afaict this is a bug in libreoffice"

How MIME types are related to clipboard? For me, MIME types are just file type associations, and I can't connect it to clipboard in any way.

Can you elaborate a bit, what do you mean?
Comment 4 David Edmundson 2023-06-01 11:27:45 UTC
>How MIME types are related to clipboard? For me, MIME types are just file type associations, and I can't connect it to clipboard in any way.

A clipboard consists of a bunch of different data, a list of mimetypes. Text offers text/html, text/plain   and a few more.
Clients then ask for data for one or more of them. 

From a kwin side everything is working fine, I suspect libreoffice is strugging to find text/plain, one key difference is text/plain now tends to be text/plain;charset=utf_8  which maybe libreoffice doesn't look for.

Please report to libreoffice
Comment 5 Michał Dybczak 2023-06-01 18:17:22 UTC
But what is the difference between Xorg and Wayland? On Xorg it works fine. This suggests an issue with XWayland side of things.

I am not familiar with the topic, so I may ask a stupid question: is XWayland something general that various non-Wayland apps use to be displayed in Wayland correctly, or is it implemented individually per app? I ask this, because it may be issue with XWayland itself?