Clipboard Engine
English · Español
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/plainandtext/htmlon the clipboard; CyberPaste prefers the plain text - HTML is stored as a code clip (with HTML syntax highlighting) 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
- Since v1.31.0 there is no separate HTML clip type; legacy HTML rows migrate to code on startup
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
Since v1.31.0 legacy RTF rows are migrated to text on startup; RTF is a preserved format, not a clip category
Since v1.28.1 the RTF/HTML flavors of text-family captures are also kept as an invisible side channel (table
clip_rich).- When you re-paste the clip later, CyberPaste writes the plain text together with the stored RTF/HTML, so rich targets like Word or Google Docs restore the original bold, font size and colors while plain targets like Notepad keep receiving plain text.
- Trivial RTF envelopes without real formatting are not stored.
- Flavors respect the text size limit.
- Editing a clip clears its stored flavors.
- A toggle in Settings → Clipboard ("Preserve rich formatting") turns the whole feature off.
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
- Pasting history images into Explorer names them
Clipboard_image.png,Clipboard_image(01).png,Clipboard_image(02).png, and so on - At startup, legacy PNG records stored as base64 text are repaired into binary PNG files with corrected size metadata
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_countin 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)
- UWP attribution: Uses the foreground, focused app for packaged applications and reads logos from the packaged
AppxManifest.xml. Historical attribution is backfilled once at startup only when the source is unambiguous - 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 |
One of five categories: text, code, image, url or file. Legacy html rows migrate to code and legacy rtf rows to text on startup, since HTML and RTF are preserved formats rather than clip categories |
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.
Pinned clips also reserve a numbered slot (
pinned_slot): the badge stays with the clip even when other clips are deleted, and unpinned clips fill the remaining numbers. Slots are assigned at pin time, released on unpin, and refreshed when a pinned clip is dragged.
Search
Search is a paginated SQL query against the local database:
- Case-insensitive
LIKEmatching overtext_previewandcontent - Server-side type filtering in Full Screen 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 |
0 (disabled) | Prune unpinned clips older than the chosen period (1 day to 1 year); 0 disables it |
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