flameshot
flameshot copied to clipboard
Broken copy on Wayland (Hyprland)
Flameshot Version
Flameshot v12.1.0 (a7e0a618)
Installation Type
User repository (AUR)
Operating System type and version
Arch Linux (up-to-date)
Description
When copying big images to the clipboard, they will often get corrupted.
I am branching this off from https://github.com/flameshot-org/flameshot/issues/2978, since I believe having this as a separate, more specific, issue might be more useful.
Also, I'm unable to paste them in most apps (I can, however, in tg desktop). I was only able to paste the images posted here thanks to telegram. I sent them there first, saved those images and posted them here.
Having a daemon running and using flameshot full -c
will result in the daemon outputing
flameshot: info: Capture saved to clipboard.
maximum memory limit (134217728) would be exceeded
cannot create matrix
cannot encode main body
jpc_encode failed
jpc_encode failed
Steps to reproduce
flameshot full -c
or flameshot gui
with a big region
Try to paste
Screenshots or screen recordings
I am also getting a lot of artifacts, the preview looks fine, the screenshots however sometimes get weird:
- they get "squashed" horizontally (about 1 in 10 times)
sample image
- they are a black and white mess (rarely)
sample image
sample image 2
- the resolution goes super-low (about 5 in ten)
sample image
- ...
getting those images took quite a lot of attempts lol (got them using `flameshot full -c)
This is what those images are supposed to look like
System Information
- Arch Linux
- Not relevant
- Hyprland (Wayland)
- I am using wl-clip-persist, but that doesn't seem to apply to flameshot as I still need a running daemon
I can confirm this on Kubuntu 23.04 with Wyland.
@SalamandraDevs Mind sharing some samples, just to confirm we're having the same issue?
I experienced this issue too, when pasting screenshot to slack - the image is not fully rendered. still works with uploading it to imgur. it could be related to #3059
Im currently working on a custom fork. But can confirm this is, at least in part, due to the different code that runs when copying to clipboard (might be wayland/qt specific). I've been looking into it, but it's difficult to debug. Not being able to paste it into certain applications has to do with this + some MIME stuff. With the same clipboard you sometimes can't paste into firefox but pasting into GIMP usually works. Is everyone in this thread running wayland? That might help narrow it down
@FelixJochems Hyprland only runs on Wayland
Could this be QT's fault? telegram desktop also has the same issue sometimes when copying an image from within the program
Im having the same issue using Hyprland. Here, where im pasting it to Schildichat, the image gets cut off. The resolution seems to stay the same, but clearly the entire image doesnt get rendered, resulting in most of the screenshot being blank. What I found interesting is that the image file size always ends up being related to two (dont know how to say it in english, but: 32, 64, 128). In this example the image is 64kb large.
This only happens when copy and pasting images, saving them to a file and then uploading them works fine.
Yeah the issue seems to be completely related to the clipboard
I have had the same issue for a while and my "workaround" is using copyq
. When I copy something from flameshot, it's guaranteed to be corrupted, however, if I then grab that copy from the immediate history in copyq, it's fine. I can then paste it anywhere.
would you mind clarifying what you're doing exactly?
edit: actually, same when using cliphist
Sure, sorry for the brevity.
-
Open flameshot and select area
-
Click on the copy button, or ctrl+c to copy the selected area.
-
Corrupt screenshot is produced and I can't utilize that copy anywhere.
-
Click on CopyQ to see clipboard history and double click the copied image I just grabbed to re-add it to my clipboard
-
Paste anywhere and enjoy.
yeah sorry I just didn't know what copyq was
cliphist does the same
Can confirm the same behavior only after moving from i3 to sway. Have followed all recommendations for Wayland in the documentation without improvement. Pasting into an actual image program like Nomacs, geeqie, gwenview, etc pastes normally and I can then copy out of that into the programs where I would only get a partial paste from flameshot such as Discord, Teams, firefox, etc. successfully. I read about the copyq workaround above and confirm that also works for me.
Instead of going through cliphist or other tools, you can just use flameshot gui --raw | wl-copy
as mentioned in this comment https://github.com/flameshot-org/flameshot/issues/2848#issuecomment-1368644640
Based on @zeykafx' comment above, I came up with this workaround that does what I want:
XDG_CURRENT_DESKTOP=Sway \
flameshot gui --raw > /tmp/screenshot.png && \
wl-copy < /tmp/screenshot.png && \
mv /tmp/screenshot.png ~/Pictures/Screenshots/$(date "+%Y-%m-%d_%H-%M-%S").png
In my hyprland configuration:
bind = , Print, exec, XDG_CURRENT_DESKTOP=Sway flameshot gui --raw > /tmp/screenshot.png && wl-copy < /tmp/screenshot.png && mv /tmp/screenshot.png ~/Pictures/Screenshots/$(date "+%Y-%m-%d_%H-%M-%S").png
This solves multiple issues:
- Setting
XDG_CURRENT_DESKTOP
to Sway makes it work on Hyprland to begin with. Might not be relevant on other platforms - Saves the image to a temporary screenshot file
- Copies that temporary file to the wayland clipboard
- Saves a copy of the file to my Screenshots directory
Is everyone in this thread running wayland? That might help narrow it down
The issue happens to me only under Wayland (sway). On Xorg (i3wm) it works fine.
happens to me to on hyprland and nixos