Bug 460499 - Cannot paste from clipboard after notification popup timeout without the clipboard tray applet
Summary: Cannot paste from clipboard after notification popup timeout without the clip...
Status: RESOLVED NOT A BUG
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 22.08.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-15 18:32 UTC by hexchain
Modified: 2022-10-18 16:31 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 hexchain 2022-10-15 18:32:10 UTC
SUMMARY
If "Clipboard" is disabled in System Tray, Spectacle cannot keep its content in the clipboard after the notification popup disappears.

STEPS TO REPRODUCE
1. Disable "Clipboard" under "Configure System Tray" -> "Entries"
2. Run spectacle -bmc
3. Wait for the notification popup to disappear
4. Try to paste

OBSERVED RESULT
Cannot paste anything.

EXPECTED RESULT
It should be able to paste the screenshot.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 6.0.1-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Comment 1 Nate Graham 2022-10-16 04:13:46 UTC
When you disable the clipboard manager, the system isn't capable of storing clipboard data after the app that provided it quits; that's one of the features that it provides. Once the notification disappears, Spectacle quits.

I would recommend that you avoid disabling the clipboard service if you want to use the features that it provides! :)
Comment 2 hexchain 2022-10-16 04:31:57 UTC
Some applications (like wl-copy) keep themselves running until they lose grip on the clipboard. Is it desirable for Spectacle to do the same?
Comment 3 Nate Graham 2022-10-16 14:53:41 UTC
Can you outline what would that look like for Spectacle?
Comment 4 hexchain 2022-10-16 15:24:36 UTC
(In reply to Nate Graham from comment #3)
> Can you outline what would that look like for Spectacle?

It would look like this:

Spectacle would not quit immediately after a screenshot. Instead, it would wait while it still "owns the clipboard" (i.e. a paste action elsewhere would paste from Spectacle). It only quits once it loses ownership.

To demonstrate this behavior with wl-copy:

- In a terminal, run "echo 1234 | wl-copy -f"
-> wl-copy waits in the foreground; at the same time, pasting shows "1234"
- Copy something to the clipboard
-> wl-copy quits
Comment 5 Nate Graham 2022-10-17 19:17:34 UTC
Do you have an idea for how it could know that? How does wl-copy do it?
Comment 6 hexchain 2022-10-18 03:41:27 UTC
In wl-copy I think it listens to the "wl_data_source::cancelled" (or similar) event to determine if it is still the clipboard owner.

I did some experiments with PyQt and this can somehow be done by listening to the QClipboard::dataChanged event and checking QClipboard::ownsClipboard. However, it only seems to work if there is a window.
Comment 7 Nate Graham 2022-10-18 16:31:41 UTC
Yeah that won't work for Spectacle unfortunately.