Skip to content

Nicolas8aa/clip-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clipboard Sync Utility over SSH (Linux, X11)

Sync your clipboard from host → target over SSH with minimal setup. Built for Ubuntu/Linux desktops using xclip.

Quick Start

1) On the target machine

Install deps:

sudo apt update
sudo apt install xclip openssh-server
sudo systemctl enable --now ssh

Install the receiver (replace :1 with your actual DISPLAY):

./install.sh target --display :1

If clipboard writes fail, allow your user to access the X11 display:

xhost +SI:localuser:$USER

2) On the host machine

Install deps:

sudo apt update
sudo apt install xclip openssh-client

Install and connect (replace user@target-ip):

./install.sh host --target user@target-ip --gen-key --copy-id

This creates:

  • ~/.local/bin/clip-sync
  • ~/.config/clip-sync/host.env

To run as a service (optional):

./install.sh host --target user@target-ip --install-service

Usage

Start manually:

~/.local/bin/clip-sync run

Send current clipboard once:

~/.local/bin/clip-sync send-once

Optional: notifications (host)

If notify-send is available, the host shows a notification when sync starts/stops. Install it with:

sudo apt install libnotify-bin

Reinstall / Repair (Host)

If the service is failing or you updated the scripts, reinstall everything on the host:

./install.sh host --target user@target-ip --reinstall

Config Files

Host config: ~/.config/clip-sync/host.env

Keys:

  • CLIP_TARGET (required): user@target
  • CLIP_IDENTITY: path to SSH key (leave empty to use default)
  • CLIP_INTERVAL: poll interval in seconds (default 0.5)
  • CLIP_REMOTE_CMD: remote command to receive clipboard (default '$HOME/.local/bin/clip-receiver'). Keep $HOME single-quoted in the config so it expands on the target.
  • CLIP_HOST_DISPLAY: optional, set if systemd service lacks DISPLAY
  • CLIP_XAUTHORITY: optional, set if systemd service lacks XAUTHORITY

Target config: ~/.config/clip-sync/target.env

Keys:

  • CLIP_DISPLAY: X11 display used by the target (example :1)

systemd Notes

If the service starts but clipboard access fails, set these values in ~/.config/clip-sync/host.env:

CLIP_HOST_DISPLAY=":0"
CLIP_XAUTHORITY="$HOME/.Xauthority"

Then restart the service:

systemctl --user restart clip-sync.service

Security (Optional)

For least privilege, you can restrict the target key in ~/.ssh/authorized_keys to only run the receiver script.

Wayland

This utility uses X11 xclip. For Wayland, replace with wl-copy/wl-paste and update the scripts.

About

Simple clipboard sync over SSH for Linux/X11.

Resources

License

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages