1mod application_menu;
2mod collab;
3mod onboarding_banner;
4pub mod platform_title_bar;
5mod platforms;
6mod system_window_tabs;
7mod title_bar_settings;
8
9#[cfg(feature = "stories")]
10mod stories;
11
12use crate::{
13 application_menu::{ApplicationMenu, show_menus},
14 platform_title_bar::PlatformTitleBar,
15 system_window_tabs::SystemWindowTabs,
16};
17
18#[cfg(not(target_os = "macos"))]
19use crate::application_menu::{
20 ActivateDirection, ActivateMenuLeft, ActivateMenuRight, OpenApplicationMenu,
21};
22
23use auto_update::AutoUpdateStatus;
24use call::ActiveCall;
25use client::{Client, UserStore, zed_urls};
26use cloud_llm_client::{Plan, PlanV1, PlanV2};
27use gpui::{
28 Action, AnyElement, App, Context, Corner, Element, Entity, Focusable, InteractiveElement,
29 IntoElement, MouseButton, ParentElement, Render, StatefulInteractiveElement, Styled,
30 Subscription, WeakEntity, Window, actions, div,
31};
32use onboarding_banner::OnboardingBanner;
33use project::{Project, WorktreeSettings};
34use remote::RemoteConnectionOptions;
35use settings::{Settings, SettingsLocation};
36use std::{path::Path, sync::Arc};
37use theme::ActiveTheme;
38use title_bar_settings::TitleBarSettings;
39use ui::{
40 Avatar, Button, ButtonLike, ButtonStyle, Chip, ContextMenu, Icon, IconName, IconSize,
41 IconWithIndicator, Indicator, PopoverMenu, PopoverMenuHandle, Tooltip, h_flex, prelude::*,
42};
43use util::ResultExt;
44use workspace::{Workspace, notifications::NotifyResultExt};
45use zed_actions::{OpenRecent, OpenRemote};
46
47pub use onboarding_banner::restore_banner;
48
49#[cfg(feature = "stories")]
50pub use stories::*;
51
52const MAX_PROJECT_NAME_LENGTH: usize = 40;
53const MAX_BRANCH_NAME_LENGTH: usize = 40;
54const MAX_SHORT_SHA_LENGTH: usize = 8;
55
56actions!(
57 collab,
58 [
59 /// Toggles the user menu dropdown.
60 ToggleUserMenu,
61 /// Toggles the project menu dropdown.
62 ToggleProjectMenu,
63 /// Switches to a different git branch.
64 SwitchBranch
65 ]
66);
67
68pub fn init(cx: &mut App) {
69 TitleBarSettings::register(cx);
70 SystemWindowTabs::init(cx);
71
72 cx.observe_new(|workspace: &mut Workspace, window, cx| {
73 let Some(window) = window else {
74 return;
75 };
76 let item = cx.new(|cx| TitleBar::new("title-bar", workspace, window, cx));
77 workspace.set_titlebar_item(item.into(), window, cx);
78
79 #[cfg(not(target_os = "macos"))]
80 workspace.register_action(|workspace, action: &OpenApplicationMenu, window, cx| {
81 if let Some(titlebar) = workspace
82 .titlebar_item()
83 .and_then(|item| item.downcast::<TitleBar>().ok())
84 {
85 titlebar.update(cx, |titlebar, cx| {
86 if let Some(ref menu) = titlebar.application_menu {
87 menu.update(cx, |menu, cx| menu.open_menu(action, window, cx));
88 }
89 });
90 }
91 });
92
93 #[cfg(not(target_os = "macos"))]
94 workspace.register_action(|workspace, _: &ActivateMenuRight, window, cx| {
95 if let Some(titlebar) = workspace
96 .titlebar_item()
97 .and_then(|item| item.downcast::<TitleBar>().ok())
98 {
99 titlebar.update(cx, |titlebar, cx| {
100 if let Some(ref menu) = titlebar.application_menu {
101 menu.update(cx, |menu, cx| {
102 menu.navigate_menus_in_direction(ActivateDirection::Right, window, cx)
103 });
104 }
105 });
106 }
107 });
108
109 #[cfg(not(target_os = "macos"))]
110 workspace.register_action(|workspace, _: &ActivateMenuLeft, window, cx| {
111 if let Some(titlebar) = workspace
112 .titlebar_item()
113 .and_then(|item| item.downcast::<TitleBar>().ok())
114 {
115 titlebar.update(cx, |titlebar, cx| {
116 if let Some(ref menu) = titlebar.application_menu {
117 menu.update(cx, |menu, cx| {
118 menu.navigate_menus_in_direction(ActivateDirection::Left, window, cx)
119 });
120 }
121 });
122 }
123 });
124 })
125 .detach();
126}
127
128pub struct TitleBar {
129 platform_titlebar: Entity<PlatformTitleBar>,
130 project: Entity<Project>,
131 user_store: Entity<UserStore>,
132 client: Arc<Client>,
133 workspace: WeakEntity<Workspace>,
134 application_menu: Option<Entity<ApplicationMenu>>,
135 _subscriptions: Vec<Subscription>,
136 banner: Entity<OnboardingBanner>,
137 screen_share_popover_handle: PopoverMenuHandle<ContextMenu>,
138}
139
140impl Render for TitleBar {
141 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
142 let title_bar_settings = *TitleBarSettings::get_global(cx);
143
144 let show_menus = show_menus(cx);
145
146 let mut children = Vec::new();
147
148 children.push(
149 h_flex()
150 .gap_1()
151 .map(|title_bar| {
152 let mut render_project_items = title_bar_settings.show_branch_name
153 || title_bar_settings.show_project_items;
154 title_bar
155 .when_some(
156 self.application_menu.clone().filter(|_| !show_menus),
157 |title_bar, menu| {
158 render_project_items &=
159 !menu.update(cx, |menu, cx| menu.all_menus_shown(cx));
160 title_bar.child(menu)
161 },
162 )
163 .when(render_project_items, |title_bar| {
164 title_bar
165 .when(title_bar_settings.show_project_items, |title_bar| {
166 title_bar
167 .children(self.render_project_host(cx))
168 .child(self.render_project_name(cx))
169 })
170 .when(title_bar_settings.show_branch_name, |title_bar| {
171 title_bar.children(self.render_project_branch(cx))
172 })
173 })
174 })
175 .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())
176 .into_any_element(),
177 );
178
179 children.push(self.render_collaborator_list(window, cx).into_any_element());
180
181 if title_bar_settings.show_onboarding_banner {
182 children.push(self.banner.clone().into_any_element())
183 }
184
185 let status = self.client.status();
186 let status = &*status.borrow();
187 let user = self.user_store.read(cx).current_user();
188
189 children.push(
190 h_flex()
191 .gap_1()
192 .pr_1()
193 .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())
194 .children(self.render_call_controls(window, cx))
195 .children(self.render_connection_status(status, cx))
196 .when(
197 user.is_none() && TitleBarSettings::get_global(cx).show_sign_in,
198 |el| el.child(self.render_sign_in_button(cx)),
199 )
200 .when(user.is_some(), |parent| {
201 parent.child(self.render_user_menu_button(cx))
202 })
203 .into_any_element(),
204 );
205
206 if show_menus {
207 self.platform_titlebar.update(cx, |this, _| {
208 this.set_children(
209 self.application_menu
210 .clone()
211 .map(|menu| menu.into_any_element()),
212 );
213 });
214
215 let height = PlatformTitleBar::height(window);
216 let title_bar_color = self.platform_titlebar.update(cx, |platform_titlebar, cx| {
217 platform_titlebar.title_bar_color(window, cx)
218 });
219
220 v_flex()
221 .w_full()
222 .child(self.platform_titlebar.clone().into_any_element())
223 .child(
224 h_flex()
225 .bg(title_bar_color)
226 .h(height)
227 .pl_2()
228 .justify_between()
229 .w_full()
230 .children(children),
231 )
232 .into_any_element()
233 } else {
234 self.platform_titlebar.update(cx, |this, _| {
235 this.set_children(children);
236 });
237 self.platform_titlebar.clone().into_any_element()
238 }
239 }
240}
241
242impl TitleBar {
243 pub fn new(
244 id: impl Into<ElementId>,
245 workspace: &Workspace,
246 window: &mut Window,
247 cx: &mut Context<Self>,
248 ) -> Self {
249 let project = workspace.project().clone();
250 let user_store = workspace.app_state().user_store.clone();
251 let client = workspace.app_state().client.clone();
252 let active_call = ActiveCall::global(cx);
253
254 let platform_style = PlatformStyle::platform();
255 let application_menu = match platform_style {
256 PlatformStyle::Mac => {
257 if option_env!("ZED_USE_CROSS_PLATFORM_MENU").is_some() {
258 Some(cx.new(|cx| ApplicationMenu::new(window, cx)))
259 } else {
260 None
261 }
262 }
263 PlatformStyle::Linux | PlatformStyle::Windows => {
264 Some(cx.new(|cx| ApplicationMenu::new(window, cx)))
265 }
266 };
267
268 let mut subscriptions = Vec::new();
269 subscriptions.push(
270 cx.observe(&workspace.weak_handle().upgrade().unwrap(), |_, _, cx| {
271 cx.notify()
272 }),
273 );
274 subscriptions.push(cx.subscribe(&project, |_, _, _: &project::Event, cx| cx.notify()));
275 subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
276 subscriptions.push(cx.observe_window_activation(window, Self::window_activation_changed));
277 subscriptions.push(cx.observe(&user_store, |_, _, cx| cx.notify()));
278
279 let banner = cx.new(|cx| {
280 OnboardingBanner::new(
281 "ACP Claude Code Onboarding",
282 IconName::AiClaude,
283 "Claude Code",
284 Some("Introducing:".into()),
285 zed_actions::agent::OpenClaudeCodeOnboardingModal.boxed_clone(),
286 cx,
287 )
288 // When updating this to a non-AI feature release, remove this line.
289 .visible_when(|cx| !project::DisableAiSettings::get_global(cx).disable_ai)
290 });
291
292 let platform_titlebar = cx.new(|cx| PlatformTitleBar::new(id, cx));
293
294 Self {
295 platform_titlebar,
296 application_menu,
297 workspace: workspace.weak_handle(),
298 project,
299 user_store,
300 client,
301 _subscriptions: subscriptions,
302 banner,
303 screen_share_popover_handle: Default::default(),
304 }
305 }
306
307 fn render_remote_project_connection(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
308 let options = self.project.read(cx).remote_connection_options(cx)?;
309 let host: SharedString = options.display_name().into();
310
311 let nickname = if let RemoteConnectionOptions::Ssh(options) = options {
312 options.nickname.map(|nick| nick.into())
313 } else {
314 None
315 };
316 let nickname = nickname.unwrap_or_else(|| host.clone());
317
318 let (indicator_color, meta) = match self.project.read(cx).remote_connection_state(cx)? {
319 remote::ConnectionState::Connecting => (Color::Info, format!("Connecting to: {host}")),
320 remote::ConnectionState::Connected => (Color::Success, format!("Connected to: {host}")),
321 remote::ConnectionState::HeartbeatMissed => (
322 Color::Warning,
323 format!("Connection attempt to {host} missed. Retrying..."),
324 ),
325 remote::ConnectionState::Reconnecting => (
326 Color::Warning,
327 format!("Lost connection to {host}. Reconnecting..."),
328 ),
329 remote::ConnectionState::Disconnected => {
330 (Color::Error, format!("Disconnected from {host}"))
331 }
332 };
333
334 let icon_color = match self.project.read(cx).remote_connection_state(cx)? {
335 remote::ConnectionState::Connecting => Color::Info,
336 remote::ConnectionState::Connected => Color::Default,
337 remote::ConnectionState::HeartbeatMissed => Color::Warning,
338 remote::ConnectionState::Reconnecting => Color::Warning,
339 remote::ConnectionState::Disconnected => Color::Error,
340 };
341
342 let meta = SharedString::from(meta);
343
344 Some(
345 ButtonLike::new("ssh-server-icon")
346 .child(
347 h_flex()
348 .gap_2()
349 .max_w_32()
350 .child(
351 IconWithIndicator::new(
352 Icon::new(IconName::Server)
353 .size(IconSize::Small)
354 .color(icon_color),
355 Some(Indicator::dot().color(indicator_color)),
356 )
357 .indicator_border_color(Some(cx.theme().colors().title_bar_background))
358 .into_any_element(),
359 )
360 .child(Label::new(nickname).size(LabelSize::Small).truncate()),
361 )
362 .tooltip(move |window, cx| {
363 Tooltip::with_meta(
364 "Remote Project",
365 Some(&OpenRemote {
366 from_existing_connection: false,
367 create_new_window: false,
368 }),
369 meta.clone(),
370 window,
371 cx,
372 )
373 })
374 .on_click(|_, window, cx| {
375 window.dispatch_action(
376 OpenRemote {
377 from_existing_connection: false,
378 create_new_window: false,
379 }
380 .boxed_clone(),
381 cx,
382 );
383 })
384 .into_any_element(),
385 )
386 }
387
388 pub fn render_project_host(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
389 if self.project.read(cx).is_via_remote_server() {
390 return self.render_remote_project_connection(cx);
391 }
392
393 if self.project.read(cx).is_disconnected(cx) {
394 return Some(
395 Button::new("disconnected", "Disconnected")
396 .disabled(true)
397 .color(Color::Disabled)
398 .style(ButtonStyle::Subtle)
399 .label_size(LabelSize::Small)
400 .into_any_element(),
401 );
402 }
403
404 let host = self.project.read(cx).host()?;
405 let host_user = self.user_store.read(cx).get_cached_user(host.user_id)?;
406 let participant_index = self
407 .user_store
408 .read(cx)
409 .participant_indices()
410 .get(&host_user.id)?;
411 Some(
412 Button::new("project_owner_trigger", host_user.github_login.clone())
413 .color(Color::Player(participant_index.0))
414 .style(ButtonStyle::Subtle)
415 .label_size(LabelSize::Small)
416 .tooltip(Tooltip::text(format!(
417 "{} is sharing this project. Click to follow.",
418 host_user.github_login
419 )))
420 .on_click({
421 let host_peer_id = host.peer_id;
422 cx.listener(move |this, _, window, cx| {
423 this.workspace
424 .update(cx, |workspace, cx| {
425 workspace.follow(host_peer_id, window, cx);
426 })
427 .log_err();
428 })
429 })
430 .into_any_element(),
431 )
432 }
433
434 pub fn render_project_name(&self, cx: &mut Context<Self>) -> impl IntoElement {
435 let name = self
436 .project
437 .read(cx)
438 .visible_worktrees(cx)
439 .map(|worktree| {
440 let worktree = worktree.read(cx);
441 let settings_location = SettingsLocation {
442 worktree_id: worktree.id(),
443 path: Path::new(""),
444 };
445
446 let settings = WorktreeSettings::get(Some(settings_location), cx);
447 match &settings.project_name {
448 Some(name) => name.as_str(),
449 None => worktree.root_name(),
450 }
451 })
452 .next();
453 let is_project_selected = name.is_some();
454 let name = if let Some(name) = name {
455 util::truncate_and_trailoff(name, MAX_PROJECT_NAME_LENGTH)
456 } else {
457 "Open recent project".to_string()
458 };
459
460 Button::new("project_name_trigger", name)
461 .when(!is_project_selected, |b| b.color(Color::Muted))
462 .style(ButtonStyle::Subtle)
463 .label_size(LabelSize::Small)
464 .tooltip(move |window, cx| {
465 Tooltip::for_action(
466 "Recent Projects",
467 &zed_actions::OpenRecent {
468 create_new_window: false,
469 },
470 window,
471 cx,
472 )
473 })
474 .on_click(cx.listener(move |_, _, window, cx| {
475 window.dispatch_action(
476 OpenRecent {
477 create_new_window: false,
478 }
479 .boxed_clone(),
480 cx,
481 );
482 }))
483 }
484
485 pub fn render_project_branch(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {
486 let repository = self.project.read(cx).active_repository(cx)?;
487 let workspace = self.workspace.upgrade()?;
488 let branch_name = {
489 let repo = repository.read(cx);
490 repo.branch
491 .as_ref()
492 .map(|branch| branch.name())
493 .map(|name| util::truncate_and_trailoff(name, MAX_BRANCH_NAME_LENGTH))
494 .or_else(|| {
495 repo.head_commit.as_ref().map(|commit| {
496 commit
497 .sha
498 .chars()
499 .take(MAX_SHORT_SHA_LENGTH)
500 .collect::<String>()
501 })
502 })
503 }?;
504
505 Some(
506 Button::new("project_branch_trigger", branch_name)
507 .color(Color::Muted)
508 .style(ButtonStyle::Subtle)
509 .label_size(LabelSize::Small)
510 .tooltip(move |window, cx| {
511 Tooltip::with_meta(
512 "Recent Branches",
513 Some(&zed_actions::git::Branch),
514 "Local branches only",
515 window,
516 cx,
517 )
518 })
519 .on_click(move |_, window, cx| {
520 let _ = workspace.update(cx, |this, cx| {
521 window.focus(&this.active_pane().focus_handle(cx));
522 window.dispatch_action(zed_actions::git::Branch.boxed_clone(), cx);
523 });
524 })
525 .when(
526 TitleBarSettings::get_global(cx).show_branch_icon,
527 |branch_button| {
528 branch_button
529 .icon(IconName::GitBranch)
530 .icon_position(IconPosition::Start)
531 .icon_color(Color::Muted)
532 .icon_size(IconSize::Indicator)
533 },
534 ),
535 )
536 }
537
538 fn window_activation_changed(&mut self, window: &mut Window, cx: &mut Context<Self>) {
539 if window.is_window_active() {
540 ActiveCall::global(cx)
541 .update(cx, |call, cx| call.set_location(Some(&self.project), cx))
542 .detach_and_log_err(cx);
543 } else if cx.active_window().is_none() {
544 ActiveCall::global(cx)
545 .update(cx, |call, cx| call.set_location(None, cx))
546 .detach_and_log_err(cx);
547 }
548 self.workspace
549 .update(cx, |workspace, cx| {
550 workspace.update_active_view_for_followers(window, cx);
551 })
552 .ok();
553 }
554
555 fn active_call_changed(&mut self, cx: &mut Context<Self>) {
556 cx.notify();
557 }
558
559 fn share_project(&mut self, cx: &mut Context<Self>) {
560 let active_call = ActiveCall::global(cx);
561 let project = self.project.clone();
562 active_call
563 .update(cx, |call, cx| call.share_project(project, cx))
564 .detach_and_log_err(cx);
565 }
566
567 fn unshare_project(&mut self, _: &mut Window, cx: &mut Context<Self>) {
568 let active_call = ActiveCall::global(cx);
569 let project = self.project.clone();
570 active_call
571 .update(cx, |call, cx| call.unshare_project(project, cx))
572 .log_err();
573 }
574
575 fn render_connection_status(
576 &self,
577 status: &client::Status,
578 cx: &mut Context<Self>,
579 ) -> Option<AnyElement> {
580 match status {
581 client::Status::ConnectionError
582 | client::Status::ConnectionLost
583 | client::Status::Reauthenticating
584 | client::Status::Reconnecting
585 | client::Status::ReconnectionError { .. } => Some(
586 div()
587 .id("disconnected")
588 .child(Icon::new(IconName::Disconnected).size(IconSize::Small))
589 .tooltip(Tooltip::text("Disconnected"))
590 .into_any_element(),
591 ),
592 client::Status::UpgradeRequired => {
593 let auto_updater = auto_update::AutoUpdater::get(cx);
594 let label = match auto_updater.map(|auto_update| auto_update.read(cx).status()) {
595 Some(AutoUpdateStatus::Updated { .. }) => "Please restart Zed to Collaborate",
596 Some(AutoUpdateStatus::Installing { .. })
597 | Some(AutoUpdateStatus::Downloading { .. })
598 | Some(AutoUpdateStatus::Checking) => "Updating...",
599 Some(AutoUpdateStatus::Idle) | Some(AutoUpdateStatus::Errored) | None => {
600 "Please update Zed to Collaborate"
601 }
602 };
603
604 Some(
605 Button::new("connection-status", label)
606 .label_size(LabelSize::Small)
607 .on_click(|_, window, cx| {
608 if let Some(auto_updater) = auto_update::AutoUpdater::get(cx)
609 && auto_updater.read(cx).status().is_updated()
610 {
611 workspace::reload(cx);
612 return;
613 }
614 auto_update::check(&Default::default(), window, cx);
615 })
616 .into_any_element(),
617 )
618 }
619 _ => None,
620 }
621 }
622
623 pub fn render_sign_in_button(&mut self, _: &mut Context<Self>) -> Button {
624 let client = self.client.clone();
625 Button::new("sign_in", "Sign in")
626 .label_size(LabelSize::Small)
627 .on_click(move |_, window, cx| {
628 let client = client.clone();
629 window
630 .spawn(cx, async move |cx| {
631 client
632 .sign_in_with_optional_connect(true, cx)
633 .await
634 .notify_async_err(cx);
635 })
636 .detach();
637 })
638 }
639
640 pub fn render_user_menu_button(&mut self, cx: &mut Context<Self>) -> impl Element {
641 let user_store = self.user_store.read(cx);
642 if let Some(user) = user_store.current_user() {
643 let has_subscription_period = user_store.subscription_period().is_some();
644 let plan = user_store.plan().filter(|_| {
645 // Since the user might be on the legacy free plan we filter based on whether we have a subscription period.
646 has_subscription_period
647 });
648
649 let user_avatar = user.avatar_uri.clone();
650 let free_chip_bg = cx
651 .theme()
652 .colors()
653 .editor_background
654 .opacity(0.5)
655 .blend(cx.theme().colors().text_accent.opacity(0.05));
656
657 let pro_chip_bg = cx
658 .theme()
659 .colors()
660 .editor_background
661 .opacity(0.5)
662 .blend(cx.theme().colors().text_accent.opacity(0.2));
663
664 PopoverMenu::new("user-menu")
665 .anchor(Corner::TopRight)
666 .menu(move |window, cx| {
667 ContextMenu::build(window, cx, |menu, _, _cx| {
668 let user_login = user.github_login.clone();
669
670 let (plan_name, label_color, bg_color) = match plan {
671 None | Some(Plan::V1(PlanV1::ZedFree) | Plan::V2(PlanV2::ZedFree)) => {
672 ("Free", Color::Default, free_chip_bg)
673 }
674 Some(Plan::V1(PlanV1::ZedProTrial) | Plan::V2(PlanV2::ZedProTrial)) => {
675 ("Pro Trial", Color::Accent, pro_chip_bg)
676 }
677 Some(Plan::V1(PlanV1::ZedPro) | Plan::V2(PlanV2::ZedPro)) => {
678 ("Pro", Color::Accent, pro_chip_bg)
679 }
680 };
681
682 menu.custom_entry(
683 move |_window, _cx| {
684 let user_login = user_login.clone();
685
686 h_flex()
687 .w_full()
688 .justify_between()
689 .child(Label::new(user_login))
690 .child(
691 Chip::new(plan_name.to_string())
692 .bg_color(bg_color)
693 .label_color(label_color),
694 )
695 .into_any_element()
696 },
697 move |_, cx| {
698 cx.open_url(&zed_urls::account_url(cx));
699 },
700 )
701 .separator()
702 .action("Settings", zed_actions::OpenSettings.boxed_clone())
703 .action(
704 "Settings Profiles",
705 zed_actions::settings_profile_selector::Toggle.boxed_clone(),
706 )
707 .action("Keymap Editor", Box::new(zed_actions::OpenKeymapEditor))
708 .action(
709 "Themes…",
710 zed_actions::theme_selector::Toggle::default().boxed_clone(),
711 )
712 .action(
713 "Icon Themes…",
714 zed_actions::icon_theme_selector::Toggle::default().boxed_clone(),
715 )
716 .action(
717 "Extensions",
718 zed_actions::Extensions::default().boxed_clone(),
719 )
720 .separator()
721 .action("Sign Out", client::SignOut.boxed_clone())
722 })
723 .into()
724 })
725 .trigger_with_tooltip(
726 ButtonLike::new("user-menu")
727 .child(
728 h_flex()
729 .gap_0p5()
730 .children(
731 TitleBarSettings::get_global(cx)
732 .show_user_picture
733 .then(|| Avatar::new(user_avatar)),
734 )
735 .child(
736 Icon::new(IconName::ChevronDown)
737 .size(IconSize::Small)
738 .color(Color::Muted),
739 ),
740 )
741 .style(ButtonStyle::Subtle),
742 Tooltip::text("Toggle User Menu"),
743 )
744 .anchor(gpui::Corner::TopRight)
745 } else {
746 PopoverMenu::new("user-menu")
747 .anchor(Corner::TopRight)
748 .menu(|window, cx| {
749 ContextMenu::build(window, cx, |menu, _, _| {
750 menu.action("Settings", zed_actions::OpenSettings.boxed_clone())
751 .action(
752 "Settings Profiles",
753 zed_actions::settings_profile_selector::Toggle.boxed_clone(),
754 )
755 .action("Key Bindings", Box::new(zed_actions::OpenKeymapEditor))
756 .action(
757 "Themes…",
758 zed_actions::theme_selector::Toggle::default().boxed_clone(),
759 )
760 .action(
761 "Icon Themes…",
762 zed_actions::icon_theme_selector::Toggle::default().boxed_clone(),
763 )
764 .action(
765 "Extensions",
766 zed_actions::Extensions::default().boxed_clone(),
767 )
768 })
769 .into()
770 })
771 .trigger_with_tooltip(
772 IconButton::new("user-menu", IconName::ChevronDown).icon_size(IconSize::Small),
773 Tooltip::text("Toggle User Menu"),
774 )
775 }
776 }
777}