Save clipboard content (text and images) to files with smart format detection
Project description
ClipDrop
Save clipboard content to files with one command. ClipDrop automatically detects formats (JSON, Markdown, CSV), suggests appropriate extensions, prevents accidental overwrites, and provides rich visual feedback.
Features
- Image Support: Save images from clipboard (PNG, JPG, GIF, BMP, WebP) ๐ท
- Smart Format Detection: Automatically detects JSON, Markdown, CSV, and image formats
- Extension Auto-Suggestion: No extension? ClipDrop suggests the right one
- Content Priority: Intelligently handles mixed content (image + text)
- Safe by Default: Interactive overwrite protection (bypass with
--force) - Preview Mode: See content before saving (text with syntax highlighting, images with dimensions)
- Rich CLI: Beautiful, informative output with colors and icons
- Performance: Caches clipboard content for speed (<200ms operations)
- Image Optimization: Automatic compression for PNG/JPEG formats
- Large File Support: Handles files up to 100MB with size warnings
- Unicode Support: Full international character support
๐ฆ Installation
Using uv (Recommended)
# Install from PyPI (when released)
uv add clipdrop
# Install from local checkout
uv pip install -e .
Using pip
python -m venv .venv
source .venv/bin/activate
pip install -e .
Usage
Basic Usage
# Save clipboard to file (auto-detects format)
clipdrop notes # โ notes.txt (text)
clipdrop screenshot # โ screenshot.png (image)
clipdrop data # โ data.json (if JSON detected)
clipdrop readme # โ readme.md (if Markdown detected)
# Specify extension explicitly
clipdrop photo.jpg # Save as JPEG
clipdrop diagram.png # Save as PNG
clipdrop config.yaml # Save as YAML
Options
# Force overwrite without confirmation
clipdrop notes.txt --force
clipdrop notes.txt -f
# Preview content before saving (with syntax highlighting for text, dimensions for images)
clipdrop data.json --preview
clipdrop screenshot.png -p
# Force text mode when both image and text are in clipboard
clipdrop notes.txt --text
clipdrop notes.txt -t
# Show version
clipdrop --version
# Get help
clipdrop --help
Examples
Save copied text
# Copy some text, then:
clipdrop notes
# โ
Saved 156 B to notes.txt
Auto-detect JSON and pretty-print
# Copy JSON data, then:
clipdrop config
# ๐ Auto-detected format. Saving as: config.json
# โ
Saved 2.3 KB to config.json
Preview with syntax highlighting
clipdrop script.py --preview
# Shows colored preview with line numbers
# Save this content? [Y/n]:
Save copied image
# Copy an image (screenshot, etc.), then:
clipdrop screenshot
# ๐ท Auto-detected image format. Saving as: screenshot.png
# โ
Saved image (1920x1080, 245.3 KB) to screenshot.png
Handle mixed content
# When both image and text are in clipboard:
clipdrop content # Saves image by default
clipdrop content --text # Forces text mode
๐ง Development
Setup Development Environment
# Clone the repository
git clone https://github.com/prateekjain24/clipdrop.git
cd clipdrop
# Install with dev dependencies
uv pip install -e .[dev]
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov --cov-report=term-missing
# Run specific test file
pytest tests/test_clipboard.py
Code Quality
# Format code
black src tests
# Lint code
ruff check .
# Type checking (if using mypy)
mypy src
Project Status
Completed Features (Sprints 1-3) โ
- Project setup with uv package manager
- CLI skeleton with Typer
- Clipboard text and image reading with caching
- File writing with atomic operations
- Extension detection for text and image formats
- Overwrite protection
- Rich success/error messages
- JSON, Markdown, CSV format detection
- Path validation and sanitization
- Image clipboard support (PNG, JPG, GIF, BMP, WebP)
- Content priority logic (image > text, with --text override)
- Image optimization with format-specific compression
- Comprehensive test suite (89 tests)
- Preview mode with syntax highlighting (text) and dimensions (images)
Enhanced Features ๐
- Custom exception hierarchy for better error handling
- Advanced clipboard operations (stats, monitoring, binary detection, images)
- Enhanced file operations (atomic writes, backups, compression)
- Image format conversion (RGBAโRGB for JPEG)
- Performance optimizations with content caching
- Smart format detection for images and text
Future Roadmap (Sprint 4) ๐ง
- PyPI package release
- Performance profiling for large files
- Cross-platform support (Windows, Linux)
- Configuration file support
๐๏ธ Architecture
clipdrop/
โโโ src/clipdrop/
โ โโโ __init__.py # Version management
โ โโโ main.py # CLI entry point
โ โโโ clipboard.py # Clipboard operations (text + images)
โ โโโ files.py # File operations
โ โโโ images.py # Image-specific operations
โ โโโ detect.py # Format detection
โ โโโ exceptions.py # Custom exceptions
โโโ tests/ # Comprehensive test suite (89 tests)
โ โโโ test_clipboard.py # 27 tests
โ โโโ test_files.py # 37 tests
โ โโโ test_images.py # 25 tests
โโโ pyproject.toml # Modern Python packaging
โโโ README.md # This file
๐ Requirements
- Python: 3.10, 3.11, 3.12, or 3.13
- OS: macOS 10.15+ (initial target)
- Dependencies:
- typer[all] >= 0.17.4
- rich >= 14.1.0
- pyperclip >= 1.9.0
- Pillow >= 11.3.0
๐ License
MIT License - See LICENSE file for details.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Issues
Found a bug or have a feature request? Please open an issue on GitHub Issues.
Current Version: 0.1.0 | Status: Active Development
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clipdrop-0.2.0.tar.gz.
File metadata
- Download URL: clipdrop-0.2.0.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ac81f672ed4ee5d09171ea0243a41a2016a0b51cd871482babb493c7bc43c6
|
|
| MD5 |
26cb8806a935d192f8baa5c58d2a6296
|
|
| BLAKE2b-256 |
108766ac1d953d650971569ec7b6f63fbac2ce89666d30bb69d09d411c60245d
|
File details
Details for the file clipdrop-0.2.0-py3-none-any.whl.
File metadata
- Download URL: clipdrop-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c1ef7973c28a0e5298a36e6f84e2ee4f886a1dafbc84e3e72b9dc347ad547be
|
|
| MD5 |
55e352de52479716e6e63cfc1deb6e36
|
|
| BLAKE2b-256 |
6dd7f08c825a939dd0633d6799ed8840be848e57fbdc801875979d2f52e4cc6d
|