Bug 487186 - Text copied far2l-GIT (from AUR) can't be pasted into Wayland windows
Summary: Text copied far2l-GIT (from AUR) can't be pasted into Wayland windows
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.0.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2024-05-18 14:33 UTC by izzylaif
Modified: 2024-09-05 03:47 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description izzylaif 2024-05-18 14:33:54 UTC
This bug is very similar or identical to 466041

Plasma version: 6.0.4
F/W version: 6.1.0
Wayland

With any size of klipper history, i.e. 1, 2 or more, you often have to press ctrl-C _twice_ for the contents to actually be later pasted with ctrl-V. If you don't, paste inserts nothing.

The bug is somewhat intermittent, copying some times does work if you only pressed copy once, especially within the same application, but when copying across applications copy-paste is mostly broken.

The bug has been around for so long, that many Wayland users actually now just mash ctr-C multiple times just to make sure the contents are actually copied to clipboard.

I appreciate that we are extremely lucky to have any clipboard working in Wayland at all, however since Plasma 6 now defaults to Wayland in many distros, could we have a fix please.
Comment 1 joelsonejr 2024-06-24 19:12:15 UTC
Hi!
Could you be more specific on wich steps should be performed in order to reproduce this bug? For example, give the name of two or more applications where we can see this behaviour, How many lines of text were you trying to copy, etc. 

I asking you for this information because I'm not experiencing this issue, so I need help to nail it down. 
Cheers. 

///////////////////////
My testing system has the following config:

OS: Fedora 40
Kernel: 6.9.5-200.fc40.x86_64
Resolution: 2560x1440
DE: Plasma 6.1
WM: kwin
Graphics Platform: Wayland
WM Theme: Breeze
Theme: [Plasma], Breeze-Dark [GTK2], Breeze [GTK3]
Icons: [Plasma], breeze-dark [GTK2/3]
Comment 2 izzylaif 2024-06-24 20:07:23 UTC
Hi.
Frankly, it can be between any two applications. The biggest problem is that it is not consistent, and it kinda works most of the time, and I also got used to just spamming the ctrl-c to make sure the selection actually copied to clipboard.

The most surefire way to reproduce is:

1) Set your clipboard history to 1 (doesn't really matter I think, but still)
2) install far2l (it's a dual-panel file manager, similar to old-school Norton or Midnight commander)
3) Run Firefox (I use an appimage)
4) Open Far Manager. Type anything on the keyboard, hold shift and left arrow to select it, tap Ctrl-c ONCE
5) Open Firefox, go to address bar, press Ctlr-v. Nothing
6) Go back to Far, you should still have the text selected. Tap Ctrl-C again.
7) Go back to Firefox address bar, tap Ctrl-v - bam, inserted.

