Bug 424649 - Cannot paste text copied from GTK app after closing it when "Prevent empty clipboard" is turned off
Summary: Cannot paste text copied from GTK app after closing it when "Prevent empty cl...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard (show other bugs)
Version: 5.15.3
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2020-07-25 13:30 UTC by Patrick Silva
Modified: 2021-09-20 15:22 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
Settings and Blank Clipboard Confirmation (73.03 KB, image/png)
2021-09-10 16:29 UTC, James Flynn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-07-25 13:30:11 UTC
SUMMARY
Used apps:
inkscape - gtk2 app running on Xwayland
Gedit text editor - gtk3 app running natively on Wayland
Kate - text editor running natively on Wayland
Chromium internet browser - app running on Xwayland

STEPS TO REPRODUCE the first case:
1. start Wayland session
2. open inkscape and Gedit
3. write any word in Gedit
4. press ctrl+a and ctrl+c
5. close Gedit
6. focus inkscape and press ctrl+shift+s
7. try to paste the previously copied word
in the filename field by pressing ctrl+v: nothing is pasted

STEPS TO REPRODUCE the second case:
1. start Wayland session
2. open Gedit, inkscape and Kate
3. write any word in Kate
4. press ctrl+a and ctrl+c
5. close Kate
6. focus Gedit and try to paste the previously copied word by pressing ctrl+v:
nothing is pasted
7. focus inkscape and press ctrl+shift+s
8. try to paste the previously copied word in the filename field
by pressing ctrl+v: nothing is pasted


STEPS TO REPRODUCE the third case:
1. start Wayland session
2. open inkscape, Gedit and Chromium
3. load any webpage with Chromium, select and copy any word
4. close Chromium
5. focus Gedit and try to paste the previously copied word by pressing ctrl+v:
nothing is pasted
6. focus inkscape and press ctrl+shift+s
7. try to paste the previously copied word in the filename field
by pressing ctrl+v: nothing is pasted

