Skip to content

Enable custom cursors by default - #932

Merged
Brendonovich merged 4 commits into
mainfrom
enable-svg-cursor-by-default
Aug 25, 2025
Merged

Brendonovich merged 4 commits into
mainfrom
enable-svg-cursor-by-default

Conversation

@oscartbeaumont

@oscartbeaumont oscartbeaumont commented Aug 22, 2025 •

Copy link
Copy Markdown
Contributor

Also fix Specta bindings exporter being commented out

Summary by CodeRabbit

  • Refactor
    • Renamed the “Custom cursor capture in Studio Mode” setting under Experimental and enabled it by default for new configurations.
    • Updated related UI bindings so the Experimental toggle and editor sidebar correctly reflect and honor the new setting.
    • Streamlined export option handling: MP4 exports use compression, while GIF exports use a quality-null path, improving clarity and reliability without changing the export flow.

@coderabbitai

coderabbitai Bot commented Aug 22, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Renames and defaults a settings field to custom_cursor_capture2 across Rust and TypeScript, setting its default to true and updating UI bindings. Adjusts export payload construction to branch by format (Mp4 vs Gif) without type assertions. No broader structural changes.

Changes

Cohort / File(s) Summary
Settings storage (Rust)
apps/desktop/src-tauri/src/general_settings.rs
Serde attribute change for custom_cursor_capture: default now via helper fn default_true() and renamed to "custom_cursor_capture2"; Default impl sets true; added private default_true().
Settings API and UI bindings (TS/TSX)
apps/desktop/src/utils/tauri.ts, apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx, apps/desktop/src/routes/(window-chrome)/settings/general.tsx
GeneralSettingsStore field renamed/exposed as customCursorCapture2; UI toggles and default initialization updated to use the new field with default true.
Editor: Zoom segment config
apps/desktop/src/routes/editor/ConfigSidebar.tsx
Disabled condition for Auto tab now checks generalSettings.data?.customCursorCapture2.
Export flow
apps/desktop/src/routes/editor/ExportDialog.tsx
Export payload now branches: Mp4 uses compression; Gif uses quality: null. Removes prior type assertion; common fields unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant UI as ExportDialog UI
  participant Exporter as Export Service

  UI->>UI: User selects format (Mp4 or Gif)
  alt Mp4
    UI->>Exporter: exportVideo({ format: "Mp4", fps, resolution_base, compression })
    note right of Exporter: Uses compression
  else Gif
    UI->>Exporter: exportVideo({ format: "Gif", fps, resolution_base, quality: null })
    note right of Exporter: quality explicitly null
  end
  Exporter-->>UI: onProgress / completion
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

codex

Poem

A twitch of whiskers, flip of a bit,
I toggled a flag—now true by default, lit.
Exports hop left for Gif, right for Mp4’s track,
With payloads neat, no casts to pack.
Thump-thump! said the bunny, tail a blur—
Renames done clean, settings now purr.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enable-svg-cursor-by-default

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@oscartbeaumont oscartbeaumont changed the title Enable SVG Cursors by default Enable custom cursors by default Aug 22, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/desktop/src-tauri/src/recording.rs (1)

391-399: Enable custom cursor capture by default for first‐run and on settings‐load failure

The call to

general_settings
    .map(|s| s.custom_cursor_capture2)
    .unwrap_or_default()

will yield false when general_settings is None (first run or load error), disabling the custom cursor even though we intend it to be on by default. We’ve verified:

  • default_true() returns true.
  • #[serde(default = "default_true")] is applied to custom_cursor_capture2.
  • No unintended references to custom_cursor_capture remain in the apps/desktop code.

Please update the invocation in apps/desktop/src-tauri/src/recording.rs (around line 397) as follows:

-    general_settings
-        .map(|s| s.custom_cursor_capture2)
-        .unwrap_or_default(),
+    general_settings
+        .map(|s| s.custom_cursor_capture2)
+        .unwrap_or(true),

This ensures that when no settings are present (or they fail to load), custom_cursor_capture2 still defaults to true.

apps/desktop/src/routes/editor/ExportDialog.tsx (1)

532-539: Bug: GIF FPS fallback condition never triggers (wrong predicate).

The check uses every(v => v.value === settings.fps), which can never be true unless all GIF options share one value. The intent seems to be “if current fps is not in GIF options, reset to 15”.

