Skip to content

Commit 547ec71

Browse files
committed
Squashed commit of the following:
commit bdf23c8 Merge: 87ffbc2 d654add Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun Nov 30 21:38:31 2025 +0800 Merge pull request CapSoftware#1417 from CapSoftware/cursor/optimize-editor-performance-for-large-videos-claude-4.5-opus-high-thinking-fb23 Optimize editor performance for large videos commit d654add Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun Nov 30 21:35:01 2025 +0800 fmt commit 3213283 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun Nov 30 21:27:29 2025 +0800 clippy commit 35f9380 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun Nov 30 21:13:41 2025 +0800 fmt commit d1e708a Author: Cursor Agent <cursoragent@cursor.com> Date: Sun Nov 30 10:47:39 2025 +0000 Refactor playback prefetching to use tokio mpsc and futures Co-authored-by: richiemcilroy1 <richiemcilroy1@gmail.com> commit 23f8516 Author: Cursor Agent <cursoragent@cursor.com> Date: Sun Nov 30 10:45:29 2025 +0000 Checkpoint before follow-up message Co-authored-by: richiemcilroy1 <richiemcilroy1@gmail.com> commit 9bb14bb Author: Cursor Agent <cursoragent@cursor.com> Date: Sun Nov 30 10:23:27 2025 +0000 Refactor: Improve editor performance and UI responsiveness Co-authored-by: richiemcilroy1 <richiemcilroy1@gmail.com> commit 87ffbc2 Merge: 3cb22ad 0e16f7c Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 16:30:29 2025 +0530 Merge pull request CapSoftware#1410 from p-delorme/fix-camera-init Handles legacy camera size (strings) commit 0e16f7c Merge: 21f197e 3cb22ad Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 18:48:41 2025 +0800 Merge branch 'main' into pr/1410 commit 3cb22ad Merge: 2330c53 48f7aeb Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 10:00:30 2025 +0530 Merge pull request CapSoftware#1395 from CapSoftware/screenshots commit 48f7aeb Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 12:02:29 2025 +0800 fmt commit 126421d Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 11:59:07 2025 +0800 types/clippy bits commit cdc91c0 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 11:47:16 2025 +0800 Throw SilentError on export cancellation commit 980720e Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 11:47:06 2025 +0800 Add image dimension and data validation to editor commit 860ccd7 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 11:46:57 2025 +0800 Add camera_cleanup_done flag to prevent redundant cleanup commit 38cc696 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 29 00:02:07 2025 +0800 claude settings commit e2545ee Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 23:58:31 2025 +0800 Improve screenshot capture reliability and performance commit ba9ba53 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 23:58:17 2025 +0800 Add validation for annotation and camera config commit 641a99a Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 23:58:03 2025 +0800 Show toast on screenshot failure in overlay commit ba901dd Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 22:48:55 2025 +0800 Add keyboard shortcuts for export actions in Header commit c73f735 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 21:47:48 2025 +0800 Add stride check in FFmpeg frame conversion commit 6825eb3 Merge: 4d73f14 2330c53 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 21:23:41 2025 +0800 Merge branch 'main' into screenshots commit 2330c53 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 20:22:42 2025 +0800 fix: margin on mobile nav commit 0765fee Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 20:16:06 2025 +0800 feat: Cap Friday commit 4d73f14 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 04:55:51 2025 +0530 Add fast screenshot capture and shared GPU context commit f8f1d01 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 04:54:15 2025 +0530 Add toast notifications for screenshot actions commit bb0310d Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 01:16:47 2025 +0530 misc bits commit ed64349 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 01:16:42 2025 +0530 Refactor camera window cleanup logic commit 2b1eb9e Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 01:16:25 2025 +0530 Handle errors during titlebar initialization commit eafc7d9 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 01:16:12 2025 +0530 Refactor import and error handling in screenshot_editor.rs commit d776857 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 01:15:59 2025 +0530 Optimize PNG screenshot encoding settings commit 737b89a Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 01:15:42 2025 +0530 Remove unused mutable binding in camera_legacy.rs commit 37456d3 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:39:08 2025 +0530 Disable cursor capture in screenshot functionality commit 694de05 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:24:07 2025 +0530 Refactor camera preview to use broadcast channel commit 7c68831 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:23:58 2025 +0530 Switch frame channel from flume to tokio broadcast commit 3a39c9c Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:23:25 2025 +0530 Refactor WebSocket frame handling to use broadcast channel commit f12c13e Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:23:14 2025 +0530 Refactor render shutdown handling in screenshot editor commit 3c4a124 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:23:05 2025 +0530 Remove timestamp from screenshot src commit 032b819 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:21:25 2025 +0530 Handle shutdown in screenshot editor render loop commit 7dd146a Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri Nov 28 00:15:59 2025 +0530 Handle missing ScreenshotEditor instance gracefully commit 21f197e Author: Patrick Delorme <pdelorme@agence104.com> Date: Wed Nov 26 22:18:33 2025 -0500 Handles legacy camera size strings commit 9d22e01 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 22 09:24:47 2025 +0000 0.4.0 commit af1cc60 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sat Nov 22 10:45:45 2025 +0530 feat: Screenshots V1 - Enhance screenshot editor with mask tool and export cancel commit 61982eb Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu Nov 20 16:03:26 2025 +0000 Add screenshot export improvements and new icon commit 1996ab6 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu Nov 20 15:28:16 2025 +0000 Implement Windows screenshot capture support commit 7bd9644 Merge: 6dcb6f2 f272bbf Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu Nov 20 15:22:15 2025 +0000 Merge branch 'main' into screenshots commit a292974 Merge: f272bbf 4a41f99 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu Nov 20 15:21:54 2025 +0000 Merge pull request CapSoftware#1381 from phuocithcmus/fix/window-memory-leak-processout fix: window memory leak - memory increase while recording commit 6dcb6f2 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu Nov 20 15:03:01 2025 +0000 Refactor mask blur logic for screenshot editor commit b4c8a17 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu Nov 20 12:51:21 2025 +0000 feat: Screenshot editor styling/layout + Mask annotation commit f272bbf Merge: 563e238 bab0348 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 19:01:40 2025 +0000 Merge pull request CapSoftware#1396 from ItsEeleeya/new-theme-previews New theme preview icons commit bab0348 Author: Ilya <47112191+ItsEeleeya@users.noreply.github.com> Date: Wed Nov 19 21:54:35 2025 +0330 Remove unused commit ef4a54f Author: Ilya <47112191+ItsEeleeya@users.noreply.github.com> Date: Wed Nov 19 21:45:33 2025 +0330 New theme preview icons commit f92090a Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 17:57:11 2025 +0000 Add screenshot support to target selection UI commit 849b702 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 17:20:53 2025 +0000 Replace Button with native button in TargetMenuPanel commit f28cffd Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 17:15:52 2025 +0000 Add recordings grid and menu to main window commit 84d1baa Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 16:55:52 2025 +0000 Refactor screenshot saving and editor window management commit f9450c8 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 16:55:35 2025 +0000 Add screenshot mode and image icon support commit 11007c2 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 16:55:23 2025 +0000 Refactor screenshot editor and add screenshots tab commit 77cac64 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 02:45:50 2025 +0000 Integrate live preview for screenshot editor commit c982991 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 02:45:40 2025 +0000 Add screenshot editor integration and DecodedFrame constructor commit 50ca057 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 02:45:24 2025 +0000 Add screenshot editor backend implementation commit 4c3b942 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 02:31:13 2025 +0000 Allow Slider to accept custom history prop commit f7047a0 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 02:29:18 2025 +0000 feat: v1 of screenshots commit 563e238 Merge: 9edf1ce 2f75043 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:33:18 2025 +0000 Merge pull request CapSoftware#1390 from CapSoftware/editor-perf feat: Various features + performance bits commit 2f75043 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:30:49 2025 +0000 clippy bits commit ef920b2 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:20:04 2025 +0000 gen'd files commit 695bb66 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:19:52 2025 +0000 Fix requestAnimationFrame cleanup in overlay commit 0510be8 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:19:44 2025 +0000 Add __CAP__ property to Window interface commit 756d296 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:19:29 2025 +0000 Improve camera window resizing and positioning logic commit ff78eba Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Wed Nov 19 00:19:09 2025 +0000 Clarify and emphasize no code comments policy commit 6db1d2d Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 23:41:03 2025 +0000 Remove unused setCamera mutation in camera page commit 51e2f6e Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 23:38:43 2025 +0000 misc packages commit a0aeffa Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 23:38:32 2025 +0000 Refactor duration calculation for readability commit fd30b14 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 21:52:38 2025 +0000 Add checked_duration_since for timestamp types commit 05f39bb Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 21:46:20 2025 +0000 Improve countdown animation and fix recording logic commit dec0d8e Merge: 0066eb1 5de394f Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 21:44:52 2025 +0000 Merge branch 'editor-perf' of https://github.com/CapSoftware/Cap into editor-perf commit 0066eb1 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 21:36:48 2025 +0000 Add camera overlay bounds update and revert logic commit 5de394f Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 20:51:15 2025 +0000 Update apps/desktop/src-tauri/src/camera.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> commit e6e9320 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 18:26:21 2025 +0000 Improve logging and error context in recording pipeline commit d24e92c Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 17:10:19 2025 +0000 Add code formatting guidelines to documentation commit 2b504dd Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 16:54:29 2025 +0000 Update camera.tsx commit 891b122 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 16:54:02 2025 +0000 Improve camera feed sender handling and logging commit 831fb76 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 16:53:42 2025 +0000 Fix import order in experimental settings route commit dd39425 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 16:41:22 2025 +0000 Set Mellow as default for CursorAnimationStyle commit ce63e02 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 16:41:11 2025 +0000 Add resizing to camera window commit 6dd3ff1 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 16:40:46 2025 +0000 Hide native camera preview toggle on Windows commit 44a5348 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 15:14:03 2025 +0000 Refactor type casting for currentRecording data commit 41fbc5c Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 14:51:41 2025 +0000 Improve camera initialization and recording state handling commit 6aca28e Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 14:51:33 2025 +0000 Add initializing state to recording flow commit d2b8fd4 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 14:50:45 2025 +0000 Update close button to use window close action commit fee3391 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 12:00:28 2025 +0000 Reset camera and mic state on window close and recording end commit 184ad59 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 10:49:45 2025 +0000 lost a days work (I F'D UP) commit 8b403a8 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Tue Nov 18 10:40:07 2025 +0000 Update recording UI container styles commit 37eb7c8 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 20:52:24 2025 +0000 Update settings.local.json commit cced653 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 20:52:18 2025 +0000 Improve camera frame forwarding and logging commit dbe8ae1 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 20:50:12 2025 +0000 Refactor waveform rendering in ClipTrack commit 5d95f24 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 20:15:25 2025 +0000 Handle excluded windows in macOS screen capture commit b61958c Merge: bd1fc73 9edf1ce Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 17:12:38 2025 +0000 Merge branch 'main' into editor-perf commit bd1fc73 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 13:07:30 2025 +0000 fmt commit 0a5fea6 Author: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Mon Nov 17 13:07:10 2025 +0000 Refactor project config save with custom debounce commit 4a41f99 Author: phuocnd <ducphuoc.t9@gmail.com> Date: Wed Nov 12 16:15:42 2025 +0700 fix: window memory leak - memory increase while streaming
1 parent 715fece commit 547ec71

