Forum

Welcome, Log in or Register
Hello PureRef Team,

Firstly, huge thanks for this amazing software. I love and use it for many years now! <3

I'm experiencing a consistent issue when copying images from PureRef pasting them into native Wayland applications on Linux. It seems like the clipboard data transfer is partially successful on the first attempt but then breaks down.

Environment:

- OS: Arch Linux
- Compositor: Hyprland (Wayland)
- PureRef Version: 2.0.3
- XWayland Version: xorg-xwayland 24.1.6-1

Problem Description:

When PureRef is running (via XWayland) and I copy an image:

1. The first attempt to paste this image into a native Wayland application (tested using wl-paste) results in a partial or corrupted image file. For example, if it's a PNG, the file is created, but an image viewer shows only a portion of the image or reports corruption.

2. Any subsequent attempts to copy the same image (or different images) from PureRef and paste via wl-paste result in a 0-byte file. The clipboard transfer for image data to Wayland seems to completely fail after the first problematic attempt.

3. Importantly, copying from one PureRef instance and pasting into another PureRef instance (which is X11-to-X11 communication within the XWayland environment) works perfectly with the full image, even after the Wayland pasting has started to fail. This suggests the image data is correctly on the X11 clipboard within PureRef's XWayland environment.

4. Using wl-paste --list-types after copying from PureRef shows that PureRef is correctly advertising a rich set of MIME types, including image/png, image/bmp, application/x-qt-image, etc., to the Wayland side. But they all seem to be null (0 data).

Steps to Reproduce:

1. Ensure the system is in a relatively fresh state (e.g., after a reboot or when the clipboard is known to be working).
2. Launch PureRef (running under XWayland).
3. Load an image into a PureRef scene.
4. Select the image in PureRef and copy it (e.g., Ctrl+C).
5. Open a Wayland terminal and run the command: wl-paste -t image/png > /tmp/pureref_first_copy.png
6. Attempt to open /tmp/pureref_first_copy.png with an image viewer.
- Observed: The image is typically partial or appears corrupted.
7. Go back to PureRef and copy the same image again (or a different image).
8. In the Wayland terminal, run the command: wl-paste -t image/png > /tmp/pureref_second_copy.png
9. Check the file /tmp/pureref_second_copy.png.
- Observed: The file size is 0 bytes.
10. (Optional) Confirm that copying from PureRef and pasting into another PureRef window still works correctly.

Expected Results:

The image/png (or other requested standard image types) data should be fully and correctly transferred to the Wayland clipboard on every attempt, allowing complete images to be pasted into native Wayland applications.

Actual Results:

A partial/corrupted image is transferred on the first attempt, and subsequent attempts transfer no image data (0-byte files) to Wayland applications.

Possible Indication:

This behavior suggests that while PureRef seems to correctly offer the image data and its types to the X11 clipboard, the process of transferring this data across the XWayland-to-Wayland bridge is encountering an issue. The first attempt at transfer seems to be incomplete and potentially leaves the XWayland-to-Wayland clipboard pathway in a broken state for subsequent image transfers.

A Note on Wayland Support:

While troubleshooting this XWayland-specific issue, I also wanted to mention that native Wayland support for PureRef would be a fantastic improvement for Linux users. It would likely bypass these kinds of clipboard bridging complexities entirely and could offer better performance and integration on modern Linux desktops. I believe would be highly appreciated by the community. Currently trying to build the app for Wayland seems to not work for me at all (I do have all the latest qt-wayland plugins installed and I've tried to debug it quite a bit. Not sure what's failing).

Thank you for looking into this!
Thank you for the detailed report! All that should be completely handled by Qt so we checked their bug tracker and found this one which might be related, we'll try to cherry pick the fix and see if that helps when we find time.

Unfortunately we use X11 directly in a few places to support the different non-standard windowing features (always on top of... and system global shortcuts) so it is not completely straight forward to port to native Wayland...

In the just released beta version of PureRef 2.1.0 we've made it so that copy creates a temporary png on disk, which is put in the clipboard, maybe that could help as a workaround for now?
Sorry, only registered users may post in this forum.

Click here to login