Bug 444037 - [Wayland] Location of a screenshot taken via keyboard shortcut is not copied to clipboard
Summary: [Wayland] Location of a screenshot taken via keyboard shortcut is not copied ...
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-19 12:19 UTC by Patrick Silva
Modified: 2022-10-11 17:44 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 22.12
Sentry Crash Report:


Attachments
screeen recording (3.34 MB, video/x-matroska)
2021-10-23 15:36 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2021-10-19 12:19:12 UTC
STEPS TO REPRODUCE
1. use Wayland session
2. make sure "Autosave file to default folder" is unchecked and "Copy file location to clipboard" is selected in Spectacle settings
3. close Spectacle
4. take a screenshot by pressing shift+printscreen 

OBSERVED RESULT
screenshot is saved to disk and file location is not copied to clipboard

EXPECTED RESULT
screenshot should not be saved, file location should be copied to clipboard

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.23.80
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Comment 1 Patrick Silva 2021-10-23 13:36:54 UTC
(In reply to Patrick Silva from comment #0)
> EXPECTED RESULT
> screenshot should not be saved, file location should be copied to clipboard

Well, it's not possible to copy the location of a screenshot
that does not exist. lol

On X11, a screenshot taken via keyboard shortcut is saved to default folder even if "Autosave file to default folder" is unchecked in Spectacle settings and its location is copied to clipboard. This is the expected result.
Comment 2 Patrick Silva 2021-10-23 14:04:06 UTC
Also file location is not copied when I take a screenshot by clicking on
'Take a new screensot' button.
Comment 3 Patrick Silva 2021-10-23 15:29:59 UTC
More info:
When I open Spectacle by pressing printscreen key, Spectacle displays an inline
message saying "...and its location has been copied to clipboard", but nothing is copied to clipboard. Then I click on "Take a new screenshot" button, Spectacle
displays the same inline message and again nothing is copied to clipboard.
However, if I save the screenshot, the file location is copied to clipboard as expected. Please watch the attached screens recording.
Comment 4 Patrick Silva 2021-10-23 15:36:10 UTC
Created attachment 142796 [details]
screeen recording
Comment 5 Patrick Silva 2022-05-23 11:12:14 UTC
1. make sure 'After taking a screenshot: Save file to default folder' is unchecked and 'Copy file location to clipboard' option from the combobox below 'Save file to default folder' is selected
2. if Spectacle is open, close it
3. take a screenshot by pressing shift+printscreen

Observed result: Plasma shows a notification saying:
'A screenshot was saved as 'Screenshot_20220523_074700.png' to '/location/of/the/screenshot' and the file path of the screenshot has been saved to your clipboard.'

The screenshot was saved but its path was not copied to clipboard.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.4
Graphics Platform: Wayland
Comment 6 Patrick Silva 2022-05-23 15:28:16 UTC
In fact currently the location is not copied to clipboard even when 'Save file to default folder' is checked in Spectacle settings.
Comment 7 Bharadwaj Raju 2022-10-03 15:32:25 UTC
So there are multiple bugs described in here:

1. If autosave is off and copy-location is on, Spectacle main window will display a false message that the image has been saved and its location copied, despite none of the two things happening.

2. If autosave is off and copy-location is on and Spectacle is not running and you take screenshot with a shortcut, it actually does save the image but falsely says in the notification that its location has been copied.

3. If autosave is on and copy-location is on and Spectacle is not running and you take screenshot with a shortcut, it saves the image but doesn't copy location (and falsely says that it did).


For (2) I'm not sure what can sensibly be done in such a case. Just show a notification with the image without saving or copying anything at all? Should the notification be persistent in that case?
Comment 8 Bharadwaj Raju 2022-10-03 15:48:59 UTC
For one I think the "copy location to clipboard" shouldn't even be selectable when autosave is off. The combination doesn't make sense
Comment 9 Bharadwaj Raju 2022-10-03 15:59:13 UTC
See also https://bugs.kde.org/show_bug.cgi?id=446884
Comment 10 Bug Janitor Service 2022-10-03 17:38:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/158
Comment 11 Bharadwaj Raju 2022-10-11 11:44:44 UTC
Git commit c431ab3d2586d9e9377957307540414d48c92b75 by Bharadwaj Raju.
Committed on 11/10/2022 at 11:44.
Pushed by bharadwaj-raju into branch 'master'.

Fix copying path to clipboard in ExportManager

We should be using KSystemClipboard there, not QApplication::clipboard or such

M  +3    -1    src/ExportManager.cpp

https://invent.kde.org/graphics/spectacle/commit/c431ab3d2586d9e9377957307540414d48c92b75