Skip to content

knife-fish/CopyAnywhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CopyAnywhere

LAN clipboard sync for Windows, macOS, and Linux.

Current scope

  • Text clipboard sync only.
  • Manual file sending is available through the CLI, and the tray UI can send a selected file to an online trusted device.
  • Automatic peer discovery over UDP broadcast on the local network.
  • Encrypted transport with self-signed TLS certificates.
  • Pairing trust persisted locally after confirmation.
  • Local control plane for status, pause, resume, and stop.

Run

ca run

Start the tray app instead of the plain CLI service:

ca tray

On Windows, the default build already includes tray support. On Linux and macOS, build with --features desktop-ui when you want tray/dialog support.

Useful flags:

ca run --pairing prompt
ca run --pairing auto-accept

Query the running service:

ca status
ca config

Pause or resume sync without stopping the process:

ca pause
ca resume

Ask the running service to exit:

ca stop

Manually test file transfer to an already paired peer:

ca send-file t480 ./example.txt
ca send-file dd7b1e4a-2bd9-4a4c-a7d7-92f134863ef1 ./example.txt
ca send-file 192.168.1.10:37848 ./example.txt
ca send-files t480 ./a.txt ./b.txt
ca received-files
ca copy-received
ca copy-received 1
ca copy-received example.txt
ca open-received
ca open-received 1
ca reveal-received
ca reveal-received example.txt
ca open-inbox
ca prune-received-history
ca clear-received-history
ca transfers
ca retry-failed-transfer
ca retry-failed-transfer 1
ca clear-transfer-history

List trusted peers:

ca trust

Remove one trusted peer:

ca unpair <device-id>

Clear all trusted peers:

ca reset-trust
ca set-device-name my-laptop
ca set-pairing prompt
ca set-pairing auto-accept
ca autostart
ca enable-autostart
ca disable-autostart
ca set-listen-port 37848
ca set-discovery-port 37847
ca set-control-port 37849
ca reload-config
ca doctor
ca self-test
ca regression-test
ca export-diagnostics

Build release artifacts:

pwsh ./packaging/package-windows.ps1
sh ./packaging/package-macos.sh
sh ./packaging/package-linux.sh

Windows packaging details:

  • build.rs embeds Windows version metadata into ca.exe.
  • packaging/package-windows.ps1 produces:
    • dist/windows/portable/
    • dist/windows/ca-windows-portable.zip
    • dist/windows/installer/ca-setup.exe when Inno Setup iscc is installed
  • packaging/ca.iss is the Inno Setup script used for the installer build.
  • When you bump the app version, update both Cargo.toml and packaging/ca.iss.

