Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test(gpui): extend editor interaction preview drivers

Richie McIlroy97e4d2762590
diff --git a/apps/desktop-gpui/src/app_windows.rs b/apps/desktop-gpui/src/app_windows.rs
index ff49ca754..a65d1b11c 100644
--- a/apps/desktop-gpui/src/app_windows.rs
+++ b/apps/desktop-gpui/src/app_windows.rs
@@ -5244,6 +5244,23 @@ fn load_editor_project_candidate(
}
async fn drive_auto_export(handle: WindowHandle<EditorWindow>, cx: &mut gpui::AsyncApp) {
+ if let Ok(page) = std::env::var("CAP_GPUI_AUTO_EXPORT_PAGE") {
+ cx.background_executor()
+ .timer(std::time::Duration::from_millis(300))
+ .await;
+ let _ = handle.update(cx, |view, window, cx| {
+ view.open_export(window, cx);
+ if let Some(export) = view.export.as_mut() {
+ let flags: Vec<&str> = page.split(',').collect();
+ export.advanced_open = flags.contains(&"advanced");
+ if flags.contains(&"link") {
+ export.destination = crate::editor_export::ExportDestination::Link;
+ }
+ }
+ cx.notify();
+ });
+ return;
+ }
let Some(path) = std::env::var_os("CAP_GPUI_AUTO_EXPORT").map(PathBuf::from) else {
return;
};
@@ -5364,8 +5381,9 @@ fn load_editor_waveforms(
}
/// `CAP_GPUI_AUTO_SIDEBAR=<tab>[:<scroll>]` selects a config-sidebar tab and
-/// optionally scrolls its body, and `CAP_GPUI_AUTO_SELECT=<track>:<i>[,<i>]`
-/// selects timeline segments so their panel opens.
+/// optionally scrolls its body, `CAP_GPUI_AUTO_CAMERA3D=add[:<time>]|auto`
+/// makes a 3D shot, and `CAP_GPUI_AUTO_SELECT=<track>:<i>[,<i>]` selects
+/// timeline segments so their panel opens.
///
/// They exist for the same reason as every other `CAP_GPUI_AUTO_*` hook, plus
/// one specific to this pane: **a synthetic wheel does not scroll the sidebar's
@@ -5378,7 +5396,17 @@ async fn drive_auto_sidebar(handle: WindowHandle<EditorWindow>, cx: &mut gpui::A
let select = std::env::var("CAP_GPUI_AUTO_SELECT").ok();
let canvas = std::env::var("CAP_GPUI_AUTO_CANVAS").ok();
let crop = std::env::var("CAP_GPUI_AUTO_CROP").ok();
- if tab.is_none() && select.is_none() && canvas.is_none() && crop.is_none() {
+ let clip_menu = std::env::var("CAP_GPUI_AUTO_CLIP_MENU").ok();
+ let camera3d = std::env::var("CAP_GPUI_AUTO_CAMERA3D").ok();
+ let add_track = std::env::var("CAP_GPUI_AUTO_ADD_TRACK").ok();
+ if tab.is_none()
+ && select.is_none()
+ && canvas.is_none()
+ && crop.is_none()
+ && clip_menu.is_none()
+ && camera3d.is_none()
+ && add_track.is_none()
+ {
return;
}
cx.background_executor()
@@ -5397,6 +5425,15 @@ async fn drive_auto_sidebar(handle: WindowHandle<EditorWindow>, cx: &mut gpui::A
.ok();
}
+ // `CAP_GPUI_AUTO_CAMERA3D=add[:<time>]|auto`: make a 3D shot the way the
+ // lane's own chips make one. Before the selection hook, so a probe can
+ // create a shot and then photograph its panel.
+ if let Some(spec) = camera3d {
+ handle
+ .update(cx, |view, window, cx| view.auto_camera3d(&spec, window, cx))
+ .ok();
+ }
+
if let Some(spec) = select {
handle
.update(cx, |view, _window, cx| view.auto_select_segments(&spec, cx))
@@ -5421,6 +5458,28 @@ async fn drive_auto_sidebar(handle: WindowHandle<EditorWindow>, cx: &mut gpui::A
.update(cx, |view, window, cx| view.auto_crop(&spec, window, cx))
.ok();
}
+
+ // `CAP_GPUI_AUTO_CLIP_MENU=<index>[:split]`: open clip `<index>`'s settings
+ // menu the way a right-click on it does, optionally splitting the first
+ // clip at 40% first so the merge rows have a neighbour to act on.
+ if let Some(spec) = clip_menu {
+ handle
+ .update(cx, |view, window, cx| {
+ view.auto_clip_menu(&spec, window, cx)
+ })
+ .ok();
+ }
+
+ // `CAP_GPUI_AUTO_ADD_TRACK=1` opens the add-track tray;
+ // `CAP_GPUI_AUTO_ADD_TRACK=<text|mask|style|audio|...>` opens it and picks
+ // that tile, then treats the player as hovered so its overlay draws.
+ if let Some(spec) = add_track {
+ handle
+ .update(cx, |view, window, cx| {
+ view.auto_add_track(&spec, window, cx)
+ })
+ .ok();
+ }
}
/// `CAP_GPUI_AUTO_PLAYBACK=<seconds>` presses play once the project is up and