Skip to content

johnproblems/orclpm

Repository files navigation

ORCLPM: Odin Raylib Clipboard Manager

Note: This project is being open sourced for educational and community use. While it demonstrates a feature-rich clipboard manager with both CLI and GUI modes, it has some known limitations and is no longer actively maintained by the original author. Feel free to use it as a learning resource, base for your own projects, or contribute improvements!

A fast, feature-rich clipboard history manager written in Odin with both graphical and command-line interfaces, featuring real-time background monitoring and advanced clipboard management.

⚠️ Project Status

This project is community-maintained and shared for educational purposes. It demonstrates:

  • Native Windows API integration (clipboard, window management)
  • Thread-based background monitoring
  • Modern GUI development with Raylib in Odin
  • Command system with autocomplete
  • JSON-based data persistence
  • Real-world application architecture in Odin

Perfect for: Learning Odin, exploring Raylib, understanding clipboard APIs, or as a starting point for your own clipboard manager.

📦 Branch Info: This is the main development branch with the latest features. An original-version branch is available as a backup of the earlier codebase.

Known Limitations

  • Windows-only support (clipboard API is Windows-specific)
  • Some features from specifications may be incomplete
  • GUI may have edge cases in certain scenarios
  • Performance optimizations ongoing

Despite these limitations, the core functionality is solid and the codebase demonstrates many useful patterns for Odin/Raylib development.

✨ Key Features

🖥️ Dual Interface Design

  • Modern GUI Mode - Raylib-powered visual interface with card-based layout
  • Interactive CLI Mode - Command prompt with background monitoring
  • Command Palette - Global Ctrl+K shortcut for instant access
  • Double-click to Launch - Start GUI mode instantly

Advanced Clipboard Management

  • Real-time Monitoring - Automatic capture using Windows sequence numbers
  • Smart Deduplication - Content hashing prevents duplicate entries
  • Source Application Tracking - Identifies where content originated
  • Visual Content Recognition - Cards with metadata display
  • Drag & Drop Reordering - Organize entries visually

🎯 Enhanced User Experience

  • Command System - 50+ commands with autocomplete and help
  • Visual Feedback - Color-coded success/error messages with animations
  • Command History - Persistent tracking of executed commands
  • Entry Detail Overlays - Full content view with copy shortcuts
  • Customizable Display - Compact mode with configurable metadata

🔧 Technical Excellence

  • Full Unicode Support - UTF-16/UTF-8 conversion for international text
  • JSON Storage - Human-readable history with automatic persistence
  • Zero Dependencies - Single executable, no installation required
  • Thread-based Architecture - Non-blocking background operations
  • Performance Optimized - Sub-50ms command execution

Quick Start

Building

# GUI Build (Recommended)
odin build src -out:orclpm.exe -opt:3 -no-bounds-check

# CLI Build
odin build src -out:orclpm_cli.exe -opt:0 -debug

# Development with test runner
./test_build.bat

Usage Modes

🖥️ GUI Mode (Recommended)

# Double-click clipflow_raylib.exe to launch GUI
# OR run from command line:
clipflow_raylib

GUI Features:

  • Visual Card Layout - Each clipboard entry displayed as a card with metadata
  • Command Palette - Press Ctrl+K to open command overlay
  • Entry Management - Double-click cards for full content view
  • Drag & Drop - Reorder entries by dragging cards
  • Copy Shortcuts - Ctrl+Alt+C or click copy buttons
  • Real-time Updates - Background monitoring with visual feedback

🎯 Interactive CLI Mode

# Start interactive mode with background monitoring:
orclpm interactive

# Interactive session example:
ORCLPM Interactive Mode
========================
Starting background daemon thread...
Background daemon started successfully

Available commands:
  list [--all] [--full] [--compact] - Show clipboard history
  get <index/id>                   - Copy entry back to clipboard  
  capture                          - Manually capture current clipboard
  search <text>                    - Search clipboard history
  delete <index/id>                - Remove entry from history
  clear                            - Clear all history
  settings                         - Configure display options
  status                           - Show daemon status
  help                             - Show comprehensive help
  quit, exit, q                    - Exit interactive mode

