Skip to content

Repository files navigation

Clipboard History for Microsoft PowerToys Command Palette

License: MIT Platform .NET PowerToys

Raycast-style native Clipboard History extension for Microsoft PowerToys Command Palette with intelligent type recognition, rich markdown syntax previews, color swatches, image caching, and instant pasting back into your active applications.

Historial del Portapapeles estilo Raycast para Command Palette de PowerToys con reconocimiento inteligente de tipos, vista previa con resaltado de sintaxis, muestras de color, caché de imágenes y pegado directo en la aplicación activa.


English Overview

Clipboard History is a native Windows desktop extension built for Microsoft PowerToys Command Palette. It brings seamless clipboard management directly into your command bar, capturing everything you copy with zero CPU overhead and offering fast fuzzy searching, rich preview details, and direct focus-restored pasting.

✨ Key Features

  1. ⚡ Background Zero-Lag Clipboard Listener:

    • Uses native Win32 AddClipboardFormatListener / WM_CLIPBOARDUPDATE via a dedicated message loop thread.
    • Captures text, code, links, colors, images, and file paths with sub-millisecond response time.
    • Password Manager Safety: Automatically detects and ignores sensitive items marked with the Clipboard Viewer Ignore clipboard format (used by Bitwarden, 1Password, KeePassXC, etc.).
    • Smart Deduplication: Copying the same text multiple times bumps the existing entry to the top and updates its timestamp rather than creating clutter.
  2. 🏷️ Source Application Identification & Logo Badges:

    • Accurately resolves the originating application for each clip (including specialized browsers like Helium, Google Chrome, Microsoft Edge, VS Code, Windows Terminal, Slack, etc.).
    • Extracts and renders crisp 16x16 px application icons directly in the side details panel.
  3. 🎨 Raycast-Style Pantone Color Swatches & Cards:

    • List item icon: Dynamically renders a rounded color swatch for any #HEX, RGB, or HSL color.
    • Details side panel: Generates a high-resolution Pantone® style card displaying the color block, closest named color (e.g. Classic Blue, Coral Red, Pure White), large HEX, RGB, HSL, and CMYK grid.
    • Quick context commands (Ctrl+K) to copy the color in HEX, RGB, or HSL format.
  4. 📅 Timeline Section Grouping:

    • Items are automatically organized chronologically: 📌 Pinned (Anclados), Today (Hoy), Yesterday (Ayer), This week (Esta semana), Last week (La semana pasada), and This month (Este mes).
  5. 💾 30-Day Retention:

    • Stores up to 30 days of full history for text, code, links, and images in a local SQLite database (history.db) with WAL mode.
    • Automatic background pruning of items older than 30 days and their associated cached images.
    • Pinned items are protected indefinitely.
  6. 🧠 Smart Content Type Detection & Rich Previews:

    • 💻 Code Snippets: Automatically detects JSON, XML, HTML, C#, SQL, Python, JavaScript, and CSS with markdown syntax-highlighted code blocks.
    • 🔗 Web Links: Identifies URLs, extracts domain favicons for the list view, and pulls page metadata/previews.
    • 🖼️ Images: Saves copied images to local cache (images/), displays proportional thumbnails (max 340px) in the side pane, and provides a direct Ctrl+K action to open images in the default Windows image viewer.
    • 📁 Files: Detects copied files and directories from Windows Explorer.
    • 📝 Standard Text: Displays clean previews along with character count, word count, line count, and byte size.
  7. 🎯 Active Application Focus Restoration & Instant Pasting:

    • Continuous foreground window tracking (SetWinEventHook) remembers the exact app you were working in before opening Command Palette.
    • Pressing Enter on any clipboard item dismisses Command Palette, brings your previous window to the front, and simulates Ctrl+V automatically.
  8. 📌 Pinning & Minimalist List UI:

    • Minimalist List: Distraction-free left list showing only Fluent icons/favicons and text titles.
    • Rich Details Panel: Consolidates source application, relative time, content type, word/char/line counts, dimensions, and previews.
    • Pin items (📌): Pinned items stay at the top and are exempt from automatic pruning.
    • Paste Plain Text: Strips rich formatting and pastes unformatted clean text.
    • Clear Unpinned History: One-click cleanup to remove temporary clips while preserving pinned favorites.
  9. 🚀 Blazing-Fast Local SQLite Engine:

    • Stores history locally in %LOCALAPPDATA%\Microsoft\PowerToys\CmdPal\ClipboardHistory\history.db.
    • SQLite with WAL mode (Write-Ahead Logging) enables instant searches, concurrent reads, and zero RAM bloat.
  10. 🌐 Automatic Bilingual Localization (i18n):

    • English by default for any system language (en, fr, de, it, ja, etc.).
    • Spanish (Español) automatically detected for Spanish Windows locales (es).
  11. 🛡️ Dual Mode: COM Server & System Tray Resident:

    • Integrates seamlessly with Command Palette on-demand as a COM Server (-RegisterProcessAsComServer).
    • Can also run in the Windows System Tray with quick controls to pause/resume monitoring, clear history, or open the storage folder.

Visión General en Español

Clipboard History Pro es una extensión nativa para Microsoft PowerToys Command Palette inspirada en los gestores de portapapeles de Raycast y Maccy. Permite buscar, previsualizar y recuperar cualquier texto, enlace, código o imagen copiada en tu equipo con total privacidad y rapidez.

