A clipboard manager applet for the COSMIC desktop environment, built with Rust using the libcosmic framework and iced GUI toolkit. It monitors the system clipboard using wl-clipboard-rs, stores history in SQLite, and provides a searchable interface with a two-panel Raycast-style UI.
- Entry point that initializes logging, localization, and configuration
- Runs the COSMIC applet with SQLite backend
- Handles version flag (
-V,--version)
- Main application logic using
cosmic::Applicationtrait - Manages popup windows (main clipboard view and quick settings)
- Handles navigation, clipboard events, and user interactions
- Key structures:
AppState<Db>: Main application state with database, config, and UI stateClipboardState: Tracks connection status or errorsPopupKind: Differentiates between main popup and quick settings
- SQLite Backend (
sqlite_db.rs): Persistent storage with:- Entry table for clipboard items
- Favorite marking support
- Automatic cleanup based on entry limits and lifetime
- Full-text search capabilities
- MIME type storage for each entry
- Uses Wayland's
zwlr_data_control_v1protocol - Monitors clipboard changes in real-time
- Filters X11 MIME types to prevent crashes with apps like Sublime Text
- Persistence via
wl-clipboard-rs: spawns background thread to serve data - Private mode support (disables monitoring when enabled)
- Maccy-like Interface: Minimalist list view, optimized for rapid keyboard navigation.
- Rich Content Support:
- Captures Text (default).
- Optional support for Images and Binary data.
- Thumbnails: Automatically generates and displays previews for copied images.
- Quick Settings Panel: Toggle private mode, unique session, clear entries
- Search Bar: Real-time filtering with pagination controls
- Keyboard event handling:
- Arrow keys: Navigate list (Up/Down in vertical, Left/Right in horizontal)
- Enter: Copy focused entry and close popup
- Delete: Remove focused entry (works even when search input is focused)
- Escape: Close popup
- Event subscription system using
iced::Subscription
- Cosmic config integration with auto-reload
- Settings:
private_mode: Disable clipboard monitoringmaximum_entries_lifetime: Days to keep entries (default: 30)maximum_entries_number: Max total entries (default: 500)maximum_entries_by_page: Entries per page (default: 10)user_session: Clear on logoutpreferred_mime_types: Regex patterns for MIME type priority
- Event-driven architecture with message types:
AppMsg: Main application messagesConfigMsg: Configuration changesDbMessage: Database operations- Clipboard events, navigation events, user actions
- Real-time clipboard change detection
- Multi-MIME type support (text, images, file URIs)
- X11 MIME filter to prevent app crashes
- Automatic deduplication on insert
- Full-text search across entries
- Keyboard navigation with arrow keys
- Pagination (10 items per page by default)
- Auto-scrolling to focused item
- Favorite marking (★)
- Delete individual entries
- Clear all entries
- Copy on click or Enter key
- Automatic cleanup based on age/count limits
- Uses
wl-clipboard-rsto serve data in background - Prevents data loss when source app closes
- Spawns daemon thread that exits when clipboard is overtaken
- Raycast-inspired two-panel layout
- 800px wide popup (700-900px limits)
- Compact list preview (30 chars) + full content panel
- Responsive to theme changes
- No Icons and Completely Keyboard driven
- Private mode: Disables monitoring
- Unique session: Auto-clear on app exit
- No persistent clipboard when session ends
- libcosmic: COSMIC desktop framework with applet support
- iced: Cross-platform GUI framework
- sqlx: Async SQLite operations
- wl-clipboard-rs: Wayland clipboard interaction
- tokio: Async runtime
- Requires
zwlr_data_control_manager_v1protocol - On COSMIC, must be enabled via:
echo 'export COSMIC_DATA_CONTROL_ENABLED=1' | sudo tee /etc/profile.d/data_control_cosmic.sh > /dev/null
# Build
just build-release
# Run (for testing)
just run
# Install
just install # or equivalent make install- Entry Limits: Default 500 entries, configurable
- Page Size: 10 items per page reduces rendering load
- Lazy Loading: Only render visible page range
- Image Caching: Uses
icedimage handles - Database Indexing: Timestamp and favorite columns indexed
- Protocol Security:
zwlr_data_control_v1allows privileged clipboard access - Private Mode: Completely disables monitoring
- Unique Session: No persistence between logins
- No Network: All data stored locally in SQLite
- Syntax highlighting for code snippets
- Advanced filtering (by type, date, favorites)
- Export/import clipboard history
- Clipboard sharing across devices (if network feature added)
- Plugin system for custom content handlers
- Global keyboard shortcut when COSMIC supports it