Csync offers an easy CLI to share your clipboard between different devices. This is done through network, you should prepare a server that all your devices can access it.
Csync is written by Rust, it is very fast and lightweight!
You can find all bianry files from GitHub Release Page.
cargo install --git https://github.com/fioncat/csync
You need to prepare a server that all devices can access to perform data exchange. Run the following command in your server:
csync serve --bind "<bind-addr>" --password "<your-password>"
You can also run the server with docker:
docker run -e 7703:7703 fioncat/csync:latest --password <your-password>
.
Arguements:
--bind
: The server bind address, default is0.0.0.0:7703
.--password
: Optional, if provided, all data will be encrypted using AES. Your clipboard data will be safety exchanged in network. The client should configure the same password otherwise it won't be able to send or receive data from server.
Add a csync config file ~/.config/csync.toml
:
Linux (Wayland)
Require package wl-clipboard
.
# ~/.config/csync.toml
server = "127.0.0.1:7703" # The server address
device = "test-device" # The current device name, should be unique
password = "test password" # The server password
watch = ["ucloud-mac"] # The other devices to watch
[read]
cmd = ["wl-paste", "--no-newline"]
interval = 200
allow_cmd_failure = true
[write]
text_cmd = ["wl-copy"]
download_image = true
Linux (X11)
Require package xclip
.
# ~/.config/csync.toml
server = "127.0.0.1:7703" # The server address
device = "test-device" # The current device name, should be unique
password = "test password" # The server password
watch = ["ucloud-mac"] # The other devices to watch
[read]
cmd = ["xclip", "-o"]
interval = 200
[write]
text_cmd = ["xclip"]
download_image = true
MacOS
# ~/.config/csync.toml
server = "127.0.0.1:7703" # The server address
device = "test-device" # The current device name, should be unique
password = "test password" # The server password
watch = ["ucloud-mac"] # The other devices to watch
[read]
cmd = ["pbpaste"]
interval = 200
[write]
text_cmd = ["pbcopy"]
download_image = true
Run the following command to start syncing:
csync watch
You can manually send something to other devices:
csync send "Some text"
csync send -f /path/to/file
- tokio: The basic async runtime and network framework.
- tokio-miniredis: I referd to its tcp stream IO logic and protocol implement.
- arboard: Although I use external programs to interact with clipboard, but
arboard
is still a good cross-platform library to call clipboard using Rust. But sadly it does not support Wayland natively. - clipboard-master: Together with
arboard
, this is usually used to monitor clipboard events. But I still did not use this in csync since it does not support Wayland natively.
- Better docs
- Support Windows
- Better image support