Notes

  • Each machine must run CopyAnywhere in the foreground or as a background process.
  • Pairing confirmation now prefers a desktop dialog; terminal input is only used as a fallback when no GUI dialog is available.
  • Clipboard sync uses the system clipboard, so users still paste with the native Ctrl+V or platform equivalent.
  • The default config directory is the conf/ directory next to the ca executable unless --config-dir is provided.
  • run also starts a local control socket on 127.0.0.1:37849 by default; status, pause, resume, and stop talk to that control plane.
  • config prints the persisted device settings, config directory, and autostart entry path.
  • set-device-name updates the stored device name. Restart the service afterward so discovery broadcasts and TLS identity metadata reflect the new name everywhere.
  • set-pairing switches between prompt and auto-accept. This takes effect immediately when the service is already running.
  • autostart, enable-autostart, and disable-autostart manage per-user startup entries:
    • Windows: %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\ca-tray.cmd
    • macOS: ~/Library/LaunchAgents/com.copyanywhere.ca.plist
    • Linux: ~/.config/autostart/ca.desktop
  • reload-config reloads mutable settings from config.json into the running service. Port changes still require a restart because listeners are already bound.
  • set-listen-port and set-discovery-port update the stored ports. If the service is running, the change is saved immediately but takes effect only after a restart.
  • set-control-port updates the stored control port for the next launch. Change it while the service is stopped, or restart immediately after changing it.
  • doctor prints a diagnostic summary including config, runtime status, active transfers, recent warnings/errors, and Linux clipboard environment variables.
  • self-test performs executable local checks for config/inbox writability, clipboard availability, autostart entry resolution, and control-plane reachability.
  • regression-test creates a temporary isolated config, starts a local ca service instance, verifies control-plane operations, config reload, history read/write, file chunking, diagnostics export, and graceful shutdown, then removes the temp workspace.
  • export-diagnostics writes a JSON report under the active config directory's diagnostics/ subdirectory.
  • tray shows online devices and trusted devices in submenus, can forget trusted peers, exposes a Settings submenu for device name, listen/discovery ports, pairing policy, autostart, Open Config File, and Reload Config, and uses desktop dialogs for pair requests plus key runtime errors and pause/resume feedback.
  • send-file and send-files accept a device name, device id, or raw ip:port. In tray mode, Send File shows online trusted devices and opens a native multi-file picker before sending.
  • Batch sends now report per-file progress in the CLI and show start/completion notifications in tray mode.
  • The tray now shows live Active Transfers with progress percentages and a Recent Diagnostics submenu with the latest warnings/errors.
  • The tray also shows a compact top-level health summary derived from runtime failure counters.
  • regression-test is intentionally single-machine. It does not prove LAN discovery, cross-machine pairing, or real remote clipboard/file transfer.
  • In tray mode, incoming file transfers ask for confirmation first and let the user choose a save location. In plain CLI mode, incoming files continue to land in the default inbox automatically.
  • Received files are tracked in an inbox manifest with file name, size, source device, timestamp, and stored path metadata.
  • On macOS, a newly received file is also published to the local file clipboard automatically, so the user can paste it into Finder or another file target immediately after receipt.
  • On Linux, file clipboard publishing now works as a best-effort bridge through wl-copy or xclip when one of those tools is available in the desktop session.
  • On Windows, file clipboard publishing now works through a PowerShell/STA clipboard bridge, so received files can be pasted into Explorer or another file target in a normal desktop session.
  • copy-received publishes a received file back to the local file clipboard by latest item, 1-based index, transfer id, file name, or stored path.
  • open-received opens a received file locally by latest item, 1-based index, transfer id, file name, or stored path.
  • reveal-received reveals a received file in the local file manager.
  • open-inbox opens the local inbox directory.
  • prune-received-history removes manifest entries whose files no longer exist on disk.
  • clear-received-history clears the received-file manifest history without deleting the files themselves.
  • transfers lists recent send/receive outcomes from the transfer history.
  • retry-failed-transfer retries a recent failed send by latest item, 1-based index, transfer id, file name, peer id, peer name, or source path.
  • clear-transfer-history clears the transfer-history log.
  • The tray can also prune missing history entries, clear received history, and open, reveal, or copy recent received files directly.
  • The tray also shows a recent transfer summary submenu, can clear transfer history, and offers Retry ... for recent failed sends.
  • The tray can open the active config directory directly. Device-name editing is still CLI-driven because the current desktop dependency set does not include a cross-platform text-input dialog.
  • From the tray, changing the device name is immediate in config but still requires a service restart before other peers see the new identity everywhere.
  • From the tray, changing the listen or discovery port saves the new value and reminds you to restart the service. The control port remains a CLI/config-file setting because the live control socket cannot move transparently.
  • Local file clipboard publishing is implemented on macOS, as a best-effort bridge on Linux, and through PowerShell on Windows.
  • Desktop UI is enabled by default on Windows builds. On Linux and macOS, default builds stay CLI-only; use --features desktop-ui when you want tray dialogs and are willing to satisfy the platform GUI dependencies.
  • The packaging scripts create simple dist/<platform>/ folders with the built binary and README.md; they do not yet perform code signing or produce native installers.
  • Windows packaging now includes a native Inno Setup installer script, but code signing is still not configured.

About

LAN clipboard sync for Windows, macOS, and Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages