CI / Lint (push) Failing after 14m46s
CI / Test (push) Failing after 4m23s
CI / Build (darwin/amd64) (push) Skipped
CI / Build (linux/amd64) (push) Skipped
CI / Build (windows/amd64) (push) Skipped
CI / Build (darwin/arm64) (push) Skipped
CI / Build (linux/arm64) (push) Skipped
CI / Build (windows/arm64) (push) Skipped
CI / Release (push) Skipped
150 lines
4.1 KiB
Markdown
150 lines
4.1 KiB
Markdown
# clip-sync
|
|
|
|
[](https://go.dev)
|
|
[](LICENSE)
|
|
[](.)
|
|
|
|
**Daemon de synchronisation bidirectionnelle du presse-papiers sur réseau local.**
|
|
|
|
Copier sur une machine → coller sur une autre, automatiquement et instantanément.
|
|
|
|
```
|
|
┌──────────────┐ POST /clip ┌──────────────┐
|
|
│ Machine A │◄──────────────────────────►│ Machine B │
|
|
│ (bureau) │ {text, ts, origin} │ (portable) │
|
|
│ :9137 │ │ :9137 │
|
|
└──────────────┘ └──────────────┘
|
|
```
|
|
|
|
## Fonctionnalités
|
|
|
|
- **Bidirectionnel** — copie A → B et B → A, chaque nœud est client et serveur
|
|
- **Anti-boucle** — double filtre (hash SHA-256 + timestamp/origine) empêche le ping-pong
|
|
- **Multi-plateforme** — Linux (X11/Wayland), Windows, macOS
|
|
- **Binaire unique** — zéro runtime externe, compilation Go native
|
|
- **Configuration simple** — fichier TOML + variables d'environnement
|
|
- **LAN uniquement** — aucune donnée ne quitte votre réseau local
|
|
|
|
## Installation rapide
|
|
|
|
### Via install.sh (recommandé)
|
|
|
|
```bash
|
|
curl -sSL https://git.dracodev.net/Projets/clip-sync/raw/branch/main/install.sh | bash
|
|
```
|
|
|
|
Le script détecte automatiquement votre OS et architecture.
|
|
|
|
### Compilation manuelle
|
|
|
|
```bash
|
|
git clone https://git.dracodev.net/Projets/clip-sync.git
|
|
cd clip-sync
|
|
make build # binaire dans ./bin/
|
|
```
|
|
|
|
### Prérequis par plateforme
|
|
|
|
| Plateforme | Dépendance | Installation |
|
|
|-----------|-------------------|-------------------------------------------|
|
|
| Linux X11 | `xclip` | `apt install xclip` / `pacman -S xclip` |
|
|
| Linux Wayland | `wl-clipboard` | `apt install wl-clipboard` |
|
|
| macOS | intégré (pbpaste/pbcopy) | — |
|
|
| Windows | intégré (Win32 API, pas de dépendance externe) | — |
|
|
|
|
## Démarrage rapide
|
|
|
|
### 1. Créer la configuration
|
|
|
|
```bash
|
|
mkdir -p ~/.config/clip-sync
|
|
```
|
|
|
|
**Machine A** (bureau, 192.168.1.10) :
|
|
|
|
```toml
|
|
# ~/.config/clip-sync/peers.toml
|
|
[daemon]
|
|
port = 9137
|
|
poll_interval_ms = 500
|
|
|
|
[[peers]]
|
|
name = "portable"
|
|
addr = "192.168.1.20:9137"
|
|
```
|
|
|
|
**Machine B** (portable, 192.168.1.20) :
|
|
|
|
```toml
|
|
# ~/.config/clip-sync/peers.toml
|
|
[daemon]
|
|
port = 9137
|
|
poll_interval_ms = 500
|
|
|
|
[[peers]]
|
|
name = "bureau"
|
|
addr = "192.168.1.10:9137"
|
|
```
|
|
|
|
### 2. Lancer le daemon
|
|
|
|
```bash
|
|
clip-sync
|
|
```
|
|
|
|
### 3. Tester
|
|
|
|
Copiez du texte sur la machine A (Ctrl+C), collez sur la machine B (Ctrl+V).
|
|
Ça marche !
|
|
|
|
## Configuration
|
|
|
|
### Fichier TOML
|
|
|
|
| Clé | Défaut | Description |
|
|
|-----|--------|-------------|
|
|
| `daemon.port` | `9137` | Port d'écoute HTTP |
|
|
| `daemon.poll_interval_ms` | `500` | Intervalle de scrutation du presse-papiers (ms) |
|
|
| `peers[].name` | — | Nom descriptif du pair |
|
|
| `peers[].addr` | — | Adresse `host:port` du pair |
|
|
|
|
### Variables d'environnement (override)
|
|
|
|
| Variable | Équivalent TOML |
|
|
|----------|-----------------|
|
|
| `CLIP_SYNC_PORT` | `daemon.port` |
|
|
| `CLIP_SYNC_POLL_MS` | `daemon.poll_interval_ms` |
|
|
|
|
## Exécution en tant que service
|
|
|
|
### Linux (systemd --user)
|
|
|
|
```bash
|
|
mkdir -p ~/.config/systemd/user/
|
|
cp clip-sync.service ~/.config/systemd/user/
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now clip-sync
|
|
```
|
|
|
|
### Windows (NSSM)
|
|
|
|
```powershell
|
|
nssm install clip-sync C:\Users\<user>\bin\clip-sync.exe
|
|
nssm set clip-sync AppStdout C:\Users\<user>\AppData\Local\clip-sync\stdout.log
|
|
nssm set clip-sync AppStderr C:\Users\<user>\AppData\Local\clip-sync\stderr.log
|
|
nssm start clip-sync
|
|
```
|
|
|
|
## Déboguer
|
|
|
|
```bash
|
|
# Tester la connectivité entre pairs
|
|
curl -X POST http://192.168.1.20:9137/clip \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"text":"test","ts":0,"origin":"debug"}'
|
|
```
|
|
|
|
## Licence
|
|
|
|
MIT © 2026
|