A lightweight, real-time clipboard history manager built with Electron. This application monitors your system clipboard and maintains a history of copied texts, images, and file paths.
- Real-time Monitoring: Checks the clipboard every second for new content.
- Format Support:
- Text: Stores and displays plain text.
- Images: Detects copied images, displays a preview, and allows re-copying as binary image data (not just Base64 strings).
- Files: Correctly handles file paths (Windows FileNameW support), decoding UTF-16 LE characters to prevent mojibake (broken characters).
- Click-to-Copy: Click on any item in the history to restore it to the system clipboard.
- Safe Execution: Uses ContextIsolation and IPC bridges for security.
- Clone the repository (or download the source code):
git clone https://github.com/yourusername/clipboard-manager.git
cd clipboard-manager- Install dependencies: You need Node.js installed. Then run:
npm install(Note: You need electron in your package.json)
- Start the application:
npm start- main.js: The entry point. Handles the app window, clipboard reading (decoding file buffers, reading images), and writing back to the clipboard via IPC.
- preload.js: The bridge between the secure main process and the frontend renderer. Exposes a safe API (electronAPI).
- renderer.js: Handles the UI logic, displaying items, and sending click events back to the main process.
- index.html: The layout of the application.
File Path Encoding (Windows)
Windows stores file paths in the clipboard using the FileNameW format (UTF-16 LE). Standard string conversion results in "mojibake" (squares/symbols). This app correctly decodes the buffer using ucs2 and strips null bytes to get the clean file path.
Image Copying
When clicking a history item to re-copy an image, the app uses Electron's nativeImage to write actual image data to the clipboard, ensuring it can be pasted into applications like Photoshop, Discord, or Slack (instead of just pasting a text URL).
- Run the app.
- Copy anything (Text, an Image from the web/disk, or a File in File Explorer).
- The item will appear in the app window.
- Click any previous item to copy it back to your clipboard.
MIT