File tree

113 files changed

+11861
-2871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+11861
-2871
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"Bash(pnpm typecheck:*)",
55
"Bash(pnpm lint:*)",
66
"Bash(pnpm build:*)",
7-
"Bash(cargo check:*)"
7+
"Bash(cargo check:*)",
8+
"Bash(cargo fmt:*)"
89
],
910
"deny": [],
1011
"ask": []

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Rust: `rustfmt` + workspace clippy lints.
2121
- Naming: files kebab‑case (`user-menu.tsx`); components PascalCase; Rust modules snake_case, crates kebab‑case.
2222
- Runtime: Node 20, pnpm 10.x, Rust 1.88+, Docker for MySQL/MinIO.
23+
- **NO COMMENTS**: Never add comments to code (`//`, `/* */`, `///`, `//!`, `#`, etc.). Code must be self-explanatory through naming, types, and structure. This applies to all languages (TypeScript, Rust, JavaScript, etc.).
2324

2425
## Testing
2526
- TS/JS: Vitest where present (e.g., desktop). Name tests `*.test.ts(x)` near sources.
@@ -37,10 +38,15 @@
3738
- Database flow: always `db:generate``db:push` before relying on new schema.
3839
- Keep secrets out of VCS; configure via `.env` from `pnpm env-setup`.
3940
- macOS note: desktop permissions (screen/mic) apply to the terminal running `pnpm dev:desktop`.
41+
- **CRITICAL: NO CODE COMMENTS**: Never add any form of comments (`//`, `/* */`, `///`, `//!`, `#`, etc.) to generated or edited code. Code must be self-explanatory.
4042