orclpm> list --compact
orclpm> search "important text"
orclpm> get 1

🖥️ Direct CLI Commands

# Core operations
orclpm capture                    # Save current clipboard
orclpm list                       # Show recent entries (last 20)
orclpm list --all --full          # Show all with full text
orclpm get 5                      # Restore entry #5
orclpm search "query"              # Search history

# Management
orclpm delete 3                   # Remove entry #3
orclpm clear                      # Clear all history
orclpm status                     # Check monitoring status

# Background monitoring
orclpm monitor                    # Run foreground monitoring
orclpm --daemon-worker            # Background worker mode

Architecture

src/
├── main.odin                    # Entry point and mode routing
├── clipboard/
│   ├── types.odin              # Core data structures
│   └── system.odin             # Windows clipboard API integration
├── storage/
│   └── history.odin            # JSON persistence and retrieval
├── cli/
│   └── commands.odin           # CLI parsing and execution
├── commands/
│   ├── command_processor.odin  # Enhanced command system
│   ├── command_feedback.odin   # Visual feedback management
│   ├── command_processor_test.odin # Unit tests
│   └── test_runner.odin        # Test framework
├── gui/
│   ├── core/
│   │   ├── raylib_main.odin    # GUI application entry
│   │   └── window_manager.odin # Window management
│   ├── components/
│   │   ├── ui_components.odin  # Reusable UI elements
│   │   ├── ui_panels.odin      # Panel layouts
│   │   ├── window_manager.odin # Window controls
│   │   ├── console_manager.odin# Debug console
│   │   ├── font_manager.odin   # Font handling
│   │   ├── color_picker.odin   # Color customization
│   │   └── toggle_switch.odin  # UI controls
│   ├── entries/
│   │   ├── card_renderer.odin  # Card visualization
│   │   ├── card_helpers.odin   # Card utilities
│   │   ├── card_metadata.odin  # Metadata display
│   │   ├── card_text.odin      # Text rendering
│   │   ├── drag_drop_manager.odin # Drag & drop
│   │   ├── entry_id_manager.odin # ID management
│   │   ├── entry_interactions.odin # User interactions
│   │   └── entry_renderer.odin # Entry display
│   ├── overlays/
│   │   ├── overlay_manager.odin    # Overlay system
│   │   ├── overlay_rendering.odin  # Overlay graphics
│   │   ├── overlay_animations.odin # Animation system
│   │   ├── overlay_state.odin      # State management
│   │   ├── command_content.odin    # Command palette UI
│   │   ├── command_system.odin     # Command integration
│   │   ├── console_overlay.odin    # Debug console overlay
│   │   ├── entry_detail_overlay.odin # Entry details
│   │   ├── help_content.odin       # Help system
│   │   ├── settings_content.odin   # Settings UI
│   │   └── color_picker_content.odin # Color picker
│   └── state/
│       └── ui_state.odin           # Global UI state
├── performance/
│   └── window_performance.odin     # Performance monitoring
└── utils/
    ├── files.odin              # File system utilities
    ├── time.odin               # Timestamp handling
    ├── hash.odin               # Content deduplication
    └── display.odin            # Display formatting

Implementation Status ✅

Phase 1: Core Foundation ✅

  • Core clipboard capture and retrieval
  • Windows clipboard integration with native APIs
  • JSON file storage with automatic persistence
  • Comprehensive CLI commands (capture, list, get, search, delete, clear)
  • Advanced command parsing with argument validation
  • Content deduplication using SHA-1 hashing
  • Full Unicode support (UTF-16/UTF-8)

Phase 2: Interactive Mode & Monitoring ✅

  • Interactive CLI mode with background daemon
  • Thread-based real-time monitoring
  • Windows sequence number change detection
  • Source application tracking with window titles
  • Double-click to start functionality
  • Proper thread lifecycle management
  • Comprehensive logging system

