--- description: maCopy project overview and architecture alwaysApply: true --- # maCopy — macOS Clipboard Manager Tauri 2 desktop app: Rust backend + React/TypeScript frontend. ## Architecture - `src-tauri/src/lib.rs` — App setup, tray icon, global hotkey (Cmd+Shift+V), window management - `src-tauri/src/clipboard.rs` — Background polling thread (500ms), SHA-256 dedup, arboard crate - `src-tauri/src/db.rs` — SQLite via rusqlite, FTS5 full-text search, settings CRUD - `src-tauri/src/commands.rs` — Tauri IPC commands exposed to frontend - `src/App.tsx` — Main React component, state, keyboard nav, multi-select - `src/components/` — SearchBar, ClipboardList, ContextMenu, SettingsPanel ## Key Patterns - Window positions near cursor via CoreGraphics (`core-graphics` crate) - Paste-to-previous-app: hide window → 250ms delay → AppleScript `Cmd+V` - Window uses `titleBarStyle: "overlay"` with `hiddenTitle` for native resize + frameless look - Settings stored in SQLite `settings` table as key-value pairs - Clipboard entries deduplicated by SHA-256 hash, auto-trimmed to max_history ## Testing - Rust: `cargo test` in `src-tauri/` — 27 unit tests (db, clipboard hashing) - Frontend: `npx vitest run` — 47 tests (App, SearchBar, ClipboardList, ContextMenu, SettingsPanel) - Tauri APIs mocked in `src/test/setup.ts`