Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: add keyboard events to RenderSegment, SegmentMedia, and export pipelines

Cursor Agent0f6dadbd5a60
diff --git a/apps/desktop/src-tauri/src/export.rs b/apps/desktop/src-tauri/src/export.rs
index 0eba1e546..3ba63d626 100644
--- a/apps/desktop/src-tauri/src/export.rs
+++ b/apps/desktop/src-tauri/src/export.rs
@@ -293,6 +293,7 @@ pub async fn generate_export_preview(
.iter()
.map(|s| RenderSegment {
cursor: s.cursor.clone(),
+ keyboard: s.keyboard.clone(),
decoders: s.decoders.clone(),
})
.collect();
diff --git a/crates/editor/src/editor_instance.rs b/crates/editor/src/editor_instance.rs
index 4879fadc2..e305921f1 100644
--- a/crates/editor/src/editor_instance.rs
+++ b/crates/editor/src/editor_instance.rs
@@ -581,6 +581,7 @@ pub struct SegmentMedia {
pub audio: Option<Arc<AudioData>>,
pub system_audio: Option<Arc<AudioData>>,
pub cursor: Arc<CursorEvents>,
+ pub keyboard: Arc<cap_project::KeyboardEvents>,
pub decoders: RecordingSegmentDecoders,
}
@@ -638,6 +639,7 @@ pub async fn create_segments(
audio,
system_audio: None,
cursor,
+ keyboard: Arc::new(Default::default()),
decoders,
}])
}
@@ -680,10 +682,13 @@ pub async fn create_segments(
.await
.map_err(|e| format!("MultipleSegments {i} / {e}"))?;
+ let keyboard = Arc::new(s.keyboard_events(recording_meta));
+
segments.push(SegmentMedia {
audio,
system_audio,
cursor,
+ keyboard,
decoders,
});
}
diff --git a/crates/export/src/gif.rs b/crates/export/src/gif.rs
index f25dc5253..54e38507a 100644
--- a/crates/export/src/gif.rs
+++ b/crates/export/src/gif.rs
@@ -122,6 +122,7 @@ impl GifExportSettings {
.iter()
.map(|s| RenderSegment {
cursor: s.cursor.clone(),
+ keyboard: s.keyboard.clone(),
decoders: s.decoders.clone(),
})
.collect(),
diff --git a/crates/export/src/mp4.rs b/crates/export/src/mp4.rs
index 672eb1915..d5b93c732 100644
--- a/crates/export/src/mp4.rs
+++ b/crates/export/src/mp4.rs
@@ -323,6 +323,7 @@ impl Mp4ExportSettings {
.iter()
.map(|s| RenderSegment {
cursor: s.cursor.clone(),
+ keyboard: s.keyboard.clone(),
decoders: s.decoders.clone(),
})
.collect(),
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index 5690609fe..c74753409 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -288,6 +288,7 @@ pub enum RenderingError {
pub struct RenderSegment {
pub cursor: Arc<CursorEvents>,
+ pub keyboard: Arc<cap_project::KeyboardEvents>,
pub decoders: RecordingSegmentDecoders,
}
diff --git a/crates/rendering/src/main.rs b/crates/rendering/src/main.rs
index efbbc39dd..e9a85d109 100644
--- a/crates/rendering/src/main.rs
+++ b/crates/rendering/src/main.rs
@@ -108,6 +108,7 @@ async fn main() -> Result<()> {
vec![RenderSegment {
cursor: Arc::new(Default::default()),
+ keyboard: Arc::new(Default::default()),
decoders,
}]
}
@@ -130,8 +131,9 @@ async fn main() -> Result<()> {
})?;
let cursor = Arc::new(s.cursor_events(&recording_meta));
+ let keyboard = Arc::new(s.keyboard_events(&recording_meta));
- segments.push(RenderSegment { cursor, decoders });
+ segments.push(RenderSegment { cursor, keyboard, decoders });
}
segments
}