4143
## Effect Usage
4244
- Next.js API routes in `apps/web/app/api/*` are built with `@effect/platform`'s `HttpApi` builder; copy the existing class/group/endpoint pattern instead of ad-hoc handlers.
4345
- Acquire backend services (e.g., `Videos`, `S3Buckets`) inside `Effect.gen` blocks and wire them through `Layer.provide`/`HttpApiBuilder.group`, translating domain errors to `HttpApiError` variants.
4446
- Convert the effectful API to a Next.js handler with `apiToHandler(ApiLive)` from `@/lib/server` and export the returned `handler`—avoid calling `runPromise` inside route files.
4547
- On the server, run effects through `EffectRuntime.runPromise` from `@/lib/server`, typically after `provideOptionalAuth`, so cookies and per-request context are attached automatically.
4648
- On the client, use `useEffectQuery`/`useEffectMutation` from `@/lib/EffectRuntime`; they already bind the managed runtime and tracing so you shouldn't call `EffectRuntime.run*` directly in components.
49+
50+
## Code Formatting
51+
- Always format code before completing work: run `pnpm format` for TypeScript/JavaScript and `cargo fmt` for Rust.
52+
- Run these commands regularly during development and always at the end of a coding session to ensure consistent formatting.

CLAUDE.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,12 @@ Minimize `useEffect` usage: compute during render, handle logic in event handler
360360
- Windowing/permissions are handled in Rust; keep UI logic in Solid and avoid mixing IPC with rendering logic.
361361

