Skip to content GitHub
Guide contents
English View source

Clipboard Engine

Clipboard Engine

The clipboard engine is the core of CyberPaste. It monitors your clipboard, captures rich content, and stores everything in a local SQLite database for instant recall.


Content Types

Text

Plain text clips are stored with full formatting preservation. The engine detects:

  • Single-line and multi-line text
  • Whitespace and indentation
  • Unicode characters and emoji

Code

Code clips are automatically detected and rendered with syntax highlighting:

  • Language from the clip metadata (e.g. source file extension) or an explicit parameter
  • Syntax highlighting via the syntect engine
  • Language badge displayed on clip card

HTML

HTML-formatted clipboard content is preserved, but only when it adds real value:

  • Browsers place both text/plain and text/html on the clipboard; CyberPaste prefers the plain text
  • HTML is only classified as an HTML clip when it contains structural rich elements (tables, images, iframes) or when no plain text was provided
  • A styled fragment that is only a sentence, such as a colored span wrapped in StartFragment, is stored as that visible text
  • This keeps web copies clean instead of storing DOM wrappers

RTF

Rich Text Format content is detected and cleaned:

  • RTF tags are stripped to extract the plain text
  • Trivial/noise RTF bodies (e.g. only font tables) are skipped

Images

Clipboard images are captured and stored:

  • Full image bytes stored in the database; files on disk under %APPDATA%\CyberPaste\images
  • Thumbnail generation for fast grids
  • OCR text extraction available
  • Full-screen image viewer with zoom

URLs

Web links are automatically detected and categorized:

  • URL detection via pattern matching
  • Quick paste action

Files

File paths from copy operations in Explorer:

  • Captured via CF_HDROP (checked before text, since Explorer sets both)
  • JSON list of all paths with a file_count in metadata
  • Preview shows the first file name (e.g. report.docx (+3 más))

Clipboard Monitoring

Capture Methods

Method Description
Copy (Ctrl+C) Standard clipboard copy detection
Cut (Ctrl+X) Detected by a global keyboard hook (600 ms window)
Cut (Shift+Delete) Alternative cut detection via the same hook

Duplicate Detection

When the same content is copied again:

  • The content is hashed (SHA-256) and matched against existing clips
  • A duplicate toast notification appears (configurable)
  • No duplicate entry is created

Automatic Clipboard Noise Filtering

CyberPaste validates clipboard content before creating a history entry. This filtering is always active and has no Settings toggle:

  • Empty clipboard-clear events do not create clips
  • Empty or whitespace-only text is not stored
  • RTF payloads that contain only formatting tables or other non-content are skipped
  • Valid content is kept even when Windows cannot identify its source application

This filtering is based on the captured content, not on whether the source application is known. Its purpose is to prevent empty or meaningless entries without losing legitimate clips.

Smart Monitoring

  • Process-aware: Identifies which application the clip came from (name + icon)
  • Content hashing: SHA-256 for duplicate detection
  • Cut awareness: Cut events mark the source app so captures can be labeled

Clip Data Model

Each clip stores:

Field Description
id Numeric primary key
uuid Unique identifier
clip_type Type classification (text/code/html/rtf/image/url/file)
content Full content (text bytes, image bytes, or JSON file list)
text_preview Short preview text used for display and search
content_hash SHA-256 hash for duplicate detection
folder_id Assigned folder (if any)
is_deleted Soft-delete flag
is_thumbnail Whether content holds a thumbnail
source_app Source application name
source_icon Source application icon
metadata JSON metadata (file paths, image dimensions, language hints…)
sort_order Explicit ordering (used by move to top/bottom)
is_pinned Pin status
created_at Capture timestamp
last_accessed Last access timestamp

OCR results and code language are not stored as columns; OCR "Save to clip" creates a new text clip, and code language lives in metadata.


Search

Search is a paginated SQL query against the local database:

  • Case-insensitive LIKE matching over text_preview and content
  • Server-side type filtering in Full mode (client-side in Compact mode)
  • Paginated results (limit/offset) with lazy, preview-only loading for large content
  • Virtual scrolling in the UI for smooth lists

Retention and Limits

Storage Limits

Setting Default Description
max_items 300 Maximum number of clips to retain (slider 50 – 1000, step 50)
auto_delete_days 30 Auto-delete clips older than this

Auto-Delete

When limits are reached:

  • Oldest non-pinned clips are deleted first
  • Pinned clips are never auto-deleted
  • Deleted images are removed from disk and orphaned files cleaned up

Database

SQLite Configuration

  • Location: %APPDATA%\CyberPaste\cyber_paste.db
  • Format: Standard SQLite file via sqlx (no encryption at rest)
  • Indexes: Optimized for search and filtering

Performance

  • Paginated queries with preview-only loading for large content
  • Virtual scrolling for smooth UI
← All documentation