Bug 433883

Summary: Spectacle isn't saving to clipboard whenever "Show message in a popup" is unticked and an alternative "Capture rectangular region" shortcut is defined
Product: [Applications] Spectacle Reporter: heqromancer
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: bharadwaj.raju777, kde, kde, nate, ranaveer323
Priority: NOR    
Version First Reported In: 22.08.1   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=451763
https://bugs.kde.org/show_bug.cgi?id=444037
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description heqromancer 2021-03-02 22:22:49 UTC
SUMMARY
Spectacle won't save to clipboard when the option to do so is enabled given a handful of conditions are met.

STEPS TO REPRODUCE
1. Define a custom shortcut for "Capture Rectangular Region" (in my case, Meta+Shift+S)
2. Configure Spectacle to Copy Image to the Clipboard after a screenshot is taken.
3. System Tray > Notifications applet > Configure Event Notifications and Actions... > Hit "Configure" at the right of the "Applications:" label
4. Select Spectacle from the list > Configure Events... > Untick "Show message in a popup"

OBSERVED RESULT
The screenshot does not get saved to the clipboard.

EXPECTED RESULT
The screenshot should be saved to the clipboard.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 5.21.1
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.11.1-1-MANJARO
OS Type: 64-bit
Graphics Platform: X11

ADDITIONAL INFORMATION
Making use of the default shortcut (Meta+Shift+Print) won't cause this problem on my end.
Comment 1 hexchain 2022-09-17 07:51:51 UTC
I can still reproduce this issue with spectacle 22.08.1.

Operating System: Arch Linux
KDE Plasma Version: 5.25.90
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6
Graphics Platform: Wayland
Comment 2 Bharadwaj Raju 2022-10-03 09:59:13 UTC
So what happens is that if notifications are disabled like that, the KNotification object in Spectacle is destroyed immediately, and my guess is that this is causing Spectacle to exit before the clipboard can be set. It doesn't seem to matter what the shortcut is, though.

I wonder if just adding a short timer before emitting allDone would be enough.
Comment 3 Bug Janitor Service 2022-10-03 10:04:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/154
Comment 4 Bharadwaj Raju 2022-10-03 11:00:13 UTC
*** Bug 451763 has been marked as a duplicate of this bug. ***
Comment 5 Bharadwaj Raju 2022-10-15 21:21:33 UTC
Git commit 0a5967b069e2016ec3fe7d4610784370aad7e70f by Bharadwaj Raju.
Committed on 15/10/2022 at 21:20.
Pushed by bharadwaj-raju into branch 'master'.

Add a small delay before exiting when notification is destroyed

The destruction of the notification object happens immediately if
Spectacle is blocked from showing notifications, and in such cases
it exits before data can be copied to the clipboard.

M  +5    -3    src/SpectacleCore.cpp

https://invent.kde.org/graphics/spectacle/commit/0a5967b069e2016ec3fe7d4610784370aad7e70f