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

Files & directories support by path #51

Open
betamos opened this issue Jun 2, 2022 · 5 comments
Open

Files & directories support by path #51

betamos opened this issue Jun 2, 2022 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@betamos
Copy link

betamos commented Jun 2, 2022

I'm interested in getting the paths of files & directories copied from explorer/finder/etc. Is this a use case that will be supported?

I just tried on MacOS, and through the get_text() API I got the names of the files/dirs separated by \r, but not the full paths, nor a way to distinguish between regular text and file paths.

Thanks for creating and maintaining this library!

@ArturKovacs
Copy link
Collaborator

There's a partial implementation for this on the any-format branch. If that branch gets finished; it could be merged to master and released. No-one is working on it as far as I know, so feel free to take it up.

@complexspaces
Copy link
Collaborator

complexspaces commented Jun 4, 2022

These are my higher-level findings so far:

Windows: clipboard-win has support for this in the high API.
macOS: NSPasteboardURLReadingFileURLsOnlyKey lets you do a similar and read an array of file URLs from the clipboard.
Linux: ???

@betamos
Copy link
Author

betamos commented Jun 11, 2022

Apologies for late reply. This is great.

There's a partial implementation for this on the any-format branch.

Just checked it out. You got really far, but I also understand it's hard to keep working on it - it's a lot of formats!

Would you be willing to accept a smaller, incremental step in this direction by having file URLs supported with a similar API to today? For instance, simply by adding a get_file_paths() -> Result<Vec<PathBuf>, Error> API? If so, I'd be more than happy to take a stab.

Windows: clipboard-win has support for this in the high API.
macOS: NSPasteboardURLReadingFileURLsOnlyKey lets you do a similar and read an array of file URLs from the clipboard.

Looks very promising. Thanks!

Linux: ???

Tried to research the X11 APIs - it looks a bit tricky but I can take another look when I'm less tired. I happened to see that GTK seems to support this directly. Could that be appropriate for this crate?

@betamos
Copy link
Author

betamos commented Jun 13, 2022

Took a look at the X11 bindings, but it appears to be quite an undertaking. I couldn't justify investing that level of effort at the moment.

I made my own single-purpose crate for this to get something that works for my use case today: https://github.com/betamos/clipboard-files. It uses gtk for the linux implementation instead.

I'd still love to see file path support in this crate, and happy to help out if I can. Thanks.

@enomado
Copy link

enomado commented Feb 1, 2024

Please just expose this updates(DoumanAsh/clipboard-win#24) for windows
and accept text/uri-list atom on linux

@complexspaces complexspaces added enhancement New feature or request good first issue Good for newcomers labels Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants