(feat) Customize default project name, update project file names from UUID to pretty name
This PR adds a new recording setting: Default project name which allows for customizing the default project and file name using a custom template with placeholders. There are several place holders for different info about a recording, and a custom date placeholder which accepts a moment format. Renaming the project through the editor still has the same behavior, only the pretty name changes, not the actual name of the file.
There's a new module update_project_names which updates the name of all previous project files to use their pretty name instead. Once done, it adds uuid_projects_migrated to the data store.
Other changes:
- Added a little blur to the collapsible animation
- Fixed an issue with the reset button on the ExcludedWindowsCard in General Settings where the text would spill out on a certain viewport size.
Note: I'm not sure how to format the Cargo.toml file, I don't even know why it changed.
Summary by CodeRabbit
-
New Features
- Customizable default project name template in General Settings with live preview, save/reset.
- Frontend can format project names used for recording names and UI labels.
- One-time migration renames legacy UUID project folders to readable, sanitized names.
-
Improvements
- Automatic filename collision avoidance to ensure unique recording names.
- Collapsible UI animations now include a subtle blur for smoother transitions.
-
Tweaks
- Clearer screen-capture target labels (Display / Window / Area).
Walkthrough
Adds project-name templating (moment-style → chrono), a TAURI command to format names, persisted default template setting and UI, a one-time migration renaming UUID project folders to sanitized unique names, utilities for token conversion and filename uniqueness (Aho‑Corasick), and small manifest/UI/type tweaks.
Changes
| Cohort / File(s) | Summary |
|---|---|
Workspace & root manifest Cargo.toml |
Reflowed workspace.members to a multiline array; added aho-corasick = "1.1.4" to workspace dependencies and enabled chrono feature for specta. |
Desktop app manifest apps/desktop/src-tauri/Cargo.toml |
Added dependencies: regex = "1.10.4", sanitize-filename = "0.6.0", and aho-corasick.workspace = true; minor formatting tweaks. |
Settings storage apps/desktop/src-tauri/src/general_settings.rs |
Added default_project_name_template: Option<String> with serde default and Default impl set to None. |
TAURI wiring & startup apps/desktop/src-tauri/src/lib.rs |
New format_project_name TAURI command; registered in commands and update_project_names::migrate_if_needed(&app) invoked during setup. |
Project name formatting & recording flow apps/desktop/src-tauri/src/recording.rs |
Added format_project_name function and integrated it to derive sanitized project_name (used for filenames, recording dirs, metadata, and instant upload pre-creation); uses Aho‑Corasick and chrono-format conversion. |
Migration module apps/desktop/src-tauri/src/update_project_names.rs |
New one-time migration: detect UUID-named projects (fast_is_project_filename_uuid), compute sanitized pretty names, ensure unique filenames, rename directories with concurrency control, logging, aggregation, and unit tests. |
Frontend UI & bindings apps/desktop/src/routes/(window-chrome)/settings/general.tsx, apps/desktop/src/utils/tauri.ts |
Added DefaultProjectNameCard UI with live preview/reset/save; added formatProjectName frontend TAURI binding and `defaultProjectNameTemplate?: string |
Utilities crate crates/utils/Cargo.toml, crates/utils/src/lib.rs |
Enabled aho-corasick workspace usage; added ensure_unique_filename / ensure_unique_filename_with_attempts and moment_format_to_chrono (Aho‑Corasick automaton) with tests. |
Recording helper crates/recording/src/sources/screen_capture/mod.rs |
Added pub fn kind_str(&self) -> &str on ScreenCaptureTarget. |
UI config & types packages/ui-solid/tailwind.config.js, packages/ui-solid/src/auto-imports.d.ts |
Added blur filter to collapsible keyframes; added IconCapAuto global declaration in auto-imports.d.ts. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Frontend as Frontend (Settings / Recorder UI)
participant Tauri as Tauri App
participant Recording as Recording Module
participant Utils as Utils crate
User->>Frontend: Edit default template / request preview
Frontend->>Tauri: call formatProjectName(template, target, kind, mode, datetime)
Tauri->>Recording: format_project_name(...)
Recording->>Utils: moment_format_to_chrono(format)
Utils-->>Recording: chrono_format
Recording->>Recording: placeholder substitutions (Aho‑Corasick, regex)
Recording-->>Tauri: formatted project name
Tauri-->>Frontend: preview/display result
Note over Tauri,Recording: App startup one-time migration
Tauri->>Recording: migrate_if_needed()
Recording->>Recording: enumerate UUID-named project dirs
Recording->>Utils: ensure_unique_filename(pretty_name, parent_dir)
Utils-->>Recording: unique filename
Recording->>Recording: rename directory (or skip/fail)
Recording-->>Tauri: migration result
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~55 minutes
- Files needing extra attention:
apps/desktop/src-tauri/src/recording.rs— template parsing, Aho‑Corasick usage, regex replacements, and propagation into recording lifecycle.apps/desktop/src-tauri/src/update_project_names.rs— filesystem renames, concurrency, error aggregation, and persistent migration flag handling.crates/utils/src/lib.rs— Aho‑Corasick automaton setup, token→chrono mappings, and returned Cow borrow/ownership behavior.
Possibly related PRs
- CapSoftware/Cap#1025 — Overlaps
apps/desktop/src-tauri/src/recording.rsedits touching recording startup/metadata. - CapSoftware/Cap#1092 — Touches desktop recording flows and filename/unique-name logic used by migration/recording.
- CapSoftware/Cap#905 — Modifies recording/configuration areas and interacts with project-name/layout initialization.
Suggested reviewers
- oscartbeaumont
- Brendonovich
Poem
🐇 I nibble tokens, stitch time into name,
Aho hops quick, replacing each plain,
UUID shells shelved for names that rhyme,
Sanitized and unique — tidy every time,
The rabbit saves defaults and hums a chime.
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly and concisely describes the main feature: customization of default project names and migration from UUID to pretty names. It directly reflects the primary changes in the changeset. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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 @coderabbitai help to get the list of available commands and usage tips.