362362
## Conventions
363-
- No code comments: Never add inline, block, or docstring comments in any language. Code must be self-explanatory through naming, types, and structure. Use docs/READMEs for explanations when necessary.
363+
- **CRITICAL: NO CODE COMMENTS**: Never add any form of comments to code. This includes:
364+
- Single-line comments: `//` (JavaScript/TypeScript/Rust), `#` (Python/Shell)
365+
- Multi-line comments: `/* */` (JavaScript/TypeScript), `/* */` (Rust)
366+
- Documentation comments: `///`, `//!` (Rust), `/** */` (JSDoc)
367+
- Any other comment syntax in any language
368+
- Code must be self-explanatory through naming, types, and structure. Use docs/READMEs for explanations when necessary.
364369
- Directory naming: lower-case-dashed
365370
- Components: PascalCase; hooks: camelCase starting with `use`
366371
- Strict TypeScript; avoid `any`; leverage shared types
@@ -414,3 +419,11 @@ Transcription/AI Enhancement → Database Storage
414419
- **Monorepo Guide**: Turborepo documentation
415420
- **Effect System**: Used in web-backend packages
416421
- **Media Processing**: FFmpeg documentation for Rust bindings
422+
423+
## Code Formatting
424+
425+
Always format code before completing work:
426+
- **TypeScript/JavaScript**: Run `pnpm format` to format all code with Biome
427+
- **Rust**: Run `cargo fmt` to format all Rust code with rustfmt
428+
429+
These commands should be run regularly during development and always at the end of a coding session to ensure consistent formatting across the codebase.

