Bug 434675 - Copying text from notifications does not work on Wayland
Summary: Copying text from notifications does not work on Wayland
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 5.21.0
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2021-03-20 14:38 UTC by Nate Graham
Modified: 2021-08-16 14:49 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2021-03-20 14:38:27 UTC
Everything KDE from git master on top of openSUSE Tumbleweed, in the Plasma Wayland session.


STEPS TO REPRODUCE
1. Get a notification, or generate one yourself with `notify-send foo bar`
2. 2. Use the mouse to select some text in the notification and right-click > Copy

OBSERVED RESULT
The text does not appear in Klipper, and therefore cannot be pasted into the place where you wanted to paste it


EXPECTED RESULT
Text appears in Klipper and can be pasted


Nothing is printed to the console log.
Comment 1 Armin 2021-04-29 06:34:04 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 2 Aleix Pol 2021-04-29 13:20:12 UTC
I don't get to select the text at all.

Are you sure this is supposed to work?
Comment 3 Alex 2021-05-02 06:12:54 UTC
I can also reproduce this, on Fedora 34 with Plasma 5.21.4.

(In reply to Aleix Pol from comment #2)
> I don't get to select the text at all.
> 
> Are you sure this is supposed to work?

I can select the body text, but not the title text. So with the example of `notify-send foo bar`, "bar" is selectable, and right clicking on it brings up a context menu with a Copy option.

Since 3 people are able to reproduce this, I'll mark this bug as confirmed.
Comment 4 Nate Graham 2021-05-04 19:17:44 UTC
(In reply to Alex from comment #3)
> I can also reproduce this, on Fedora 34 with Plasma 5.21.4.
> 
> (In reply to Aleix Pol from comment #2)
> > I don't get to select the text at all.
> > 
> > Are you sure this is supposed to work?
> 
> I can select the body text, but not the title text. So with the example of
> `notify-send foo bar`, "bar" is selectable, and right clicking on it brings
> up a context menu with a Copy option.
> 
> Since 3 people are able to reproduce this, I'll mark this bug as confirmed.
I can confirm all of those things.

The title not being selectable is not a wayland-specific bug though, as it happens on X11 too.
Comment 5 Kai Uwe Broulik 2021-06-20 17:59:28 UTC
Probably because the notification window never gets focus and on Wayland only windows that have focus can interact with the clipboard.

Maybe we can abuse the inline reply thing and once you open the context menu let the popup get focus because at this point you clearly wanted to interact with it anyway.
Comment 6 Bug Janitor Service 2021-08-04 12:33:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwayland-server/-/merge_requests/272
Comment 7 Bug Janitor Service 2021-08-11 09:33:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1006
Comment 8 David Redondo 2021-08-16 14:32:37 UTC
Git commit 60ff1e04e40765f5c28b5f6ab0c953840549ffa1 by David Redondo.
Committed on 16/08/2021 at 14:30.
Pushed by davidre into branch 'master'.

Let the notification take focus when interacted with

On wayland we need focus to copy to the clipboard.
As we don't want the notification to take focus indiscriminately,
it listens to mouse events of its children and only accepts focus
if it sees a button press. When  the cursor leaves the popup again,
everything is reset.
Related: bug 408507

M  +12   -2    applets/notifications/package/contents/ui/NotificationPopup.qml

https://invent.kde.org/plasma/plasma-workspace/commit/60ff1e04e40765f5c28b5f6ab0c953840549ffa1