🌟 Funcionalidades Principales

  • Captura continua en segundo plano: Detecta inmediatamente lo que copias mediante eventos nativos de Windows sin ralentizaciones.
  • Identificación de la app de origen: Muestra el nombre y el logo nativo (16x16 px) de la app donde se copió el contenido (Helium, Chrome, VS Code, Terminal, etc.).
  • Tarjetas de color estilo Pantone: Vista previa de colores HEX/RGB en tarjetas Pantone con valores CMYK y HSL.
  • Previsualización de imágenes y favicons: Carga los favicons oficiales para enlaces y muestra miniaturas proporcionales con opción de abrir en el visor predeterminado (Ctrl+K).
  • Lista lateral minimalista: Muestra solo iconos Fluent oficiales y el texto copiado; toda la metadata técnica se visualiza en el panel lateral de detalles.
  • Protección de contraseñas: Respeta la directiva Clipboard Viewer Ignore de 1Password, Bitwarden y KeePassXC.
  • Pegado directo en la app activa: Al pulsar Enter, Command Palette se oculta, restaura el foco en la ventana anterior y envía Ctrl+V.
  • Anclado de favoritos (Pin 📌): Los elementos fijados se mantienen permanentemente arriba y nunca se borran en limpiezas automáticas.
  • Base de datos SQLite local: Almacenamiento rápido y fiable en %LOCALAPPDATA%\Microsoft\PowerToys\CmdPal\ClipboardHistory\history.db.

📂 Project Architecture

02 Clipboard History/
├── Directory.Build.props              # Global MSBuild properties
├── Directory.Packages.props           # Central Package Management (CPM)
├── ClipboardHistoryCmdPal.slnx        # Modern Solution definition
├── src/
│   └── ClipboardHistoryCmdPal/        # Command Palette Extension Project (.NET 10)
│       ├── Program.cs                 # COM Server & Tray entry point
│       ├── ClipboardExtension.cs      # IExtension implementation
│       ├── ClipboardHistoryCommandsProvider.cs # Command Provider
│       ├── Icons.cs                   # Fluent Segoe MDL2/Fluent icons
│       ├── Package.appxmanifest       # Sparse MSIX package definition
│       ├── app.manifest               # DPI PerMonitorV2 manifest
│       ├── Models/
│       │   ├── ClipboardItem.cs       # History item model with metadata
│       │   ├── ClipboardType.cs       # Text, Code, Link, Color, Image, Files
│       │   └── ClipboardConfig.cs     # MaxItems, AutoPaste, IgnorePasswords
│       ├── Services/
│       │   ├── ClipboardListenerService.cs # AddClipboardFormatListener STA loop
│       │   ├── ClipboardStorageService.cs  # SQLite WAL database manager
│       │   ├── AppIconService.cs           # Source app detection & 16x16 icon extractor
│       │   ├── WebMetadataService.cs       # Favicon and OpenGraph metadata extractor
│       │   ├── ColorService.cs             # Pantone cards & color math
│       │   ├── WindowTrackerService.cs     # SetWinEventHook foreground tracker
│       │   ├── InputSimulator.cs           # Clipboard & Ctrl+V simulation
│       │   └── Localization.cs             # Bilingual strings (en / es)
│       ├── Pages/
│       │   └── ClipboardListPage.cs   # DynamicListPage with markdown preview
│       ├── Commands/                  # Paste, Copy, OpenImage, Pin, Delete, Clear, Toggle
│       └── Assets/                    # Logos, splash screens, and app.ico
└── scripts/
    ├── build.ps1                      # Build & asset bundle script
    ├── install-local.ps1              # Register sparse MSIX package
    ├── uninstall-local.ps1            # Unregister package cleanly
    ├── clear-cache.ps1                # Cache cleaner & Command Palette reloader
    └── generate-icons.ps1             # Vector icon generator

🚀 Building and Installing Locally

Prerequisites

  • Windows 11 or Windows 10
  • .NET 10 SDK
  • Microsoft PowerToys with Command Palette enabled
  • Developer Mode enabled in Windows Settings (Settings -> System -> For developers)

1. Build and Register the Extension

Open PowerShell in this directory and run:

.\scripts\install-local.ps1

2. Open Command Palette

  1. Press Alt + Space (or your configured Command Palette hotkey).
  2. Type Clipboard History (o Historial del Portapapeles).
  3. Browse copied items with arrow keys, view previews in the side pane, and press Enter to paste directly into your current window!

⌨️ Context Commands & Shortcuts

Inside the Clipboard History list, select any item and press Ctrl + K (or right-click) to open the context menu:

Action Shortcut / Description
Paste into Active App Enter (default primary action)
Copy to Clipboard Copies the content to clipboard without simulating paste
Open Image in Default App Ctrl + K (on images) -> Opens PNG in Windows default photo viewer
Copy Color (HEX / RGB / HSL) Ctrl + K (on colors) -> Direct copy in desired color format
Paste as Plain Text Trims extra whitespace/formatting and pastes clean text
Pin / Unpin Item 📌 Toggles pin status; keeps the item at the top of the list
Delete from History Removes the individual item and its cached media
Clear Unpinned History Wipes all unpinned clips at once
Open Storage Folder Opens %LOCALAPPDATA%\Microsoft\PowerToys\CmdPal\ClipboardHistory\

🔒 Privacy & Security

  • 100% Offline: Zero internet connections, zero telemetry, zero tracking.
  • Sensitive Data Exclusion: Automatically rejects content marked with Clipboard Viewer Ignore (used by password managers).
  • Local Storage: All data stays encrypted on your local drive within your Windows user profile.

About

Raycast-style Clipboard History extension for Microsoft PowerToys Command Palette with Pantone color cards, source app logos, and 30-day retention.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages