Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Apply bounds to all windows when using start-local-collaboration script
Max Brunsfeld3d1ba1b36365
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 95d0bf65385..a429a30a396 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -765,25 +765,21 @@ impl Workspace {DB.next_id().await.unwrap_or(0)};- let window_bounds_override =- ZED_WINDOW_POSITION- .zip(*ZED_WINDOW_SIZE)- .map(|(position, size)| {- WindowBounds::Fixed(RectF::new(- cx.platform().screens()[0].bounds().origin() + position,- size,- ))- });-- let build_workspace = |cx: &mut ViewContext<Workspace>| {- Workspace::new(workspace_id, project_handle.clone(), app_state.clone(), cx)- };-let workspace = requesting_window_id.and_then(|window_id| {- cx.update(|cx| cx.replace_root_view(window_id, |cx| build_workspace(cx)))+ cx.update(|cx| {+ cx.replace_root_view(window_id, |cx| {+ Workspace::new(+ workspace_id,+ project_handle.clone(),+ app_state.clone(),+ cx,+ )+ })+ })}).unwrap_or_else(|| {+ let window_bounds_override = window_bounds_env_override(&cx);let (bounds, display) = if let Some(bounds) = window_bounds_override {(Some(bounds), None)} else {@@ -819,7 +815,14 @@ impl Workspace {// Use the serialized workspace to construct the new windowcx.add_window((app_state.build_window_options)(bounds, display, cx.platform().as_ref()),- |cx| build_workspace(cx),+ |cx| {+ Workspace::new(+ workspace_id,+ project_handle.clone(),+ app_state.clone(),+ cx,+ )+ },).1});@@ -3110,6 +3113,17 @@ impl Workspace {}}+fn window_bounds_env_override(cx: &AsyncAppContext) -> Option<WindowBounds> {+ ZED_WINDOW_POSITION+ .zip(*ZED_WINDOW_SIZE)+ .map(|(position, size)| {+ WindowBounds::Fixed(RectF::new(+ cx.platform().screens()[0].bounds().origin() + position,+ size,+ ))+ })+}+async fn open_items(serialized_workspace: Option<SerializedWorkspace>,workspace: &WeakViewHandle<Workspace>,@@ -3642,8 +3656,13 @@ pub fn join_remote_project(}).await?;+ let window_bounds_override = window_bounds_env_override(&cx);let (_, workspace) = cx.add_window(- (app_state.build_window_options)(None, None, cx.platform().as_ref()),+ (app_state.build_window_options)(+ window_bounds_override,+ None,+ cx.platform().as_ref(),+ ),|cx| Workspace::new(0, project, app_state.clone(), cx),);(app_state.initialize_workspace)(