2026-05-21 09:54:09 +02:00
2026-05-21 09:54:09 +02:00
2026-05-21 09:54:09 +02:00
2026-03-07 22:01:27 +01:00
2026-05-20 23:49:53 +02:00
2026-05-21 09:39:12 +02:00
2026-05-20 23:37:46 +02:00

rklipd

A lightweight clipboard history manager for Linux — daemon + TUI client.

Rust X11 Wayland

Features

  • Captures text and images automatically (X11 polling & Wayland events)
  • SQLite storage — images saved as JPEG (quality 70)
  • Fuzzy search (~), regex search (/pattern), date filters (after:2025-01 before:2025-06-01)
  • Type filter: All / Text / Image (t)
  • Per-entry AES-256-GCM encryption with Argon2 password (e)
  • Syntax highlighting in preview (300+ languages via syntect)
  • Image preview in terminal (sixel / kitty / halfblocks via ratatui-image)
  • Undo last delete (u)
  • IPC Unix socket — fully scriptable

Architecture

rklipd (daemon)                   rklip (TUI client)
┌─────────────────────┐           ┌──────────────────────┐
│ monitor (X11/Wayland│──────────▶│ app.rs  (state)      │
│ database.rs (SQLite)│◀──IPC────▶│ ui.rs   (ratatui)    │
│ ipc.rs  (Unix sock) │           │ ipc.rs  (client)     │
│ crypto.rs (AES-GCM) │           │ crypto.rs (Argon2)   │
└─────────────────────┘           └──────────────────────┘

~/.local/share/com.zefad.rklipd/
├── clipboard.db      # SQLite history
├── images/           # JPEG images
├── master.key        # Machine key (enc:)
├── crypto2.salt      # Argon2 salt  (enc2:)
└── rklip.sock        # IPC socket

Build & Install

Dependencies: libxcb (X11) or Wayland libs, libsqlite3

# X11
cargo build --release --features x11 -p rklipd
cargo build --release -p rklip

# Wayland
cargo build --release --features wayland -p rklipd
cargo build --release -p rklip

# Install
sudo cp target/release/rklipd /usr/local/bin/
sudo cp target/release/rklip  /usr/local/bin/

Autostart (systemd user):

# ~/.config/systemd/user/rklipd.service
[Unit]
Description=rklipd clipboard daemon

[Service]
ExecStart=/usr/local/bin/rklipd
Restart=on-failure

[Install]
WantedBy=default.target
systemctl --user enable --now rklipd

Usage

rklipd [OPTIONS]          # start daemon
rklip                     # open TUI

Options:
  --max-entries <N>        Max history entries        (default: 500)
  --max-entry-size-kb <N>  Max text entry size in KB  (default: 512)
  --expiry-days <N>        Auto-delete entries > N days

Keybindings

Key Action
j / Next entry
k / Previous entry
Enter Paste selected & quit
/ Fuzzy search mode
t Cycle type filter (All → Text → Image)
e Encrypt / Decrypt selected entry
dd Delete selected (confirm)
u Undo last delete
gg / G Jump to top / bottom
Ctrl+j/k Scroll preview
:clear Clear entire history
:p Set session password
q / :q Quit

Search syntax:

rust                        # fuzzy match
/fn\s+\w+\(                 # regex (prefix with /)
after:2025-01 before:2025-06 config   # date filters + text

Encryption

Two independent layers:

Prefix Method Key source Use case
enc: AES-256-GCM Machine key (master.key) Legacy / auto
enc2: Argon2 + AES-256-GCM User password Sensitive entries

Press e on any entry to encrypt/decrypt with a password. Encrypted entries show as 🔒 [Chiffré] and require your password to paste.

IPC (scripting)

The daemon exposes a JSON Unix socket. Example with socat:

# Fetch last 5 entries
echo '{"GetHistory":{"limit":5}}' | socat - UNIX-CONNECT:~/.local/share/com.zefad.rklipd/rklip.sock

# Set clipboard content
echo '{"SetClipboard":{"content":"hello"}}' | socat - UNIX-CONNECT:...

# Clear history
echo '"ClearHistory"' | socat - UNIX-CONNECT:...
Description
Minimalist Rust clipboard manager for Linux.
Readme 646 KiB
Languages
Rust 100%