From 9d6a7a83a067493685a96cb021d71ec2fc78e411 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 26 Apr 2022 13:21:58 +0200 Subject: [PATCH] Show worktree root names in titlebar and align them left --- crates/workspace/src/workspace.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index b74941e47038b7b15c8852289a7be272927e7ca8..19043ec14562bccefde92dd67ef90fa20da9227a 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1475,15 +1475,27 @@ impl Workspace { } fn render_titlebar(&self, theme: &Theme, cx: &mut RenderContext) -> ElementBox { + let mut worktree_root_names = String::new(); + { + let mut worktrees = self.project.read(cx).visible_worktrees(cx).peekable(); + while let Some(worktree) = worktrees.next() { + worktree_root_names.push_str(worktree.read(cx).root_name()); + if worktrees.peek().is_some() { + worktree_root_names.push_str(", "); + } + } + } + ConstrainedBox::new( Container::new( Stack::new() .with_child( - Align::new( - Label::new("zed".into(), theme.workspace.titlebar.title.clone()) - .boxed(), - ) - .boxed(), + Label::new(worktree_root_names, theme.workspace.titlebar.title.clone()) + .aligned() + .left() + .contained() + .with_margin_left(80.) + .boxed(), ) .with_child( Align::new(