@@ -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()
}
}
@@ -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(),
)