This is the closest to 100% reproduction rate I can get, but again it happens in other apps as well.
(In reply to joelsonejr from comment #1)
Comment 3 Bug Janitor Service 2024-07-09 03:47:11 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Edward Kigwana 2024-07-17 18:42:57 UTC
(konsole -> kate) works
(kate->konsole) works
(kate->kwrite) works
(kwrite->kate) works
(konsole->xterm) works
(xterm->konsole) Broken
(google-chrome->konsole) Broken
(google-chrome->xterm) Broken
(google-chrome->(google-chrome) works
(xterm->xterm) works


Operating System: Gentoo 2.15
KDE Plasma Version: 6.1.80
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.0-gentoo-x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 36 × Intel® Core™ i9-10980XE CPU @ 3.00GHz
Memory: 251.4 GiB of RAM
Graphics Processor: AMD Radeon Pro W6600
Manufacturer: Dell Inc.
Product Name: Precision 5820 Tower X-Series
Comment 5 Nate Graham 2024-07-27 04:45:55 UTC
> The bug has been around for so long, that many Wayland users actually now just mash ctrl-C
> multiple times just to make sure the contents are actually copied to clipboard.
I feel called out! 😬

The best way to debug this is is to have two things open: the Klipper popup in the System Tray, and the KWin debug console (search for "kwin debug" in KRunner). You can pin Klipper open so it doesn't close, and go to the Clipboard tab in KWin debug console.

When a copy fails, you can use those two to see what did become aware of the copied data. Did KWin see it? Did Plasma see it? Both? Neither? etc.

Some debugging using those tools would be extremely helpful. If you can find a pattern, that would help a lot.
Comment 6 izzylaif 2024-07-27 18:26:45 UTC
I launch far2l, punch in some text, shift+backArrow to select it, then ctrl-c

in Debug console, immediately
wl_data_source@46 of /usr/bin/far2l

SAVE TARGETS..... (blank for some time) and then "timeout reading from pipe".

if I press ctl-c again, then it works:

text/plain;charset=utf-8   "text I entered"
UTF8_STRING "text I entered"

I also tried selecting with the mouse, no matter what, the first try to copy get the timeout reading from pipe
Comment 7 Edward Kigwana 2024-07-27 19:32:00 UTC
Copy from kdevelop shows up in KDC, klipper, and xclipboard

Copy from firefox v128.0.2 shows up in KDC, klipper, and xclipboardr

Copy from Konsole shows up in KDC, klipper, and xclipboard

Copy from google chrome does not show up in KDC, klipper, or xclipboard. xclipboard goes clear on copy but when I hover over it, it then add the last item in klipper as the new item instead of what I just copied. This is when klipper has items!

Copy from google chrome does not show up in KDC or klipper but SHOWS up on xclipboard. And I am able to paste into xterm but cannot paste into any wayland applications.

1. It seems like klipper or the copy buffer mechanism actively interferes and prevents XWayland copies when the buffer is NOT empty.
2. Wayland copies make it to XWayland
3. XWayland copies only make it to XWayland when klipper is cleared
4 XWayland copies never make it to Wayland
Comment 8 Nate Graham 2024-07-29 17:55:34 UTC
> xclipboard goes clear on copy
Am I understanding that this a 3rd-party tool you have running in the background, which is set up to clear the clipboard after copying something?

Do any of these issues go away when not running that, or in a new clean user account with no customizations?
Comment 9 Edward Kigwana 2024-07-29 18:07:50 UTC
(In reply to Nate Graham from comment #8)
> > xclipboard goes clear on copy
> Am I understanding that this a 3rd-party tool you have running in the
> background, which is set up to clear the clipboard after copying something?
> 
> Do any of these issues go away when not running that, or in a new clean user
> account with no customizations?

xclipboard is like klipper but for X11. I use to observe what makes it to XWayland but it otherwise has no part in it. I.e the issue exists even when it is not started.

The issue as described occurs on a clean account. I discovered that google-chrome has a Wayland backend and so I have switched to that so this doesn't irritate me as much
Comment 10 Nate Graham 2024-07-31 16:02:02 UTC
So basically the problems here all concern copied text going from a Wayland app to an XWayland app, or vice versa?
Comment 11 Edward Kigwana 2024-07-31 19:24:54 UTC
(In reply to Nate Graham from comment #10)
> So basically the problems here all concern copied text going from a Wayland
> app to an XWayland app, or vice versa?

The problem that I am experiencing is copied text going from XWayland app to Wayland app. I thought I saw over it once I got chrome in wayland mode but I quickly discovered that other programs that I use for work like Matlab, Vivado, etc have the same issue
Comment 12 Nate Graham 2024-07-31 20:32:18 UTC
> The problem that I am experiencing is copied text going from XWayland app to
> Wayland app. I thought I saw over it once I got chrome in wayland mode but I
> quickly discovered that other programs that I use for work like Matlab,
> Vivado, etc have the same issue

 izzylaif, is that what you're seeing as well?

If we can narrow this down to XWayland -> Wayland, it will be easier to debug.
Comment 13 izzylaif 2024-07-31 20:37:50 UTC
>  izzylaif, is that what you're seeing as well?

I guess so
Comment 14 Nate Graham 2024-08-01 16:37:00 UTC
Ok great. So now let's figure out what does happen to that text.

When you copy text in an XWayland window and paste it into a Wayland window and this fails, look in the Klipper widget to see if it's in there. And then look in KWin debug console to see if it's in there.

And please mention specifically which XWayland app was the source and what native Wayland app was the destination.
Comment 15 izzylaif 2024-08-01 18:38:57 UTC
The program I copy from is this https://aur.archlinux.org/packages/far2l-git
The program I copy to is Firefox. I use an appimage with I run with "export MOZ_ENABLE_WAYLAND=1" flag

I open Far2l. Select random text. Press ctl-c.
Nothing appears in Klipper. 
In Kwin Debug, "SAVE_TARGETS timeout reading from pipe"

If I press ctrl-c again, the text appears in Klipper.
Comment 16 Nate Graham 2024-08-06 20:41:11 UTC
(In reply to izzylaif from comment #15)
> The program I copy from is this https://aur.archlinux.org/packages/far2l-git
What is this? What does it do? I genuinely cannot tell from https://github.com/elfmz/far2l Is it some kind of terminal-based filemanager?
Comment 17 izzylaif 2024-08-06 20:47:14 UTC
> is it some kind of terminal-based filemanager?

correct. it's like Midnight Commander, but usable.

DOS/Windows equivalents will be text-based dual-panel file managers Norton Commander, Dos Navigator and Far Manager (far2l is a Linux fork of that).
Comment 18 Nate Graham 2024-08-06 20:50:10 UTC
Ok, thanks.

Is there any other software you can reproduce the exact same issue with, or just that one? I ask because I'd like to try to reproduce it myself, and my distro doesn't offer that software.
Comment 19 Edward Kigwana 2024-08-06 20:57:45 UTC
(In reply to Nate Graham from comment #18)
> Ok, thanks.
> 
> Is there any other software you can reproduce the exact same issue with, or
> just that one? I ask because I'd like to try to reproduce it myself, and my
> distro doesn't offer that software.

(konsole -> kate) works
(kate->konsole) works
(kate->kwrite) works
(kwrite->kate) works
(konsole->xterm) works
(xterm->konsole) Broken
(google-chrome->konsole) Broken
(google-chrome->xterm) Broken
(google-chrome->(google-chrome) works
(xterm->xterm) works

surely you have xterm?
Comment 20 izzylaif 2024-08-06 21:09:41 UTC
>and my distro doesn't offer that software.

You don't need to.

just

"wget -qO- https://github.com/spvkgn/far2l-portable/releases/download/latest/far2l-x86_64.AppImage.tar | tar -xv -C /tmp && /tmp/far2l*.AppImage"
Comment 21 izzylaif 2024-08-06 21:16:24 UTC
Sorry, disregard last. The appimage version does not have the same problem... copy works all the time
but the one from AUR repo does have the issue
Comment 22 Nate Graham 2024-08-06 21:40:55 UTC
 izzylaif, can you also reproduce this issue when copying in XTerm and pasting into Konsole?
Comment 23 izzylaif 2024-08-06 22:03:47 UTC
(In reply to Nate Graham from comment #22)
>  izzylaif, can you also reproduce this issue when copying in XTerm and pasting into Konsole?

No I can't reproduce.
Open xterm
shift-middleclick activate "clipboard"
select some text, ctrl-c (it goes to clipboard applet)
open konsole, ctl-shift-v  - text copied

I also can ctl-c some text in browser, and then middleclick in xterm for it to be pasted no problem.

The only problem I have at the moment is the AUR version of far2l-GIT which is stuck in 2023
I switched to the appimage version (it's a nightly beta 2024) , and it the issue is gone.
Comment 24 Edward Kigwana 2024-08-06 23:50:14 UTC
(In reply to izzylaif from comment #23)
> (In reply to Nate Graham from comment #22)
> >  izzylaif, can you also reproduce this issue when copying in XTerm and pasting into Konsole?
> 
> No I can't reproduce.
> Open xterm
> shift-middleclick activate "clipboard"
> select some text, ctrl-c (it goes to clipboard applet)
> open konsole, ctl-shift-v  - text copied
> 
> I also can ctl-c some text in browser, and then middleclick in xterm for it
> to be pasted no problem.
> 
> The only problem I have at the moment is the AUR version of far2l-GIT which
> is stuck in 2023
> I switched to the appimage version (it's a nightly beta 2024) , and it the
> issue is gone.

I am having quite a time with the clipboard in general. Even in Wayland copying breaks when the number of entries reaches the maximum number of history entries. When I clear it, it works again. Apparently, I am the only one who cuts and pastes a lot. 

I cannot paste from xterm, at all I wonder if something is fundamentally broken like a library.
Comment 25 Nate Graham 2024-08-06 23:52:29 UTC
Edward, could you open a new bug report? Every individual clipboard issue tends to be different due to the diversity of people's software and settings. I'd like to focus on the issue reported by izzylaif here.
Comment 26 Nate Graham 2024-08-06 23:53:50 UTC
izzylaif, is the AppImage build newer? If so I wonder if it's simply got a fix for the issue included.
Comment 27 Nate Graham 2024-08-06 23:54:30 UTC
Or alternatively, is there a way to clear the configuration of the app so that you can try again with a new profile/config? Maybe some old setting is not working here, and the AppImage build  isn't suffering from that.
Comment 28 Bug Janitor Service 2024-08-21 03:47:37 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 29 Bug Janitor Service 2024-09-05 03:47:22 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.