Bug 477903 - Temporary screenshot is removed too quickly
Summary: Temporary screenshot is removed too quickly
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 24.01.80
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-12-02 10:08 UTC by hch12907
Modified: 2023-12-09 05:32 UTC (History)
2 users (show)

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


Attachments
An error message that shows up after clicking on Spectacle notification (94.42 KB, image/png)
2023-12-02 10:08 UTC, hch12907
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hch12907 2023-12-02 10:08:31 UTC
Created attachment 163753 [details]
An error message that shows up after clicking on Spectacle notification

SUMMARY
After taking a screenshot using the Capture Rectangular Region shortcut key, a notification pops out which supposedly should open the screenshot in Gwenview once clicked on. However, instead of showing the image Gwenview complains about a /tmp/Spectacle.xxxxxx file not existing.

STEPS TO REPRODUCE
1. Take a screenshot using the Capture Rectangular Region shortcut
2. Click on the notification from Spectacle
3. Gwenview shows an error message dialog (in attachment)

OBSERVED RESULT
Gwenview complains that /tmp/Spectacle.xxxxxx/Screenshot_xxxxxxx_xxxxxx.png does not exist

EXPECTED RESULT
Gwenview should open the screenshot normally

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.3-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 7 4700U with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Comment 1 Nate Graham 2023-12-05 21:19:54 UTC
Do you have Spectacle set up to copy the image to the clipboard automatically?
Comment 2 hch12907 2023-12-06 17:39:55 UTC
(In reply to Nate Graham from comment #1)
> Do you have Spectacle set up to copy the image to the clipboard
> automatically?

Yes. In the settings, "After taking a screenshot" is set to "Copy image to clipboard". The other settings are the same as default (except shortcut key, but that shouldn't affect program behaviour).
Comment 3 Noah Davis 2023-12-06 18:37:36 UTC
If I make Spectacle keep a copied image for 10 seconds by keeping itself alive for 10 seconds after being closed, Gwenview will still stop showing the image the moment it is deleted. I could prevent Spectacle from automatically deleting its temporary files when closed, but that could cause lots of screenshots to pile up for users that don't reboot often. I could try making Spectacle delete its previous temp dirs at startup, but that might also slow down startup. It also might not slowdown startup if I use synchronous KIO jobs or it might only have a minimal effect on startup time.

I feel like I should point out that system notification behavior isn't very customizeable. If it was possible, the low risk solution would be to make clicking the thumbnail do nothing, but right now it unconditionally opens whatever URL was used for the thumbnail instead of doing the default action.
Comment 4 Noah Davis 2023-12-06 18:39:18 UTC
> if I use synchronous KIO jobs

*asynchronous
Comment 5 Bug Janitor Service 2023-12-06 19:47:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/303
Comment 6 Noah Davis 2023-12-07 17:35:49 UTC
Git commit cadb8a03c85ff2528ddb5546f6829f7c80157d91 by Noah Davis.
Committed on 07/12/2023 at 18:34.
Pushed by ndavis into branch 'master'.

Keep temp files until a new temp dir is created

M  +10   -0    src/ExportManager.cpp

https://invent.kde.org/graphics/spectacle/-/commit/cadb8a03c85ff2528ddb5546f6829f7c80157d91