EXPECTED RESULT
copied text should always be pasted

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.73.0
Qt Version: 5.14.2
Comment 1 Nate Graham 2020-07-28 17:42:32 UTC
Is the pasted text making it into Klipper?
Comment 2 Patrick Silva 2020-07-28 19:47:09 UTC
(In reply to Nate Graham from comment #1)
> Is the pasted text making it into Klipper?

The text appears in the popup of clipboard applet after I press ctrl+c.
Comment 3 Thiago Sueto 2020-08-29 12:53:58 UTC
I can reproduce all three cases, however the other way around (from anything to Kate) is not reproducible, Kate uses the clipboard as intended.
Comment 4 Claudius Ellsel 2020-08-31 20:21:36 UTC
I don't have time to test on a recently compiled version from master, but is this still happening there?

Might have been fixed by https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1.
Comment 5 Aleix Pol 2020-10-20 00:27:42 UTC
This should be fixed as of 5.20. Please reopen if it's not the case.
Comment 6 Patrick Silva 2020-10-20 22:02:54 UTC
This problem persists.

Operating System: Arch Linux
KDE Plasma Version: 5.20.1
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1
Comment 7 Nate Graham 2021-03-20 00:21:44 UTC
Can reproduce all three cases with a git master Wayland session. I suspect this is a big part of the remaining complaints about the clipboard not working properly on Waylane

Notably, if I click on the entry in Klipper for the text, then pasting works. So it looks like Klipper is somehow not being made aware of it automatically, or something.
Comment 8 Armin 2021-04-29 06:32:37 UTC
I can also reproduce this bug on my Fedora 34 (KDE spin) system.

SOFTWARE/OS VERSIONS
OS: Fedora 
Kernel: x86_64 Linux 5.11.15-300.fc34.x86_64
DE: KDE 5.80.0 / Plasma 5.21.4
Comment 9 James Flynn 2021-05-05 02:10:22 UTC
(In reply to Armin from comment #8)
> I can also reproduce this bug on my Fedora 34 (KDE spin) system.
> 
> SOFTWARE/OS VERSIONS
> OS: Fedora 
> Kernel: x86_64 Linux 5.11.15-300.fc34.x86_64
> DE: KDE 5.80.0 / Plasma 5.21.4

Can also confirm; glad I'm not going crazy, the consistently inconsistent CTRL+C failures were driving me nuts (even having some Cut actions fail after the original selection was deleted, ie text).

For now using explicit right-click menu commands seems to work around the issue for me, but using keyboard commands is... spotty for now
Comment 10 Oded Arbel 2021-06-06 10:29:49 UTC
(In reply to Nate Graham from comment #7)
> Notably, if I click on the entry in Klipper for the text, then pasting
> works. So it looks like Klipper is somehow not being made aware of it
> automatically, or something.

I can reproduce all cases, except that it is enough to open the klipper menu and see that the copied text is there (before closing the application) for the content to be available for pasting.
Comment 11 Om 2021-06-08 06:18:40 UTC
I would like to add that this issue exists when using Inkscape not just in Wayland but when in X11 as well. Moreover, guessing firefox/chrome/libreoffice are gtk apps, I did not have any trouble pasting the copied text from kate/kwrite (after closing it) to firefox/chrome/libreoffice.

Moreover, I observed that the problem with Inkscape could be temporarily resolved if "ignore selection" is enabled in klipper settings. 

Thus, with my limited understanding, I would like to add that the DE may not be causing this. However, I am unsure whether this is an issue with klipper or is specific to Inkscape.


SOFTWARE/OS VERSIONS
Operating System: KDE neon User Edition
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2
Comment 12 Om 2021-06-08 06:34:08 UTC
Please note that by DE I actually meant the display server. Apologies for the error.
Comment 13 Bharadwaj Raju 2021-06-09 13:30:11 UTC
Cannot reproduce.

Neon Unstable
Plasma 5.22
Frameworks 5.83
Gedit 3.36.2
Gtk 3.24.20

Can anyone confirm if it's working for them too on 5.22?
Comment 14 Om 2021-06-10 06:11:29 UTC
(In reply to Bharadwaj Raju from comment #13)
> Cannot reproduce.
> 
> Neon Unstable
> Plasma 5.22
> Frameworks 5.83
> Gedit 3.36.2
> Gtk 3.24.20
> 
> Can anyone confirm if it's working for them too on 5.22?

Not sure about Gedit, but the issue could still be observed when using Inkscape (both versions 0.92 as well as 1.1) in KDE v5.22.


SOFTWARE/OS VERSIONS
Operating System: KDE neon User Edition
KDE Plasma Version: 5.22
KDE Frameworks Version: 5.82
Qt Version: 5.15.3
Comment 15 Bharadwaj Raju 2021-07-07 18:20:37 UTC
Ok, I can reproduce the issue with both Gedit and Inkscape, only if "Prevent empty clipboard" is turned off in Klipper settings.

My other Klipper settings, may be relevant:
- Save clipboard contents on exit: YES
- Prevent empty clipboard: NO
- Ignore images: YES
- Ignore selection: NO
- Text selection only: NO
- Sync clipboard and selection: NO

Turning on "Prevent empty clipboard" (which is on by default), makes the bug disappear.
Comment 16 Nate Graham 2021-08-03 21:28:20 UTC
I can confirm that. When "Prevent empty clipboard" is on, everything works fine. When it's off, this breaks, and (ironically) an empty entry appears in Klipper when I copy the text in Gedit. Lowering priority as there is a trivial and non-destructive workaround and also this works with the default settings.
Comment 17 James Flynn 2021-09-10 16:29:05 UTC
Created attachment 141447 [details]
Settings and Blank Clipboard Confirmation
Comment 18 James Flynn 2021-09-10 16:29:49 UTC
Not to be contrary, but at least with specifically Firefox (91.0.2), this is still an issue on my Fedora 34 KDE install. It does appear this is even with the "Prevent empty clipboard" checked, there are still *some* times where blank clipboard entries occur. See highlighted attachment
Comment 19 Bharadwaj Raju 2021-09-10 16:34:05 UTC
(In reply to James Flynn from comment #18)
> Not to be contrary, but at least with specifically Firefox (91.0.2), this is
> still an issue on my Fedora 34 KDE install. It does appear this is even with
> the "Prevent empty clipboard" checked, there are still *some* times where
> blank clipboard entries occur. See highlighted attachment

Were you copying text from the webpage, or from the addressbar?

For some reason, the former works for me reliably, while the latter often doesn't and inserts a blank entry instead.
Comment 20 James Flynn 2021-09-10 22:36:25 UTC
(In reply to Bharadwaj Raju from comment #19)
> (In reply to James Flynn from comment #18)
> > Not to be contrary, but at least with specifically Firefox (91.0.2), this is
> > still an issue on my Fedora 34 KDE install. It does appear this is even with
> > the "Prevent empty clipboard" checked, there are still *some* times where
> > blank clipboard entries occur. See highlighted attachment
> 
> Were you copying text from the webpage, or from the addressbar?
> 
> For some reason, the former works for me reliably, while the latter often
> doesn't and inserts a blank entry instead.

Just text on a page, but happens to me often enough I forgot to mention that, sorry!
Comment 21 David Edmundson 2021-09-17 23:05:58 UTC
"text/plain;charset=utf-8" isn't treated as being text.

Should hopefully be a fast fix.
Comment 23 Nate Graham 2021-09-20 15:22:35 UTC
Fixed by David Edmundson with https://invent.kde.org/plasma/plasma-workspace/-/commit/2297983230521ee5f2a79054e66c50e84300c9ac in Plasma 5.23!