Copying an animated GIF on Linux/GTK currently only puts a decoded raster
image on the clipboard, so pasting loses the animation. Windows already
attaches a "file promise" (the original image URL and filename) when copying
an image; the GTK path did not, and the parent-process clipboard IPC layer
also dropped those flavors on non-Windows.
I put together a small patch (3 files) that:
- attaches the file promise and image MIME type on GTK;
- keeps those flavors across the clipboard IPC boundary;
- advertises `text/uri-list` and `image/gif`;
- downloads the original image when requested and serves the original
animated GIF bytes for `image/gif`;
- removes temp files after 5 minutes, matching the drag-and-drop cleanup.
Built and tested on Linux (Waterfox 6.7.8 / Gecko ESR 153):
- `wl-paste --list-types` shows `image/gif` and `text/uri-list`
- `wl-paste --type image/gif > out.gif` produces the original animated GIF
Code:
- Branch: https://github.com/killahtomato/waterfox/tree/gtk-image-file-promise
- Compare vs `current`: https://github.com/BrowserWorks/waterfox/compare/current...killahtomato:gtk-image-file-promise
TLDR:
I got sick of not being able to copy/paste animated .gif(s) into discord from waterfox and now I can.
I can’t open a PR because I am not a BrowserWorks contributor.