Cargo.lock

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ dbg_macro = "deny"
7070
let_underscore_future = "deny"
7171
unchecked_duration_subtraction = "deny"
7272
collapsible_if = "deny"
73-
manual_is_multiple_of = "deny"
7473
clone_on_copy = "deny"
7574
redundant_closure = "deny"
7675
ptr_arg = "deny"

apps/cli/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ impl Export {
172172
// print!("\rrendered frame {f}");
173173

174174
stdout.flush().unwrap();
175+
true
175176
})
176177
.await
177178
.map_err(|v| format!("Exporter error: {v}"))?;

apps/desktop/core

54.8 MB
Binary file not shown.

apps/desktop/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cap-desktop"
3-
version = "0.3.87"
3+
version = "0.4.0"
44
description = "Seamless sharing for modern product teams"
55
authors = ["you"]
66
edition = "2024"

apps/desktop/src-tauri/src/camera.rs

Lines changed: 98 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@ static TOOLBAR_HEIGHT: f32 = 56.0; // also defined in Typescript
2828
// Basically poor man's MSAA
2929
static GPU_SURFACE_SCALE: u32 = 4;
3030

31-
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize, Type)]
32-
#[serde(rename_all = "lowercase")]
33-
pub enum CameraPreviewSize {
34-
#[default]
35-
Sm,
36-
Lg,
37-
}
31+
pub const MIN_CAMERA_SIZE: f32 = 150.0;
32+
pub const MAX_CAMERA_SIZE: f32 = 600.0;
33+
pub const DEFAULT_CAMERA_SIZE: f32 = 230.0;
3834

3935
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize, Type)]
4036
#[serde(rename_all = "lowercase")]
@@ -45,13 +41,27 @@ pub enum CameraPreviewShape {
4541
Full,
4642
}
4743

48-
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize, Type)]
44+
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Type)]
4945
pub struct CameraPreviewState {
50-
size: CameraPreviewSize,
46+
size: f32,
5147
shape: CameraPreviewShape,
5248
mirrored: bool,
5349
}
5450