Phase 3: Advanced Command System ✅

  • Enhanced command processor with 50+ commands
  • Command history tracking (last 50 commands)
  • Visual feedback system with color coding
  • Command autocomplete and suggestions
  • Comprehensive help system with examples
  • Error handling with detailed messaging
  • Unit testing framework with test runner

Phase 4: GUI Interface ✅

  • Raylib-powered visual interface
  • Card-based entry display with metadata
  • Drag & drop entry reordering
  • Command palette overlay (Ctrl+K)
  • Entry detail overlays with full content
  • Visual animations and transitions
  • Customizable themes and colors
  • Font management and rendering
  • Window management with native integration

Phase 5: Advanced Features ✅

  • Search functionality across clipboard history
  • Entry management (delete, clear, organize)
  • Performance monitoring and optimization
  • Configurable display modes (compact/full)
  • Visual feedback with timed animations
  • Debug console with logging levels
  • Settings system with persistent configuration
  • Color picker for UI customization

Configuration & Storage

Storage Locations

  • History File: %APPDATA%\ORCLPM\history.json
  • Daemon Logs: C:\temp\orclpm_daemon.log
  • Daemon State: C:\temp\orclpm_daemon_state.txt
  • Process ID: C:\temp\orclpm_daemon.pid

Customizable Settings

  • Display Modes: Compact/full, metadata visibility (IDs, timestamps, sources)
  • Visual Themes: Dark Modern, customizable colors for different content types
  • Font Configuration: System font loading with fallback support
  • Window Behavior: Resizable interface, overlay animations
  • Command History: Persistent tracking of executed commands
  • Performance Settings: Monitoring intervals, save frequency

Technical Details

Core Architecture

  • Dual-Mode Design: Separate CLI and GUI executables with shared core libraries
  • Thread-based Monitoring: Main thread for UI, dedicated background thread for clipboard monitoring
  • Modular Component System: 50+ source files organized by functionality
  • Command Processing: Enhanced command system with autocomplete, history, and feedback
  • State Management: Centralized UI state with proper synchronization

Platform Integration

  • Windows API Integration: Native user32.dll and kernel32.dll for clipboard and window management
  • Sequence Number Detection: Efficient change detection using GetClipboardSequenceNumber()
  • Window Title Capture: Active window tracking with GetWindowText() and GetForegroundWindow()
  • Process Management: Background daemon with PID file management
  • System Integration: Startup support, global hotkeys, native window behavior

Performance & Reliability

  • Sub-50ms Command Execution: Optimized command processing pipeline
  • Memory Management: Proper cleanup with Odin's manual memory management
  • Content Deduplication: SHA-1 hashing prevents duplicate storage
  • Unicode Support: Full UTF-16/UTF-8 conversion for international text
  • Error Handling: Comprehensive error reporting with user-friendly messages
  • Performance Monitoring: Built-in performance tracking and optimization

Graphics & UI

  • Raylib Integration: Hardware-accelerated rendering with 60 FPS target
  • Card-based Layout: Dynamic masonry-style grid with responsive design
  • Animation System: Smooth transitions and visual feedback
  • Font Rendering: Custom font loading with system font fallback
  • Color Management: Theme system with customizable color schemes
  • Overlay System: Multi-layered UI with command palette and detail views

Data & Storage

  • JSON Persistence: Human-readable history format with versioning
  • Automatic Saving: Periodic saves every 5 seconds with manual save on exit
  • Data Integrity: Hash verification and duplicate prevention
  • Backup Strategy: Incremental saves prevent data loss
  • Configuration Management: Persistent settings with runtime configuration

Debugging & Development

Logging System

ORCLPM includes a comprehensive logging system for debugging and monitoring:

Log Locations:

  • Daemon Logs: C:\temp\orclpm_daemon.log
  • GUI Console: Built-in debug console accessible via overlays
  • Command Feedback: Real-time feedback in GUI and CLI modes

Log Levels:

  • DEBUG: Detailed operation information
  • INFO: General application events
  • WARNING: Non-critical issues
  • ERROR: Critical failures

Example Log Entries:

