Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Move workspace title into collaboration titlebar item render
Juliaed2f1ddd2d6d
diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rsindex a767e505656..d4f56c54f43 100644--- a/crates/collab_ui/src/collab_titlebar_item.rs+++ b/crates/collab_ui/src/collab_titlebar_item.rs@@ -47,6 +47,15 @@ impl View for CollabTitlebarItem {return Empty::new().boxed();};+ let project = workspace.read(cx).project().read(cx);+ let mut worktree_root_names = String::new();+ for (i, name) in project.worktree_root_names(cx).enumerate() {+ if i > 0 {+ worktree_root_names.push_str(", ");+ }+ worktree_root_names.push_str(name);+ }+let theme = cx.global::<Settings>().theme.clone();let mut container = Flex::row();@@ -67,7 +76,16 @@ impl View for CollabTitlebarItem {container.add_children(self.render_collaborators(&workspace, &theme, cx));container.add_children(self.render_current_user(&workspace, &theme, cx));container.add_children(self.render_connection_status(&workspace, cx));- container.boxed()++ Stack::new()+ .with_child(+ Label::new(worktree_root_names, theme.workspace.titlebar.title.clone())+ .aligned()+ .left()+ .boxed(),+ )+ .with_child(container.aligned().right().boxed())+ .boxed()}}diff --git a/crates/gpui/src/elements.rs b/crates/gpui/src/elements.rsindex 41a802feb37..b77d46536de 100644--- a/crates/gpui/src/elements.rs+++ b/crates/gpui/src/elements.rs@@ -363,6 +363,7 @@ impl<T: Element> AnyElement for Lifecycle<T> {value}}+_ => panic!("invalid element lifecycle state"),}}diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex d61fc3774c4..e6a89045d23 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -1837,15 +1837,6 @@ impl Workspace {}fn render_titlebar(&self, theme: &Theme, cx: &mut RenderContext<Self>) -> ElementBox {- let project = &self.project.read(cx);- let mut worktree_root_names = String::new();- for (i, name) in project.worktree_root_names(cx).enumerate() {- if i > 0 {- worktree_root_names.push_str(", ");- }- worktree_root_names.push_str(name);- }-// TODO: There should be a better system in place for this// (https://github.com/zed-industries/zed/issues/1290)let is_fullscreen = cx.window_is_fullscreen(cx.window_id());@@ -1862,16 +1853,10 @@ impl Workspace {MouseEventHandler::<TitleBar>::new(0, cx, |_, cx| {Container::new(Stack::new()- .with_child(- Label::new(worktree_root_names, theme.workspace.titlebar.title.clone())- .aligned()- .left()- .boxed(),- ).with_children(self.titlebar_item.as_ref()- .map(|item| ChildView::new(item, cx).aligned().right().boxed()),+ .map(|item| ChildView::new(item, cx).boxed()),).boxed(),)