51+
impl Default for CameraPreviewState {
52+
fn default() -> Self {
53+
Self {
54+
size: DEFAULT_CAMERA_SIZE,
55+
shape: CameraPreviewShape::default(),
56+
mirrored: false,
57+
}
58+
}
59+
}
60+
61+
fn clamp_size(size: f32) -> f32 {
62+
size.clamp(MIN_CAMERA_SIZE, MAX_CAMERA_SIZE)
63+
}
64+
5565
pub struct CameraPreviewManager {
5666
store: Result<Arc<tauri_plugin_store::Store<tauri::Wry>>, String>,
5767
preview: Option<InitializedCameraPreview>,
@@ -70,17 +80,22 @@ impl CameraPreviewManager {
7080

7181
/// Get the current state of the camera window.
7282
pub fn get_state(&self) -> anyhow::Result<CameraPreviewState> {
73-
Ok(self
83+
let mut state: CameraPreviewState = self
7484
.store
7585
.as_ref()
7686
.map_err(|err| anyhow!("{err}"))?
7787
.get("state")
78-
.and_then(|v| serde_json::from_value(v).ok().unwrap_or_default())
79-
.unwrap_or_default())
88+
.and_then(|v| serde_json::from_value(v).ok())
89+
.unwrap_or_default();
90+
91+
state.size = clamp_size(state.size);
92+
Ok(state)
8093
}
8194

8295
/// Save the current state of the camera window.
83-
pub fn set_state(&self, state: CameraPreviewState) -> anyhow::Result<()> {
96+
pub fn set_state(&self, mut state: CameraPreviewState) -> anyhow::Result<()> {
97+
state.size = clamp_size(state.size);
98+
8499
let store = self.store.as_ref().map_err(|err| anyhow!("{err}"))?;
85100
store.set("state", serde_json::to_value(&state)?);
86101
store.save()?;
@@ -171,8 +186,8 @@ impl InitializedCameraPreview {
171186
1.0
172187
};
173188

174-
let size =
175-
resize_window(&window, default_state, aspect).context("Error resizing Tauri window")?;
189+
let size = resize_window(&window, default_state, aspect, true)
190+
.context("Error resizing Tauri window")?;
176191

177192
let (tx, rx) = oneshot::channel();
178193
window
@@ -562,7 +577,7 @@ impl Renderer {
562577

563578
self.sync_ratio_uniform_and_resize_window_to_it(&window, &state, aspect_ratio);
564579
self.update_state_uniforms(&state);
565-
if let Ok((width, height)) = resize_window(&window, &state, aspect_ratio)
580+
if let Ok((width, height)) = resize_window(&window, &state, aspect_ratio, false)
566581
.map_err(|err| error!("Error resizing camera preview window: {err}"))
567582
{
568583
self.reconfigure_gpu_surface(width, height);
@@ -607,16 +622,17 @@ impl Renderer {
607622

608623
/// Update the uniforms which hold the camera preview state
609624
fn update_state_uniforms(&self, state: &CameraPreviewState) {
625+
let clamped_size = clamp_size(state.size);
626+
let normalized_size =
627+
(clamped_size - MIN_CAMERA_SIZE) / (MAX_CAMERA_SIZE - MIN_CAMERA_SIZE);
628+
610629
let state_uniforms = StateUniforms {
611630
shape: match state.shape {
612631
CameraPreviewShape::Round => 0.0,
613632
CameraPreviewShape::Square => 1.0,
614633
CameraPreviewShape::Full => 2.0,
615634
},
616-
size: match state.size {
617-
CameraPreviewSize::Sm => 0.0,
618-
CameraPreviewSize::Lg => 1.0,
619-
},
635+
size: normalized_size,
620636
mirrored: if state.mirrored { 1.0 } else { 0.0 },
621637
_padding: 0.0,
622638
};
@@ -646,7 +662,7 @@ impl Renderer {
646662
bytemuck::cast_slice(&[camera_uniforms]),
647663
);
648664

649-
if let Ok((width, height)) = resize_window(window, state, aspect_ratio)
665+
if let Ok((width, height)) = resize_window(window, state, aspect_ratio, false)
650666
.map_err(|err| error!("Error resizing camera preview window: {err}"))
651667
{
652668
self.reconfigure_gpu_surface(width, height);
@@ -661,14 +677,11 @@ fn resize_window(
661677
window: &WebviewWindow,
662678
state: &CameraPreviewState,
663679
aspect: f32,
680+
should_move: bool,
664681
) -> tauri::Result<(u32, u32)> {
665682
trace!("CameraPreview/resize_window");
666683

667-
let base: f32 = if state.size == CameraPreviewSize::Sm {
668-
230.0
669-
} else {
670-
400.0
671-
};
684+
let base = clamp_size(state.size);
672685
let window_width = if state.shape == CameraPreviewShape::Full {
673686
if aspect >= 1.0 { base * aspect } else { base }
674687
} else {
@@ -680,25 +693,68 @@ fn resize_window(
680693
base
681694
} + TOOLBAR_HEIGHT;
682695

683-
let (monitor_size, monitor_offset, monitor_scale_factor): (
684-
PhysicalSize<u32>,
685-
LogicalPosition<u32>,
686-
_,
687-
) = if let Some(monitor) = window.current_monitor()? {
688-
let size = monitor.position().to_logical(monitor.scale_factor());
689-
(*monitor.size(), size, monitor.scale_factor())
690-
} else {
691-
(PhysicalSize::new(640, 360), LogicalPosition::new(0, 0), 1.0)
692-
};
696+
if should_move {
697+
let (monitor_size, monitor_offset, monitor_scale_factor): (
698+
PhysicalSize<u32>,
699+
LogicalPosition<u32>,
700+
_,
701+
) = if let Some(monitor) = window.current_monitor()? {
702+
let size = monitor.position().to_logical(monitor.scale_factor());
703+
(*monitor.size(), size, monitor.scale_factor())
704+
} else {
705+
(PhysicalSize::new(640, 360), LogicalPosition::new(0, 0), 1.0)
706+
};
707+
708+
let x = (monitor_size.width as f64 / monitor_scale_factor - window_width as f64 - 100.0)
709+
as u32
710+
+ monitor_offset.x;
711+
let y = (monitor_size.height as f64 / monitor_scale_factor - window_height as f64 - 100.0)
712+
as u32
713+
+ monitor_offset.y;
714+
715+
window.set_position(LogicalPosition::new(x, y))?;
716+
} else if let Some(monitor) = window.current_monitor()? {
717+
// Ensure the window stays within the monitor bounds when resizing
718+
let scale_factor = monitor.scale_factor();
719+
let monitor_pos = monitor.position().to_logical::<f64>(scale_factor);
720+
let monitor_size = monitor.size().to_logical::<f64>(scale_factor);
721+
722+
let current_pos = window
723+
.outer_position()
724+
.map(|p| p.to_logical::<f64>(scale_factor))
725+
.unwrap_or(monitor_pos);
726+
727+
let mut new_x = current_pos.x;
728+
let mut new_y = current_pos.y;
729+
let new_width = window_width as f64;
730+
let new_height = window_height as f64;
731+
732+
// Check right edge
733+
if new_x + new_width > monitor_pos.x + monitor_size.width {
734+
new_x = monitor_pos.x + monitor_size.width - new_width;
735+
}
693736

694-
let x = (monitor_size.width as f64 / monitor_scale_factor - window_width as f64 - 100.0) as u32
695-
+ monitor_offset.x;
696-
let y = (monitor_size.height as f64 / monitor_scale_factor - window_height as f64 - 100.0)
697-
as u32
698-
+ monitor_offset.y;
737+
// Check bottom edge
738+
if new_y + new_height > monitor_pos.y + monitor_size.height {
739+
new_y = monitor_pos.y + monitor_size.height - new_height;
740+
}
741+
742+
// Check left edge
743+
if new_x < monitor_pos.x {
744+
new_x = monitor_pos.x;
745+
}
746+
747+
// Check top edge
748+
if new_y < monitor_pos.y {
749+
new_y = monitor_pos.y;
750+
}
751+
752+
if (new_x - current_pos.x).abs() > 1.0 || (new_y - current_pos.y).abs() > 1.0 {
753+
window.set_position(LogicalPosition::new(new_x, new_y))?;
754+
}
755+
}
699756

700757
window.set_size(LogicalSize::new(window_width, window_height))?;
701-
window.set_position(LogicalPosition::new(x, y))?;
702758

703759
Ok((window_width as u32, window_height as u32))
704760
}

apps/desktop/src-tauri/src/camera.wgsl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
124124

125125
} else if (shape == 1.0) {
126126
// Square shape with enhanced corner anti-aliasing
127-
let corner_radius = select(0.1, 0.12, size == 1.0);
127+
// Interpolate corner radius based on normalized size (0-1)
128+
let corner_radius = mix(0.10, 0.14, size);
128129
let abs_uv = abs(center_uv);
129130
let corner_pos = abs_uv - (1.0 - corner_radius);
130131
let corner_dist = length(max(corner_pos, vec2<f32>(0.0, 0.0)));
@@ -138,7 +139,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
138139
} else if (shape == 2.0) {
139140
// Full shape with aspect ratio-corrected rounded corners
140141
let window_aspect = window_uniforms.window_width / window_uniforms.window_height;
141-
let corner_radius = select(0.08, 0.1, size == 1.0); // radius based on size (8% for small, 10% for large)
142+
// Interpolate corner radius based on normalized size (0-1)
143+
let corner_radius = mix(0.08, 0.12, size);
142144

143145
let abs_uv = abs(center_uv);
144146
let corner_pos = abs_uv - (1.0 - corner_radius);

0 commit comments

Comments
 (0)