bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 59 forks source link

Possible to copy/paste videos ? #160

Closed cenunix closed 1 year ago

cenunix commented 1 year ago

I understand how to use the mime types for image files, however for my use case (screenshotting or screenrecording and pasting into discord), I'm unable to get video files working. For example, I can take a screenshot and use wl-copy -t image/png < "picture-path.png", and paste this image straight into a discord chat. However I was wondering if this is at all possible with a screenrecording/video file? (mp4). If I open thunar and copy the video file I can paste it into discord, I'm looking to reproduce this behavior, and as the functionality exists in thunar i'm hopeful it could exist in wl-clipboard as well.

bugaevc commented 1 year ago

When you copy a file from Thunar, it most likely does not copy the actual video into the clipboard, but instead only copies the path (or a file:// URL). You can see this for yourself if you copy your video from Thunar and then play with wl-paste, e.g.:

$ wl-paste --list-types
text/uri-list
some other type
$ wl-paste -t text/uri-list
file:///home/you/Videos/video.mp4

So try to recreate the same thing with wl-copy, and the browser should hopefully pick that up and present it to Discord as a real video file.

bugaevc commented 1 year ago

And if that does work while putting the video into the clipboard directly (with -t video/mp4) does not, consider complaining to your browser's developers 🙂, the latter should also work.

cenunix commented 1 year ago

thanks for the response and apologies for my late one, I tried to recreate wl-paste --list-types in the discord client but no luck. I will try and bring up the issue to them, however discord has not necessarily reached full feature parity with windows yet on linux so I won't hold my breath ha.

mdotv commented 1 year ago

Selmer443, you can achieve it using this: $ echo -n "file://your_video_file_path" | wl-copy -t text/uri-list

I like to use it with fzf utility: $ ( echo -n "file://" && readlink -e "$( fzf )" ) | wl-copy -t text/uri-list