gnattu / p2p-clipboard

A Peer-to-Peer cross-platform clipboard syncing tool.
MIT License
51 stars 1 forks source link

Feature Request: support file clipboard #1

Open warpdesign opened 2 weeks ago

warpdesign commented 2 weeks ago

It would be great if p2p-clipboard wasn't limited to pure text content and would allow sharing files through the clipboard.

Right now, copying a file from the Finder will only copy the filename.

gnattu commented 2 weeks ago

I thought about this during the initial implementation, but allowing the same kind of flexibility as current isn't trivial. Broadcasting arbitrary files over the network can lead to serious performance issues when the number of peers is large or the network bandwidth is too limited for the file size.

File delivery would require a new mechanism that implements proper pathfinding with path cost calculation. However, this is beyond the scope of my initial intention, which was simply to create an easy way to sync my clipboard across different OSes, as I wasn't satisfied with other implementations especially a lot of them require a central server.

For a trivial implementation, we could use the current network as is with a file size limit so that it does not overload the network interface, but even that would require handling platform-specific quirks related to pasteboard file management. The pasteboard library I'm using doesn't provide a unified API for file handling, which means I'd have to implement those platform specific functions myself and wrap them into a Rust API which is also not that strait forward.

I'm going to leave this open for now. Any help is appreciated.