-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Keyboard and captions tracks #1615
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
Open
richiemcilroy
wants to merge
27
commits into
main
Choose a base branch
from
cursor/keyboard-and-captions-tracks-8d45
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,027
−372
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1c0b0cb
feat: add keyboard event types and word grouping algorithm to cap-pro…
cursoragent 86640c2
feat: add keyboard field to MultipleSegment recording metadata
cursoragent 03019a1
feat: add caption/keyboard track segments, keyboard settings, and bac…
cursoragent 73b5d07
feat: record keyboard presses alongside cursor in studio recording
cursoragent 0f6dadb
feat: add keyboard events to RenderSegment, SegmentMedia, and export …
cursoragent 5b121ee
feat: add keyboard overlay rendering layer with fade and character bu…
cursoragent 17e9327
feat: add caption and keyboard track types to editor context and time…
cursoragent 78763c2
feat: add CaptionsTrack and KeyboardTrack timeline components with fu…
cursoragent c0f843b
feat: add KeyboardTab sidebar, per-segment caption overrides, and key…
cursoragent 5a43fb1
feat: add generate_keyboard_segments Tauri command for keyboard track…
cursoragent 83348f2
chore: format Rust code with cargo fmt
cursoragent 783d887
fix: adjust caption and keyboard segments when clip timescale changes
cursoragent 2388f2d
Merge branch 'main' into cursor/keyboard-and-captions-tracks-8d45
richiemcilroy b59adc8
fix(recording): update Meta keycode to LMeta
richiemcilroy 5d85c7a
feat(project): add keyboard path fallback resolution for segments
richiemcilroy 6349804
feat(project): add keyboard and caption segment fields to structs
richiemcilroy 9dedbbf
feat(rendering): add recording_time field to ProjectUniforms
richiemcilroy 6f5a42c
refactor(rendering): simplify caption layer to use timeline segments
richiemcilroy d59897d
refactor(rendering): simplify keyboard layer fade with per-segment ov…
richiemcilroy 13ea9d5
chore: update auto-generated tauri bindings
richiemcilroy 41b04c4
chore: update auto-generated icon imports
richiemcilroy d27b706
feat(editor): add badge prop to Field component
richiemcilroy 2f78e95
feat(editor): migrate CaptionsTab to timeline-based caption segments
richiemcilroy 72192cb
feat(editor): add keyboard segment generation and redesign settings UI
richiemcilroy c9cd085
feat(editor): add keyboard segment selection and config panel
richiemcilroy 315cafe
style(editor): update caption track icon and empty state text
richiemcilroy 572802f
style(editor): update keyboard track segment colors to gray
richiemcilroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1971,6 +1971,51 @@ async fn generate_zoom_segments_from_clicks( | |||||||||||||||||||||||||||||||||||
| Ok(zoom_segments) | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #[tauri::command] | ||||||||||||||||||||||||||||||||||||
| #[specta::specta] | ||||||||||||||||||||||||||||||||||||
| #[instrument(skip(editor_instance))] | ||||||||||||||||||||||||||||||||||||
| async fn generate_keyboard_segments( | ||||||||||||||||||||||||||||||||||||
| editor_instance: WindowEditorInstance, | ||||||||||||||||||||||||||||||||||||
| grouping_threshold_ms: f64, | ||||||||||||||||||||||||||||||||||||
| linger_duration_ms: f64, | ||||||||||||||||||||||||||||||||||||
| show_modifiers: bool, | ||||||||||||||||||||||||||||||||||||
| show_special_keys: bool, | ||||||||||||||||||||||||||||||||||||
| ) -> Result<Vec<cap_project::KeyboardTrackSegment>, String> { | ||||||||||||||||||||||||||||||||||||
| let meta = editor_instance.meta(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let RecordingMetaInner::Studio(studio_meta) = &meta.inner else { | ||||||||||||||||||||||||||||||||||||
| return Ok(vec![]); | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let segments = match studio_meta.as_ref() { | ||||||||||||||||||||||||||||||||||||
| StudioRecordingMeta::MultipleSegments { inner, .. } => &inner.segments, | ||||||||||||||||||||||||||||||||||||
| _ => return Ok(vec![]), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let mut all_events = cap_project::KeyboardEvents { presses: vec![] }; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| for segment in segments { | ||||||||||||||||||||||||||||||||||||
| let events = segment.keyboard_events(&meta); | ||||||||||||||||||||||||||||||||||||
| all_events.presses.extend(events.presses); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| all_events.presses.sort_by(|a, b| { | ||||||||||||||||||||||||||||||||||||
| a.time_ms | ||||||||||||||||||||||||||||||||||||
| .partial_cmp(&b.time_ms) | ||||||||||||||||||||||||||||||||||||
| .unwrap_or(std::cmp::Ordering::Equal) | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let grouped = cap_project::group_key_events( | ||||||||||||||||||||||||||||||||||||
| &all_events, | ||||||||||||||||||||||||||||||||||||
| grouping_threshold_ms, | ||||||||||||||||||||||||||||||||||||
| linger_duration_ms, | ||||||||||||||||||||||||||||||||||||
| show_modifiers, | ||||||||||||||||||||||||||||||||||||
| show_special_keys, | ||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+2008
to
+2014
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor robustness: if these come from the UI as floats, clamping to non-negative avoids
Suggested change
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Ok(grouped) | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #[tauri::command] | ||||||||||||||||||||||||||||||||||||
| #[specta::specta] | ||||||||||||||||||||||||||||||||||||
| #[instrument] | ||||||||||||||||||||||||||||||||||||
|
|
@@ -2960,6 +3005,7 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) { | |||||||||||||||||||||||||||||||||||
| set_project_config, | ||||||||||||||||||||||||||||||||||||
| update_project_config_in_memory, | ||||||||||||||||||||||||||||||||||||
| generate_zoom_segments_from_clicks, | ||||||||||||||||||||||||||||||||||||
| generate_keyboard_segments, | ||||||||||||||||||||||||||||||||||||
| permissions::open_permission_settings, | ||||||||||||||||||||||||||||||||||||
| permissions::do_permissions_check, | ||||||||||||||||||||||||||||||||||||
| permissions::request_permission, | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
partial_cmp+unwrap_or(Equal)can hide NaNs and makes ordering less explicit. Since this isf64,total_cmpis a nice drop-in here.