Bug 465178 - Spectacle copied images have wrong mimetype
Summary: Spectacle copied images have wrong mimetype
Status: CLOSED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: git-master
Platform: Fedora RPMs Linux
: NOR major
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-02 14:53 UTC by Henning
Modified: 2023-05-05 09:31 UTC (History)
4 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 Henning 2023-02-02 14:53:19 UTC
SUMMARY
Trying to copy the system info using the button did not work


STEPS TO REPRODUCE
1. Trying to copy the system info from the settings
2. doesnt copy

OBSERVED RESULT
normally copying works. But suddenly, after a KDE crash (reported a few minutes earlier) no program can copy anymore, Firefox Flatpak with Ctrl+C or GUI popup, Settings with the button, Konsole with the Button


SOFTWARE/OS VERSIONS
Linux: fedora 37 kinoite
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
nothing showing up in journalctl
Comment 1 David Edmundson 2023-02-03 09:49:45 UTC
>KDE Frameworks Version: 5.102.0

An important change was made in 5.103. 

Please reopen if an issue remains then. In the interim you can disable klipper it should alleviate some problems. Let me know if it does not
Comment 2 Bug Janitor Service 2023-02-18 03:47:12 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Henning 2023-02-20 12:03:41 UTC
UPDATE:

This is fixed partly in the new Udate to 5.103 now.

Problem persists: Screenshot is automatically copied but when trying to paste to dolphin, its mimetype is "application/x-kde-onlyReplaceEmpty" instead of "image/png" or "image/jpeg"

Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.11-200.fc37.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 4 Henning 2023-02-21 12:07:04 UTC
Libreoffice works with copy-paste, so this only affects pasting to Dolphin
Comment 5 Noah Davis 2023-05-02 22:13:48 UTC
The original bug mentioned seems to be in the wrong category and it's not clear what it's about anymore, so I'm marking this as resolved. If you want spectacle to use your preferred image format when copying to clipboard, there's https://bugs.kde.org/show_bug.cgi?id=465781.
Comment 6 Henning 2023-05-04 08:29:57 UTC
No this is not solved? Occuring on 5.27.4

1. I take a screenshot and copy it to clipboard
2. In dolphin I press ctrl+v
3. A dialog for renaming the image appears, the format is PNG but in the dialog the default is something with KDE
4. I paste it with this mimetype, the image is broken and does not work

Spectacles images are PNGs. Saving it as jpeg does not reduce the size. So the solution is to set png as default
Comment 7 Henning 2023-05-04 08:31:37 UTC
So the problem is on KDE the extension is png but the mimetype something else
Comment 8 Noah Davis 2023-05-05 07:45:38 UTC
(In reply to Henning from comment #7)
> So the problem is on KDE the extension is png but the mimetype something else

The mimetype is application/x-qt-image (basically represents a QImage), which is expected when using QMimeData::setImageData() to send images to the clipboard (the usual way to send images to the clipboard). When you actually paste the image, the usual data format you get is PNG, probably because it's a lossless format that the original data can be easily converted to.

application/x-kde-onlyReplaceEmpty is not actually part of the image's mime data, it's an extra bit of data sent along with the other data when you have the option to prevent the clipboard from becoming empty enabled. This behavior is defined in Klipper, not Spectacle: https://invent.kde.org/plasma/plasma-workspace/-/blob/master/klipper/klipper.cpp#L818

The reason I closed this bug report was because there are 2 unrelated reports here. You can't go back and edit a bug report message on bugzilla and it would be best if a new bug report was created instead of using one bug report for 2 unrelated bugs. There doesn't seem to actually be a bug in Spectacle though, so I'm marking this as fixed since the original reported bug was fixed. Please make a new bug report if you still have a problem.
Comment 9 Henning 2023-05-05 08:53:50 UTC
For me the mimetype is "application/x-kde-onlyReplaceEmpty" and no matter if I just name a screenshot "test" or "test.png" it is not saved. If I manually switch the mimetype over to "PNG" then it is saved.

So the solution is just to make it default to PNG as a workaround, listen to users defaults in the end.

But how it is the image is not even saved in Dolphin.
Comment 10 Noah Davis 2023-05-05 09:31:06 UTC
Please make a new bug report for the Plasmashell product with the Clipboard component. There are 2 unrelated bug reports here and the first one was fixed.