lan-mouse icon indicating copy to clipboard operation
lan-mouse copied to clipboard

implement (small, up to 4k) clipboard sharing over DTLS

Open dnakov opened this issue 3 months ago • 1 comments

Adds bidirectional clipboard sharing between all connected machines. Clipboard sharing is enabled by default. To disable, add to ~/.config/lan-mouse/config.toml: enable_clipboard = false

4KB max, no chunking, text only

dnakov avatar Oct 08 '25 18:10 dnakov

A few things - we dont have to fix any of this right away:

  • I'm not a fan of polling the clipboard. This seems a bit wasteful and it seems like there should be a better way? How do clipboard monitoring tools do it? Maybe, it would make sense to get the clipboard contents upon entering a client device? This would of course not synchronize the clipboard when copied though.

  • It might be worth having ClipboardEvent be a direct member of the input_capture::CaptureEvent enum instead of input_event::Event and split input_event::Event into input_event::{InputEvent,ClipboardUpdate} or something. This way we could drop the dummy implementations on all of the input_emulation backends that do not support clipboard sharing.

  • I would prefer to keep clipboard_monitor and clipboard_emulation out of the service struct and instead move them into the lan_mouse::emulation::Emulation / lan_mouse::capture::Capture structs respectively. We should not need a ClipboardReceived Event on the emulation side and could instead handle it like any other emulation event. ClipboardReceivedEvents coming from the input capture / connection via ICaptureEvent could then be send to the emulation via an additional function lan_mouse::emulation::Emulation::update_clipboard() and EmulationRequest::UpdateClipboard(ClipBoardEvent) in lan_mouse::emulation instead of being handled directly in the service.

Let me know your thoughts!

feschber avatar Oct 18 '25 11:10 feschber