Skip to content

nevergiveup-c/clipboard-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clipboard-sync

Description

Cross-platform P2P solution for synchronizing text clipboard on a local network. The project may contain issues as it was created in a hurry, but no problems occurred during usage.

Installation

git clone https://github.com/nevergiveup-c/clipboard-sync.git
cd clipboard-sync
pip install -r requirements.txt

Configuration

Create config.yaml in the project directory:

key: your-encryption-key-here
nodes:
  pc1:
    host: 192.168.1.10
    port: 5555
  pc2:
    host: 192.168.1.11
    port: 5555
  laptop:
    host: 192.168.1.20
    port: 5555

Generate key and configure:

python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
# Copy the output and paste into config.yaml as the `key:` value

Configuration parameters:

  • key - Encryption key for secure communication
  • nodes - List of all devices in your network
    • Node name (e.g., pc1, laptop) - any unique identifier
    • host - IPv4 address of the device on local network
    • port - Any available port

Usage

Run in foreground:

python main.py --node pc1 --config config.yaml --log INFO

Run as daemon (background):

python main.py --node pc1 --config config.yaml --log INFO --log-file --daemon

Stop daemon:

python main.py --node pc1 --daemon-kill

Options

Option Long Form Description
-n --node Node name from config (required)
-c --config Path to configuration file (required for connections)
-l --log Logging level (DEBUG, INFO, WARNING, ERROR)
-lf --log-file Write logs to file. Use alone for default clipboard.log or specify path: --log-file path/to/file.log
-d --daemon Run as background daemon
-dk --daemon-kill Stop running daemon

Example

For 2 PCs on network 192.168.1.x:

PC1 (192.168.1.10):

python main.py --node pc1 --config config.yaml

PC2 (192.168.1.11):

python main.py --node pc2 --config config.yaml

Requirements

  • Python 3.7+