Apply this diff to fix the predicate:

-                      if (
-                        option.value === "Gif" &&
-                        GIF_FPS_OPTIONS.every(
-                          (v) => v.value === settings.fps,
-                        )
-                      )
-                        newSettings.fps = 15;
+                      if (
+                        option.value === "Gif" &&
+                        GIF_FPS_OPTIONS.every(
+                          (v) => v.value !== settings.fps,
+                        )
+                      ) {
+                        newSettings.fps = 15;
+                      }
🧹 Nitpick comments (6)
apps/desktop/src-tauri/src/lib.rs (1)

1995-2001: Make TS bindings export path robust to working directory differences

Re-enabling the Specta Typescript export is good. However, the relative path "../src/utils/tauri.ts" depends on the process working directory at runtime. In some dev/CI invocations, the CWD may not be apps/desktop/src-tauri, causing the export to fail silently or create the file in the wrong place.

Prefer an absolute path based on the crate’s manifest dir to make this deterministic.

Apply this diff:

-    specta_builder
-        .export(
-            specta_typescript::Typescript::default(),
-            "../src/utils/tauri.ts",
-        )
+    specta_builder
+        .export(
+            specta_typescript::Typescript::default(),
+            concat!(env!("CARGO_MANIFEST_DIR"), "/../src/utils/tauri.ts"),
+        )
         .expect("Failed to export typescript bindings");
apps/desktop/src/routes/editor/ConfigSidebar.tsx (1)

1993-1996: Avoid disabling “Auto” zoom mode while settings are still loading

disabled={!generalSettings.data?.customCursorCapture2} disables the tab when data is undefined (before the query resolves), which can unnecessarily hide the feature even though the default is intended to be ON.

Disable only when the flag is explicitly false.

- disabled={!generalSettings.data?.customCursorCapture2}
+ disabled={generalSettings.data?.customCursorCapture2 === false}
apps/desktop/src/routes/(window-chrome)/settings/general.tsx (1)

110-122: De-duplicate default GeneralSettings initialization

Both this file and settings/experimental.tsx initialize a fallback GeneralSettingsStore with many of the same keys (including the new customCursorCapture2). Consider extracting a shared defaultGeneralSettings() factory to avoid drift.

apps/desktop/src/routes/editor/ExportDialog.tsx (1)

626-649: Hide or repurpose “Compression” for GIF to avoid UX confusion.

Compression is ignored in the GIF payload; showing it for GIF can mislead users. Consider hiding this block when settings.format === "Gif" or replacing it with a “Quality” selector.

Example tweak (conditional render):

- {/* Compression */}
- <div class="p-4 rounded-xl bg-gray-2">
+ {/* Compression (Mp4 only) */}
+ <Show when={settings.format === "Mp4"}>
+ <div class="p-4 rounded-xl bg-gray-2">
    ...
- </div>
+ </div>
+ </Show>

If/when you add GIF quality controls later, map to GifQuality and pass it instead of null.

apps/desktop/src-tauri/src/general_settings.rs (2)

116-119: Remove duplicate helper; reuse existing true_b().

default_true() duplicates true_b(). Prefer reusing true_b to reduce surface area.

Apply this diff:

-fn default_true() -> bool {
-    true
-}

And update the serde attribute (Line 78) accordingly if you keep a “true” serde default:

-    #[serde(default = "default_true")]
+    #[serde(default = "true_b")]

212-227: Consider a one-time migration for prior user preference.

Renaming the field means any explicit user choice for custom_cursor_capture is ignored. If you don’t want to surprise users who opted out, migrate on init: if old key exists and new key is absent, carry the value across.

