implement (small, up to 4k) clipboard sharing over DTLS
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
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::CaptureEventenum instead ofinput_event::Eventand splitinput_event::Eventintoinput_event::{InputEvent,ClipboardUpdate}or something. This way we could drop the dummy implementations on all of theinput_emulationbackends that do not support clipboard sharing. -
I would prefer to keep
clipboard_monitorandclipboard_emulationout of the service struct and instead move them into thelan_mouse::emulation::Emulation/lan_mouse::capture::Capturestructs 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 viaICaptureEventcould then be send to the emulation via an additional functionlan_mouse::emulation::Emulation::update_clipboard()andEmulationRequest::UpdateClipboard(ClipBoardEvent)inlan_mouse::emulationinstead of being handled directly in the service.
Let me know your thoughts!