[2025-07-14 11:05:36.251546900 +0000 UTC] [DEBUG] Clipboard change detected: 1501 -> 1510
[2025-07-14 11:05:36.314305600 +0000 UTC] [INFO] Got clipboard text: 169 chars from Microsoft​ Edge
[2025-07-14 11:05:36.315458500 +0000 UTC] [INFO] Added entry to history from Microsoft​ Edge
[2025-07-14 11:05:36.400123000 +0000 UTC] [DEBUG] GUI: Rendered 15 entries in grid layout
[2025-07-14 11:05:36.401234500 +0000 UTC] [DEBUG] Command: "list --compact" executed successfully

Development Tools

  • Unit Testing Framework: Comprehensive test suite with automated runner
  • Performance Monitoring: Built-in performance tracking and metrics
  • Debug Console: Real-time logging and command execution in GUI
  • Build Scripts: Automated build and test verification
  • Component Testing: Individual module testing and validation

Keyboard Shortcuts

GUI Mode

  • Ctrl+K: Open command palette overlay
  • Ctrl+Alt+C: Copy selected/latest entry to clipboard
  • Double-click: View full entry details in overlay
  • Drag & Drop: Reorder entries in grid layout
  • Escape: Close overlays and dialogs
  • F1: Show help overlay
  • F12: Toggle debug console

CLI Mode

  • Tab: Autocomplete commands
  • Up/Down Arrows: Navigate command history
  • Ctrl+C: Exit interactive mode
  • Enter: Execute command

Integration with Windows

Startup Integration

To run ORCLPM at Windows startup:

  1. Press Win + R, type shell:startup, press Enter
  2. Create shortcut to orclpm.exe in startup folder
  3. Optionally use --daemon-worker flag for headless operation

System Tray (Future Enhancement)

  • Minimize to system tray for background operation
  • Quick access menu with recent entries
  • Visual notifications for clipboard changes

Future Enhancements

Planned Features

  • Cloud Synchronization: Sync clipboard history across devices
  • Smart Categorization: Auto-categorize content (URLs, code, text, etc.)
  • Advanced Search: Fuzzy matching and content indexing
  • Plugin System: Extensible architecture for custom functionality
  • Export/Import: Backup and restore clipboard history
  • Security Features: Encryption for sensitive content, exclude patterns

Performance Optimizations

  • Database Backend: SQLite integration for large histories
  • Indexing System: Full-text search with performance optimization
  • Memory Management: Improved caching and memory usage
  • Background Processing: Async operations for better responsiveness

🤝 Contributing

This project welcomes community contributions! Whether you want to fix bugs, add features, improve documentation, or port to other platforms, your help is appreciated.

See CONTRIBUTING.md for:

  • Development setup guide
  • Code structure overview
  • Contribution guidelines
  • Areas needing help
  • Pull request process

Quick Contribution Ideas

  • Fix bugs: Check GitHub issues for known problems
  • Add features: Implement items from Future Enhancements
  • Improve docs: Add tutorials, screenshots, or examples
  • Port to other platforms: Linux/macOS clipboard support
  • Optimize performance: Profile and improve bottlenecks
  • Add tests: Unit and integration tests

📚 Documentation

🎓 Why Odin & Raylib?

Odin is a modern systems programming language that's a joy to work with:

  • Clear, readable syntax
  • Great performance comparable to C
  • Excellent for system-level programming
  • Growing community and ecosystem
  • Better than C++/Rust for many use cases

Raylib is a simple and easy-to-use game development library:

  • Clean C API with excellent Odin bindings
  • Cross-platform support
  • Perfect for GUI applications
  • Minimal dependencies
  • Active development

This project demonstrates that you can build production-quality desktop applications with this stack!

🙏 Acknowledgments

  • Odin Community - For creating an excellent systems programming language
  • Raylib - For making GUI development accessible and fun
  • Contributors - Everyone who helps improve this project

License

MIT License - See LICENSE file for details.


Note: This project represents real-world exploration of Odin and Raylib for desktop application development. While it has some rough edges, it works well and demonstrates powerful concepts. We hope it helps you on your Odin/Raylib journey! 🚀

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published