-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adds post-settings-close behavior setting #1411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Allows users to configure Cap's behavior after closing the settings window. The default behavior is to reopen the main recording window, but users can now choose to do nothing. This setting is added to the general settings store and exposed in the settings UI.
WalkthroughThis PR introduces a new user-configurable setting Changes
Sequence DiagramsequenceDiagram
actor User
participant Settings as Settings Window
participant Backend as Tauri Backend
participant Storage as Settings Storage
User->>Settings: Closes settings window
Settings->>Backend: Trigger close event
Backend->>Storage: Read PostSettingsCloseBehaviour
alt should_open_main = true
Backend->>Backend: Show main/recording window
else
Backend->>Backend: Do nothing
end
Settings-->>User: Window closes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/desktop/src/routes/(window-chrome)/settings/general.tsx (1)
37-40: UI wiring for “After Closing Settings Window” matches backend types and preserves old defaultImporting
PostSettingsCloseBehaviour, extendingSelectSettingItem’s generic union, and adding the newSelectSettingIteminstance all look correct:
- The option values
"doNothing"/"openRecordingWindow"align with the TS union and the Rust enum’s camelCase serialization.value={settings.postSettingsCloseBehaviour ?? "openRecordingWindow"}keeps the previous default behavior for users without this field yet, matching the RustDefault.onChangeroutes throughhandleChange("postSettingsCloseBehaviour", value), so the setting is persisted in the same way as the other behavior flags.If you want the frontend defaults to be fully explicit, you could optionally add
postSettingsCloseBehaviour: "openRecordingWindow"tocreateDefaultGeneralSettings, but that’s not required for correctness given the current fallback logic.Also applies to: 359-365, 563-577
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/desktop/src-tauri/src/general_settings.rs(3 hunks)apps/desktop/src-tauri/src/lib.rs(3 hunks)apps/desktop/src/routes/(window-chrome)/settings/general.tsx(3 hunks)apps/desktop/src/utils/tauri.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/desktop/src-tauri/src/lib.rs (2)
apps/desktop/src/utils/tauri.ts (1)
PostSettingsCloseBehaviour(446-446)apps/desktop/src-tauri/src/general_settings.rs (1)
get(219-230)
apps/desktop/src/routes/(window-chrome)/settings/general.tsx (1)
apps/desktop/src/utils/tauri.ts (1)
PostSettingsCloseBehaviour(446-446)
⏰ 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). (1)
- GitHub Check: Clippy (aarch64-apple-darwin, macos-latest)
🔇 Additional comments (3)
apps/desktop/src/utils/tauri.ts (1)
407-407: PostSettingsCloseBehaviour TS bindings look correct and in sync with RustThe new
PostSettingsCloseBehaviourunion and optionalpostSettingsCloseBehaviourfield onGeneralSettingsStoreline up with the Rust enum (camelCase variants) and the settings UI usage; nothing further needed here, especially given this file is generated.Also applies to: 445-447
apps/desktop/src-tauri/src/lib.rs (1)
56-56: Settings close behavior correctly gated on new PostSettingsCloseBehaviour settingImporting
PostSettingsCloseBehaviourand using:
GeneralSettingsStore::get(&app).ok().flatten().unwrap_or_default()to read settings, andshould_open_mainbased onPostSettingsCloseBehaviour::OpenRecordingWindowkeeps the legacy default (“open recording window”) while letting “do nothing” short‑circuit the existing logic that re‑shows Main/Camera/TargetSelectOverlay and, on Windows, calls
reopen_main_windowwhen no editor is open. The error‑tolerantget+unwrap_or_defaultpath is also reasonable here, since failures fall back to the prior default behavior.One thing to double‑check from a UX perspective (not a correctness issue): with
DoNothingselected, TargetSelectOverlay and Camera windows will also no longer be shown when Settings closes because they’re behind the sameshould_open_maingate. If the intent was to only stop reopening the main recording window while still restoring overlays/camera, you might want a more specific condition there; otherwise this implementation matches the “do nothing after closing settings” semantics consistently.Also applies to: 2686-2695, 2696-2707, 2712-2713
apps/desktop/src-tauri/src/general_settings.rs (1)
34-40: PostSettingsCloseBehaviour enum and GeneralSettingsStore defaults are consistent and backward‑safeThe new
PostSettingsCloseBehaviourenum, its#[serde(rename_all = "camelCase")]serialization (doNothing/openRecordingWindow), and the#[serde(default)]field onGeneralSettingsStorewithDefaultset toOpenRecordingWindowtogether ensure:
- Existing configs deserialize without errors and continue to behave as before.
- New configs get the intended default while still allowing the “do nothing” option.
This wiring looks solid and consistent with how other behavior enums in this struct are handled.
Also applies to: 127-128, 173-201
Allows users to configure Cap's behavior after closing the settings window.
The default behavior is to reopen the main recording window, but users can now choose to do nothing.
This setting is added to the general settings store and exposed in the settings UI.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.