- Use CoreGraphics (core-graphics crate) for global mouse position instead of Tauri's window-relative cursor_position() which fails when hidden - Switch to titleBarStyle overlay with hiddenTitle for native resize handles while keeping the frameless look (decorations:false had no resize affordance) - Fix paste_and_refocus: use .output() instead of .spawn() so osascript actually completes, increase delay to 250ms for reliable app refocus - Add comprehensive App.test.tsx (7 integration tests) bringing total to 47 - Add multi-select and type badge tests for ClipboardList and ContextMenu - Update Tauri mock in setup.ts with innerSize/scaleFactor for resize tests - Create .cursor/rules/ with 4 rule files for project conventions - Add npm run lint and npm run check scripts - Update README with full usage table and current test counts (74 total) Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
---
|
|
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`
|