Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy "entire" file (not just file content) #244

Open
ysooqe opened this issue Nov 23, 2024 · 4 comments
Open

Copy "entire" file (not just file content) #244

ysooqe opened this issue Nov 23, 2024 · 4 comments

Comments

@ysooqe
Copy link

ysooqe commented Nov 23, 2024

Hi there,

I have looked around this repo, but I haven't found a matching issue.

How can an "entire" file be copied to the clipboard so that it can be pasted into other applications like web-browsers or email-clients (e.g. as attachments)?

When I do something like $ wl-copy < my_document.pdf, it appearently only copies the file content, but not the entire file. I can not paste the copied file into another application with Ctrl+V.

What is the command to copy the entire file into the clipboard via wl-copy?

@bugaevc
Copy link
Owner

bugaevc commented Nov 23, 2024

Hi, please see #26

In particular, something like this is likely to do what you want:

$ wl-copy -t text/uri-list "file://$(realpath my_document.pdf)"

@ysooqe
Copy link
Author

ysooqe commented Nov 23, 2024

Thanks for the quick reply! Unfortunately, this does not seem to work (and neither do the suggestions from the linked issue thread).

In Gnome, when I go to Nautilus and Ctrl+C on a file, $ wl-paste --list-types gives me

text/plain;charset=utf-8
text/uri-list
application/vnd.portal.files
application/vnd.portal.filetransfer
x-special/gnome-copied-files

and $ wl-paste returns

/home/user/my_document.pdf

and I can easily paste this file into other applications using Ctrl+V.

Now I tried doing $ wl-paste | wl-copy -t <type> where <type> is any of the above, then I tried to paste this into another application with Ctrl+V to see what happens; but nothing happend for any of the types (and I made sure to re-copy the file from Nautilus between trying this command with different types).

So this kind of seems like there must be something else that Nautilus is copying into the clipboard compared to wl-copy?

@Vaisakhkm2625
Copy link

Vaisakhkm2625 commented Nov 30, 2024

i came here cuz https://yazi-rs.github.io/docs/tips/#selected-files-to-clipboard wasn't working...

what i found was

wl-copy -t x-special/gnome-copied-files file:///home/vaisakh/Vide
os/getvid.mp4

now i can paste to thunar(maybe nautilus too?) file manager, but not to browser

wl-copy -t text/uri-list file:///home/vaisakh/Videos/getvid.mp4

now i can paste to browser (firefox)

can i specify both type at once?

@septatrix
Copy link

wl-copy -t text/uri-list "file://$(realpath my_document.pdf)"

This especially does not work for portals as they use something different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants