Repository navigation
Enable custom cursors by default - #932
Conversation
WalkthroughRenames 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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 failureThe call to
general_settings .map(|s| s.custom_cursor_capture2) .unwrap_or_default()will yield
falsewhengeneral_settingsisNone(first run or load error), disabling the custom cursor even though we intend it to be on by default. We’ve verified:
default_true()returnstrue.#[serde(default = "default_true")]is applied tocustom_cursor_capture2.- No unintended references to
custom_cursor_captureremain 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_capture2still defaults totrue.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 differencesRe-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 initializationBoth this file and settings/experimental.tsx initialize a fallback GeneralSettingsStore with many of the same keys (including the new
customCursorCapture2). Consider extracting a shareddefaultGeneralSettings()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
GifQualityand pass it instead ofnull.apps/desktop/src-tauri/src/general_settings.rs (2)
116-119: Remove duplicate helper; reuse existing true_b().
default_true()duplicatestrue_b(). Prefer reusingtrue_bto 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_captureis 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.
📒 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: trueto 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 toggleSetting
customCursorCapture2: truein the fallback matches the intended default enablement.
62-64: Binding update looks correctThe toggle now targets
customCursorCapture2with 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 implementedI’ve verified in ExportDialog.tsx that:
- The format-change logic resets
settings.fpsto 15 when switching to GIF and to 30 when switching to MP4 (around lines 533–538 and 541–546).- The
onChangehandler also provides a fallback (option?.value ?? (format === "Gif" ? 10 : 30)).Since
settings.fpsis 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 thevalueprop 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.
GifExportSettingsnow includesquality: GifQuality | null. Your UI currently passesnull; 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.
There was a problem hiding this comment.
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 flagUsing a numeric suffix (
customCursorCapture2) invites future churn (3,4, …). Consider a semantically stable name likeuseCustomCursororcustomCursorEnabled, 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.
📒 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 correctThe 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.
Also fix Specta bindings exporter being commented out
Summary by CodeRabbit