Sketch:

 pub fn init(app: &AppHandle) {
   println!("Initializing GeneralSettingsStore");
 
-  let store = match GeneralSettingsStore::get(app) {
+  let mut store = match GeneralSettingsStore::get(app) {
     Ok(Some(store)) => store,
     Ok(None) => GeneralSettingsStore::default(),
     Err(e) => {
       error!("Failed to deserialize general settings store: {}", e);
       GeneralSettingsStore::default()
     }
   };
+
+  // One-time migration: carry user preference from old key if present and new is unset.
+  if let Ok(s) = app.store("store") {
+      if let Some(old) = s.get("general_settings").ok().and_then(|v| v.get("customCursorCapture")).and_then(|v| v.as_bool()) {
+          if store.custom_cursor_capture2 == false && old == false {
+              store.custom_cursor_capture2 = false;
+          }
+      }
+  }
 
   store.save(app).unwrap();
   println!("GeneralSettingsState managed");
 }

This preserves an explicit “off” choice without broadening scope.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cf48ffa and baee9a0.

📒 Files selected for processing (8)
  • apps/desktop/src-tauri/src/general_settings.rs (3 hunks)
  • apps/desktop/src-tauri/src/lib.rs (1 hunks)
  • apps/desktop/src-tauri/src/recording.rs (1 hunks)
  • apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx (2 hunks)
  • apps/desktop/src/routes/(window-chrome)/settings/general.tsx (1 hunks)
  • apps/desktop/src/routes/editor/ConfigSidebar.tsx (1 hunks)
  • apps/desktop/src/routes/editor/ExportDialog.tsx (1 hunks)
  • apps/desktop/src/utils/tauri.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Clippy
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (8)
apps/desktop/src/routes/(window-chrome)/settings/general.tsx (1)

120-121: Default aligns with “enable custom cursors by default”

Adding customCursorCapture2: true to the default store matches the PR objective. No issues.

apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx (2)

29-29: Good: default true for experimental toggle

Setting customCursorCapture2: true in the fallback matches the intended default enablement.


62-64: Binding update looks correct

The toggle now targets customCursorCapture2 with a boolean cast. Matches the backend rename.

apps/desktop/src/routes/editor/ExportDialog.tsx (2)

135-154: Format-aware export payload looks correct and aligns with new Tauri types.

The conditional payload construction for Mp4 vs Gif matches ExportSettings, using compression for Mp4 and quality: null for Gif. Good separation and no API shape mismatch risks here.


573-580: FPS fallback and format-switch guard are already implemented

I’ve verified in ExportDialog.tsx that:

  • The format-change logic resets settings.fps to 15 when switching to GIF and to 30 when switching to MP4 (around lines 533–538 and 541–546).
  • The onChange handler also provides a fallback (option?.value ?? (format === "Gif" ? 10 : 30)).

Since settings.fps is always initialized to a valid value and updated only via these guarded paths, the .find(...) will never return undefined under normal usage. No additional guard on the value prop is required.

apps/desktop/src/utils/tauri.ts (3)

545-545: TS API rename to customCursorCapture2 is consistent with Rust.

Matches the store field rename and prevents stale bindings. No issues spotted.


553-567: New GIF settings/types look good; null quality is a sane default.

GifExportSettings now includes quality: GifQuality | null. Your UI currently passes null; backend can use defaults. When you add UI, wire it directly to this type.


585-587: LayoutMode/LayoutSegment extraction improves type reuse.

The dedicated types reduce duplication and improve clarity across the timeline config. Looks good.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/desktop/src/utils/tauri.ts (1)

551-551: Name with numeric suffix is brittle; prefer a stable, descriptive flag

Using a numeric suffix (customCursorCapture2) invites future churn (3, 4, …). Consider a semantically stable name like useCustomCursor or customCursorEnabled, and deprecate the old key via aliasing as suggested above.

If you decide to adopt a stable name, the generated binding in this file would reflect:

-  customCursorCapture2?: boolean;
+  customCursorEnabled?: boolean;

Note: make this change in the Rust schema first (with #[serde(rename = "custom_cursor_enabled", alias = "custom_cursor_capture")]), then regenerate specta bindings.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between baee9a0 and 961e964.

📒 Files selected for processing (3)
  • apps/desktop/src-tauri/src/general_settings.rs (3 hunks)
  • apps/desktop/src/routes/editor/ExportDialog.tsx (1 hunks)
  • apps/desktop/src/utils/tauri.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src-tauri/src/general_settings.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/desktop/src/utils/tauri.ts (1)

551-551: Bindings update looks correct

The generated binding reflects the new settings key and aligns with enabling custom cursors by default (assuming backend default = true). No issues with the generation itself.

Comment thread apps/desktop/src/utils/tauri.ts Resolved
@Brendonovich
Brendonovich merged commit 60e76c1 into main Aug 25, 2025
@oscartbeaumont
oscartbeaumont deleted the enable-svg-cursor-by-default branch August 25, 2025 15:24

This branch was successfully deployed

1 active deployment
Preview — 961e9646 Deployed Aug 22, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants