Windows has a clipboard history. Press Win+V and you get the last 25 things you copied. Restart the machine and they are gone. There is no search, no pinning, and images drop out fast.

That gap is why I built ClipVault, a native clipboard manager for Windows that keeps everything, survives restarts and opens on the same Win+V shortcut. It is open source under MIT: https://github.com/Asadulelah/clipvault

This post is how it works inside, with the real code.

What it does

  • Unlimited, persistent history (or a limit you set)
  • Full-text search that filters as you type
  • Pinned items that survive "clear all"
  • Text, URLs, images and HTML, each detected and shown differently
  • The source app for every entry (VS Code, Chrome, and so on)
  • Click an item and it pastes straight into the app you were in
  • Opens on Win+V, in the bottom-right corner, where the Windows panel opens

No account, no cloud, no network calls. Everything stays in a local SQLite file.

Why Tauri and not Electron

A clipboard manager runs all day in the tray. It should be small and cheap to keep open. Tauri v2 uses the WebView2 runtime that Windows already ships, instead of bundling a browser, and the backend is Rust.

The result, from the README's numbers table:

Metric Value
Installer 2.0 MB (NSIS) / 2.7 MB (MSI)
Binary ~5.3 MB
Memory ~15-25 MB
Frontend bundle under 500 KB

The split is simple. Rust owns everything that touches the system: the clipboard, the global hotkey, the tray icon, the database, window management and paste simulation. React 18 with TypeScript, Zustand and Tailwind CSS v4 owns the panel you see.

The watcher: polling every 500 ms

A background Rust thread reads the clipboard through the arboard crate every 500 ms. On each tick it tries an image first, then text, and skips anything whose hash matches the last thing it saw:

loop { std::thread::sleep(Duration::from_millis(500)); if SKIP_NEXT.load(Ordering::SeqCst) { SKIP_NEXT.store(false, Ordering::SeqCst); if let Ok(text) = clipboard.get_text() { last_hash = hasher::hash_text(&text); } continue; } let capture = match try_read_clipboard(&mut clipboard, &last_hash) { Some(c) => c, None => continue, }; last_hash = capture.hash.clone(); let source_app = detector::get_foreground_app(); // ... insert or bump, then emit to the UI } 

Polling is the plain choice. Windows also has a clipboard-change listener API, and moving to it is on my list, but a 500 ms poll on a sleeping thread costs almost nothing and was easy to get right.

Images come out of arboard as raw RGBA. I hash those bytes, convert them to PNG with the image crate, and store a 200 px thumbnail next to the full image so the list stays fast.

Deduplication with SHA-256

Copy the same thing twice and you should not get two rows. The hasher is the smallest file in the project:

pub fn hash_text(text: &str) -> String { let mut hasher = Sha256::new(); hasher.update(text.as_bytes()); format!("{:x}", hasher.finalize()) } 

The database enforces it too. hash is UNIQUE on the items table:

CREATE TABLE IF NOT EXISTS clipboard_items ( id INTEGER PRIMARY KEY AUTOINCREMENT, content_type TEXT NOT NULL, content_text TEXT, content_blob BLOB, thumbnail_blob BLOB, preview_text TEXT, source_app TEXT, is_pinned INTEGER DEFAULT 0, created_at INTEGER NOT NULL, hash TEXT NOT NULL UNIQUE ); 

When a hash already exists, the watcher only updates created_at, so the item jumps back to the top instead of appearing twice. Indexes on hash, created_at and is_pinned keep the three queries the panel runs all the time cheap.

The skip flag

There is one trap in any clipboard manager: when you click an item, the app writes it to the clipboard, and the watcher would then capture its own write as a new entry. A global AtomicBool called SKIP_NEXT handles this. The paste command sets it before writing; the watcher sees it on the next tick, refreshes its last-seen hash and moves on.

If the flag ever misses, the hash check is the second net. The same content produces the same hash, so the worst case is a timestamp bump, not a duplicate.

Source app tracking

For each new entry the watcher asks Windows which window is in front (GetForegroundWindow) and stores the app name with the row. It is a small feature, but "the snippet I copied from the terminal" is often how people remember what they are looking for.

Auto-paste in under 200 ms

Copying an item back is not enough. I wanted a click to put the content where my cursor was. The sequence:

  1. The panel hides itself, so the previous app gets focus back.
  2. A 50 ms wait lets Windows move focus.
  3. The content goes onto the system clipboard.
  4. A background thread waits 100 ms, then sends Ctrl+V through SendInput.

The keystroke part is four INPUT structs: Ctrl down, V down, V up, Ctrl up.

std::thread::spawn(|| { std::thread::sleep(std::time::Duration::from_millis(100)); simulate_paste(); }); fn simulate_paste() { const VK_CONTROL: VIRTUAL_KEY = VIRTUAL_KEY(0x11); const VK_V: VIRTUAL_KEY = VIRTUAL_KEY(0x56); // Ctrl down, V down, V up, Ctrl up unsafe { SendInput(&mut inputs, std::mem::size_of::<INPUT>() as i32); } } 

The target app receives it as if you pressed the keys. The delays exist because the panel has to be gone before the keystroke arrives; otherwise the paste would land in ClipVault itself.

Talking to React

After every insert or bump, Rust emits a clipboard-updated event with the row. The React side listens and updates its Zustand store, so the panel changes live without polling from the frontend. Settings (theme, history limit, launch on startup, show source app) live in a second SQLite table with defaults written by the first migration.

How I built it

I designed the architecture first: which parts live in Rust, what the table looks like, how the paste sequence should go. Then I built it in one long session with AI coding agents as the pair programmer, reviewing each piece as it landed. That is how I work on most things now: I act as architect and reviewer, and agents do the typing.

Try it or build on it

Installers are on the releases page (v1.0.0). To build from source you need Node 18+, pnpm and the Rust toolchain with the Tauri prerequisites:

git clone https://github.com/Asadulelah/clipvault.git cd clipvault pnpm install pnpm tauri dev 

Next on the list: customizable hotkeys, snippet templates with placeholders, tags, export and import, and macOS and Linux builds. Issues and forks are welcome.

Asadulelah builds AI systems that do real work: CRMs, agent fleets and automation for businesses. More at https://asadulelah.com