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::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, rel_path::RelPath};
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 .child(self.render_app_menu_button(cx))
201 .into_any_element(),
202 );
203
204 if show_menus {
205 self.platform_titlebar.update(cx, |this, _| {
206 this.set_children(
207 self.application_menu
208 .clone()
209 .map(|menu| menu.into_any_element()),
210 );
211 });
212
213 let height = PlatformTitleBar::height(window);
214 let title_bar_color = self.platform_titlebar.update(cx, |platform_titlebar, cx| {
215 platform_titlebar.title_bar_color(window, cx)
216 });
217
218 v_flex()
219 .w_full()
220 .child(self.platform_titlebar.clone().into_any_element())
221 .child(
222 h_flex()
223 .bg(title_bar_color)
224 .h(height)
225 .pl_2()
226 .justify_between()
227 .w_full()
228 .children(children),
229 )
230 .into_any_element()
231 } else {
232 self.platform_titlebar.update(cx, |this, _| {
233 this.set_children(children);
234 });
235 self.platform_titlebar.clone().into_any_element()
236 }
237 }
238}
239
240impl TitleBar {
241 pub fn new(
242 id: impl Into<ElementId>,
243 workspace: &Workspace,
244 window: &mut Window,
245 cx: &mut Context<Self>,
246 ) -> Self {
247 let project = workspace.project().clone();
248 let user_store = workspace.app_state().user_store.clone();
249 let client = workspace.app_state().client.clone();
250 let active_call = ActiveCall::global(cx);
251
252 let platform_style = PlatformStyle::platform();
253 let application_menu = match platform_style {
254 PlatformStyle::Mac => {
255 if option_env!("ZED_USE_CROSS_PLATFORM_MENU").is_some() {
256 Some(cx.new(|cx| ApplicationMenu::new(window, cx)))
257 } else {
258 None
259 }
260 }
261 PlatformStyle::Linux | PlatformStyle::Windows => {
262 Some(cx.new(|cx| ApplicationMenu::new(window, cx)))
263 }
264 };
265
266 let mut subscriptions = Vec::new();
267 subscriptions.push(
268 cx.observe(&workspace.weak_handle().upgrade().unwrap(), |_, _, cx| {
269 cx.notify()
270 }),
271 );
272 subscriptions.push(cx.subscribe(&project, |_, _, _: &project::Event, cx| cx.notify()));
273 subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
274 subscriptions.push(cx.observe_window_activation(window, Self::window_activation_changed));
275 subscriptions.push(cx.observe(&user_store, |_, _, cx| cx.notify()));
276
277 let banner = cx.new(|cx| {
278 OnboardingBanner::new(
279 "ACP Claude Code Onboarding",
280 IconName::AiClaude,
281 "Claude Code",
282 Some("Introducing:".into()),
283 zed_actions::agent::OpenClaudeCodeOnboardingModal.boxed_clone(),
284 cx,
285 )
286 // When updating this to a non-AI feature release, remove this line.
287 .visible_when(|cx| !project::DisableAiSettings::get_global(cx).disable_ai)
288 });
289
290 let platform_titlebar = cx.new(|cx| PlatformTitleBar::new(id, cx));
291
292 Self {
293 platform_titlebar,
294 application_menu,
295 workspace: workspace.weak_handle(),
296 project,
297 user_store,
298 client,
299 _subscriptions: subscriptions,
300 banner,
301 screen_share_popover_handle: Default::default(),
302 }
303 }
304
305 fn render_remote_project_connection(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
306 let options = self.project.read(cx).remote_connection_options(cx)?;
307 let host: SharedString = options.display_name().into();
308
309 let (nickname, icon) = match options {
310 RemoteConnectionOptions::Ssh(options) => {
311 (options.nickname.map(|nick| nick.into()), IconName::Server)
312 }
313 RemoteConnectionOptions::Wsl(_) => (None, IconName::Linux),
314 };
315 let nickname = nickname.unwrap_or_else(|| host.clone());
316
317 let (indicator_color, meta) = match self.project.read(cx).remote_connection_state(cx)? {
318 remote::ConnectionState::Connecting => (Color::Info, format!("Connecting to: {host}")),
319 remote::ConnectionState::Connected => (Color::Success, format!("Connected to: {host}")),
320 remote::ConnectionState::HeartbeatMissed => (
321 Color::Warning,
322 format!("Connection attempt to {host} missed. Retrying..."),
323 ),
324 remote::ConnectionState::Reconnecting => (
325 Color::Warning,
326 format!("Lost connection to {host}. Reconnecting..."),
327 ),
328 remote::ConnectionState::Disconnected => {
329 (Color::Error, format!("Disconnected from {host}"))
330 }
331 };
332
333 let icon_color = match self.project.read(cx).remote_connection_state(cx)? {
334 remote::ConnectionState::Connecting => Color::Info,
335 remote::ConnectionState::Connected => Color::Default,
336 remote::ConnectionState::HeartbeatMissed => Color::Warning,
337 remote::ConnectionState::Reconnecting => Color::Warning,
338 remote::ConnectionState::Disconnected => Color::Error,
339 };
340
341 let meta = SharedString::from(meta);
342
343 Some(
344 ButtonLike::new("ssh-server-icon")
345 .child(
346 h_flex()
347 .gap_2()
348 .max_w_32()
349 .child(
350 IconWithIndicator::new(
351 Icon::new(icon).size(IconSize::Small).color(icon_color),
352 Some(Indicator::dot().color(indicator_color)),
353 )
354 .indicator_border_color(Some(cx.theme().colors().title_bar_background))
355 .into_any_element(),
356 )
357 .child(Label::new(nickname).size(LabelSize::Small).truncate()),
358 )
359 .tooltip(move |window, cx| {
360 Tooltip::with_meta(
361 "Remote Project",
362 Some(&OpenRemote {
363 from_existing_connection: false,
364 create_new_window: false,
365 }),
366 meta.clone(),
367 window,
368 cx,
369 )
370 })
371 .on_click(|_, window, cx| {
372 window.dispatch_action(
373 OpenRemote {
374 from_existing_connection: false,
375 create_new_window: false,
376 }
377 .boxed_clone(),
378 cx,
379 );
380 })
381 .into_any_element(),
382 )
383 }
384
385 pub fn render_project_host(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
386 if self.project.read(cx).is_via_remote_server() {
387 return self.render_remote_project_connection(cx);
388 }
389
390 if self.project.read(cx).is_disconnected(cx) {
391 return Some(
392 Button::new("disconnected", "Disconnected")
393 .disabled(true)
394 .color(Color::Disabled)
395 .style(ButtonStyle::Subtle)
396 .label_size(LabelSize::Small)
397 .into_any_element(),
398 );
399 }
400
401 let host = self.project.read(cx).host()?;
402 let host_user = self.user_store.read(cx).get_cached_user(host.user_id)?;
403 let participant_index = self
404 .user_store
405 .read(cx)
406 .participant_indices()
407 .get(&host_user.id)?;
408 Some(
409 Button::new("project_owner_trigger", host_user.github_login.clone())
410 .color(Color::Player(participant_index.0))
411 .style(ButtonStyle::Subtle)
412 .label_size(LabelSize::Small)
413 .tooltip(Tooltip::text(format!(
414 "{} is sharing this project. Click to follow.",
415 host_user.github_login
416 )))
417 .on_click({
418 let host_peer_id = host.peer_id;
419 cx.listener(move |this, _, window, cx| {
420 this.workspace
421 .update(cx, |workspace, cx| {
422 workspace.follow(host_peer_id, window, cx);
423 })
424 .log_err();
425 })
426 })
427 .into_any_element(),
428 )
429 }
430
431 pub fn render_project_name(&self, cx: &mut Context<Self>) -> impl IntoElement {
432 let name = self
433 .project
434 .read(cx)
435 .visible_worktrees(cx)
436 .map(|worktree| {
437 let worktree = worktree.read(cx);
438 let settings_location = SettingsLocation {
439 worktree_id: worktree.id(),
440 path: RelPath::empty(),
441 };
442
443 let settings = WorktreeSettings::get(Some(settings_location), cx);
444 match &settings.project_name {
445 Some(name) => name.as_str(),
446 None => worktree.root_name_str(),
447 }
448 })
449 .next();
450 let is_project_selected = name.is_some();
451 let name = if let Some(name) = name {
452 util::truncate_and_trailoff(name, MAX_PROJECT_NAME_LENGTH)
453 } else {
454 "Open recent project".to_string()
455 };
456
457 Button::new("project_name_trigger", name)
458 .when(!is_project_selected, |b| b.color(Color::Muted))
459 .style(ButtonStyle::Subtle)
460 .label_size(LabelSize::Small)
461 .tooltip(move |window, cx| {
462 Tooltip::for_action(
463 "Recent Projects",
464 &zed_actions::OpenRecent {
465 create_new_window: false,
466 },
467 window,
468 cx,
469 )
470 })
471 .on_click(cx.listener(move |_, _, window, cx| {
472 window.dispatch_action(
473 OpenRecent {
474 create_new_window: false,
475 }
476 .boxed_clone(),
477 cx,
478 );
479 }))
480 }
481
482 pub fn render_project_branch(&self, cx: &mut Context<Self>) -> Option<impl IntoElement> {
483 let repository = self.project.read(cx).active_repository(cx)?;
484 let workspace = self.workspace.upgrade()?;
485 let branch_name = {
486 let repo = repository.read(cx);
487 repo.branch
488 .as_ref()
489 .map(|branch| branch.name())
490 .map(|name| util::truncate_and_trailoff(name, MAX_BRANCH_NAME_LENGTH))
491 .or_else(|| {
492 repo.head_commit.as_ref().map(|commit| {
493 commit
494 .sha
495 .chars()
496 .take(MAX_SHORT_SHA_LENGTH)
497 .collect::<String>()
498 })
499 })
500 }?;
501
502 Some(
503 Button::new("project_branch_trigger", branch_name)
504 .color(Color::Muted)
505 .style(ButtonStyle::Subtle)
506 .label_size(LabelSize::Small)
507 .tooltip(move |window, cx| {
508 Tooltip::with_meta(
509 "Recent Branches",
510 Some(&zed_actions::git::Branch),
511 "Local branches only",
512 window,
513 cx,
514 )
515 })
516 .on_click(move |_, window, cx| {
517 let _ = workspace.update(cx, |this, cx| {
518 window.focus(&this.active_pane().focus_handle(cx));
519 window.dispatch_action(zed_actions::git::Branch.boxed_clone(), cx);
520 });
521 })
522 .when(
523 TitleBarSettings::get_global(cx).show_branch_icon,
524 |branch_button| {
525 branch_button
526 .icon(IconName::GitBranch)
527 .icon_position(IconPosition::Start)
528 .icon_color(Color::Muted)
529 .icon_size(IconSize::Indicator)
530 },
531 ),
532 )
533 }
534
535 fn window_activation_changed(&mut self, window: &mut Window, cx: &mut Context<Self>) {
536 if window.is_window_active() {
537 ActiveCall::global(cx)
538 .update(cx, |call, cx| call.set_location(Some(&self.project), cx))
539 .detach_and_log_err(cx);
540 } else if cx.active_window().is_none() {
541 ActiveCall::global(cx)
542 .update(cx, |call, cx| call.set_location(None, cx))
543 .detach_and_log_err(cx);
544 }
545 self.workspace
546 .update(cx, |workspace, cx| {
547 workspace.update_active_view_for_followers(window, cx);
548 })
549 .ok();
550 }
551
552 fn active_call_changed(&mut self, cx: &mut Context<Self>) {
553 cx.notify();
554 }
555
556 fn share_project(&mut self, cx: &mut Context<Self>) {
557 let active_call = ActiveCall::global(cx);
558 let project = self.project.clone();
559 active_call
560 .update(cx, |call, cx| call.share_project(project, cx))
561 .detach_and_log_err(cx);
562 }
563
564 fn unshare_project(&mut self, _: &mut Window, cx: &mut Context<Self>) {
565 let active_call = ActiveCall::global(cx);
566 let project = self.project.clone();
567 active_call
568 .update(cx, |call, cx| call.unshare_project(project, cx))
569 .log_err();
570 }
571
572 fn render_connection_status(
573 &self,
574 status: &client::Status,
575 cx: &mut Context<Self>,
576 ) -> Option<AnyElement> {
577 match status {
578 client::Status::ConnectionError
579 | client::Status::ConnectionLost
580 | client::Status::Reauthenticating
581 | client::Status::Reconnecting
582 | client::Status::ReconnectionError { .. } => Some(
583 div()
584 .id("disconnected")
585 .child(Icon::new(IconName::Disconnected).size(IconSize::Small))
586 .tooltip(Tooltip::text("Disconnected"))
587 .into_any_element(),
588 ),
589 client::Status::UpgradeRequired => {
590 let auto_updater = auto_update::AutoUpdater::get(cx);
591 let label = match auto_updater.map(|auto_update| auto_update.read(cx).status()) {
592 Some(AutoUpdateStatus::Updated { .. }) => "Please restart Zed to Collaborate",
593 Some(AutoUpdateStatus::Installing { .. })
594 | Some(AutoUpdateStatus::Downloading { .. })
595 | Some(AutoUpdateStatus::Checking) => "Updating...",
596 Some(AutoUpdateStatus::Idle)
597 | Some(AutoUpdateStatus::Errored { .. })
598 | None => "Please update Zed to Collaborate",
599 };
600
601 Some(
602 Button::new("connection-status", label)
603 .label_size(LabelSize::Small)
604 .on_click(|_, window, cx| {
605 if let Some(auto_updater) = auto_update::AutoUpdater::get(cx)
606 && auto_updater.read(cx).status().is_updated()
607 {
608 workspace::reload(cx);
609 return;
610 }
611 auto_update::check(&Default::default(), window, cx);
612 })
613 .into_any_element(),
614 )
615 }
616 _ => None,
617 }
618 }
619
620 pub fn render_sign_in_button(&mut self, _: &mut Context<Self>) -> Button {
621 let client = self.client.clone();
622 Button::new("sign_in", "Sign in")
623 .label_size(LabelSize::Small)
624 .on_click(move |_, window, cx| {
625 let client = client.clone();
626 window
627 .spawn(cx, async move |cx| {
628 client
629 .sign_in_with_optional_connect(true, cx)
630 .await
631 .notify_async_err(cx);
632 })
633 .detach();
634 })
635 }
636
637 pub fn render_app_menu_button(&mut self, cx: &mut Context<Self>) -> impl Element {
638 let user_store = self.user_store.read(cx);
639 if let Some(user) = user_store.current_user() {
640 let has_subscription_period = user_store.subscription_period().is_some();
641 let plan = user_store.plan().filter(|_| {
642 // Since the user might be on the legacy free plan we filter based on whether we have a subscription period.
643 has_subscription_period
644 });
645
646 let user_avatar = user.avatar_uri.clone();
647 let free_chip_bg = cx
648 .theme()
649 .colors()
650 .editor_background
651 .opacity(0.5)
652 .blend(cx.theme().colors().text_accent.opacity(0.05));
653
654 let pro_chip_bg = cx
655 .theme()
656 .colors()
657 .editor_background
658 .opacity(0.5)
659 .blend(cx.theme().colors().text_accent.opacity(0.2));
660
661 PopoverMenu::new("user-menu")
662 .anchor(Corner::TopRight)
663 .menu(move |window, cx| {
664 ContextMenu::build(window, cx, |menu, _, _cx| {
665 let user_login = user.github_login.clone();
666
667 let (plan_name, label_color, bg_color) = match plan {
668 None | Some(Plan::V1(PlanV1::ZedFree) | Plan::V2(PlanV2::ZedFree)) => {
669 ("Free", Color::Default, free_chip_bg)
670 }
671 Some(Plan::V1(PlanV1::ZedProTrial) | Plan::V2(PlanV2::ZedProTrial)) => {
672 ("Pro Trial", Color::Accent, pro_chip_bg)
673 }
674 Some(Plan::V1(PlanV1::ZedPro) | Plan::V2(PlanV2::ZedPro)) => {
675 ("Pro", Color::Accent, pro_chip_bg)
676 }
677 };
678
679 menu.custom_entry(
680 move |_window, _cx| {
681 let user_login = user_login.clone();
682
683 h_flex()
684 .w_full()
685 .justify_between()
686 .child(Label::new(user_login))
687 .child(
688 Chip::new(plan_name.to_string())
689 .bg_color(bg_color)
690 .label_color(label_color),
691 )
692 .into_any_element()
693 },
694 move |_, cx| {
695 cx.open_url(&zed_urls::account_url(cx));
696 },
697 )
698 .separator()
699 .action("Settings", zed_actions::OpenSettings.boxed_clone())
700 .action(
701 "Settings Profiles",
702 zed_actions::settings_profile_selector::Toggle.boxed_clone(),
703 )
704 .action("Keymap Editor", Box::new(zed_actions::OpenKeymapEditor))
705 .action(
706 "Themes…",
707 zed_actions::theme_selector::Toggle::default().boxed_clone(),
708 )
709 .action(
710 "Icon Themes…",
711 zed_actions::icon_theme_selector::Toggle::default().boxed_clone(),
712 )
713 .action(
714 "Extensions",
715 zed_actions::Extensions::default().boxed_clone(),
716 )
717 .separator()
718 .action("Sign Out", client::SignOut.boxed_clone())
719 })
720 .into()
721 })
722 .trigger_with_tooltip(
723 ButtonLike::new("user-menu")
724 .child(
725 h_flex()
726 .gap_0p5()
727 .children(
728 TitleBarSettings::get_global(cx)
729 .show_user_picture
730 .then(|| Avatar::new(user_avatar)),
731 )
732 .child(
733 Icon::new(IconName::ChevronDown)
734 .size(IconSize::Small)
735 .color(Color::Muted),
736 ),
737 )
738 .style(ButtonStyle::Subtle),
739 Tooltip::text("Toggle User Menu"),
740 )
741 .anchor(gpui::Corner::TopRight)
742 } else {
743 PopoverMenu::new("user-menu")
744 .anchor(Corner::TopRight)
745 .menu(|window, cx| {
746 ContextMenu::build(window, cx, |menu, _, _| {
747 menu.action("Settings", zed_actions::OpenSettings.boxed_clone())
748 .action(
749 "Settings Profiles",
750 zed_actions::settings_profile_selector::Toggle.boxed_clone(),
751 )
752 .action("Key Bindings", Box::new(zed_actions::OpenKeymapEditor))
753 .action(
754 "Themes…",
755 zed_actions::theme_selector::Toggle::default().boxed_clone(),
756 )
757 .action(
758 "Icon Themes…",
759 zed_actions::icon_theme_selector::Toggle::default().boxed_clone(),
760 )
761 .action(
762 "Extensions",
763 zed_actions::Extensions::default().boxed_clone(),
764 )
765 })
766 .into()
767 })
768 .trigger_with_tooltip(
769 IconButton::new("user-menu", IconName::ChevronDown).icon_size(IconSize::Small),
770 Tooltip::text("Toggle User Menu"),
771 )
772 }
773 }
774}