diff --git a/assets/settings/default.json b/assets/settings/default.json index 2bca46cc38334475c9ccb5ad7862afd9a2f7b9eb..146915dd1a242e2a8b70ba1010bb5fbe09dbbbbc 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -436,6 +436,8 @@ "show_onboarding_banner": true, // Whether to show user picture in the titlebar. "show_user_picture": true, + // Whether to show the user menu in the titlebar. + "show_user_menu": true, // Whether to show the sign in button in the titlebar. "show_sign_in": true, // Whether to show the menus in the titlebar. diff --git a/crates/settings/src/settings_content.rs b/crates/settings/src/settings_content.rs index 743e22b04d9cf87a0d09a73aef879c781a50cca2..ba349b865bf2ac4dfd9d19b22c5693307ebae20a 100644 --- a/crates/settings/src/settings_content.rs +++ b/crates/settings/src/settings_content.rs @@ -286,6 +286,10 @@ pub struct TitleBarSettingsContent { /// /// Default: true pub show_sign_in: Option, + /// Whether to show the user menu button in the title bar. + /// + /// Default: true + pub show_user_menu: Option, /// Whether to show the menus in the title bar. /// /// Default: false diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs index b03ce327877f7251d41c39ee1eed5d424c18ce84..79fc1cc11158399265a184a289fd8d7a71ce8d69 100644 --- a/crates/settings_ui/src/page_data.rs +++ b/crates/settings_ui/src/page_data.rs @@ -2913,40 +2913,58 @@ pub(crate) fn settings_data(cx: &App) -> Vec { files: USER, }), SettingsPageItem::SettingItem(SettingItem { - title: "Show User Picture", - description: "Show user picture in the titlebar.", + title: "Show Sign In", + description: "Show the sign in button in the titlebar.", field: Box::new(SettingField { - json_path: Some("title_bar.show_user_picture"), + json_path: Some("title_bar.show_sign_in"), pick: |settings_content| { + settings_content.title_bar.as_ref()?.show_sign_in.as_ref() + }, + write: |settings_content, value| { settings_content .title_bar - .as_ref()? - .show_user_picture - .as_ref() + .get_or_insert_default() + .show_sign_in = value; + }, + }), + metadata: None, + files: USER, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Show User Menu", + description: "Show the user menu button in the titlebar.", + field: Box::new(SettingField { + json_path: Some("title_bar.show_user_menu"), + pick: |settings_content| { + settings_content.title_bar.as_ref()?.show_user_menu.as_ref() }, write: |settings_content, value| { settings_content .title_bar .get_or_insert_default() - .show_user_picture = value; + .show_user_menu = value; }, }), metadata: None, files: USER, }), SettingsPageItem::SettingItem(SettingItem { - title: "Show Sign In", - description: "Show the sign in button in the titlebar.", + title: "Show User Picture", + description: "Show user picture in the titlebar.", field: Box::new(SettingField { - json_path: Some("title_bar.show_sign_in"), + json_path: Some("title_bar.show_user_picture"), pick: |settings_content| { - settings_content.title_bar.as_ref()?.show_sign_in.as_ref() + settings_content + .title_bar + .as_ref()? + .show_user_picture + .as_ref() }, write: |settings_content, value| { settings_content .title_bar .get_or_insert_default() - .show_sign_in = value; + .show_user_picture = value; }, }), metadata: None, diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index bd606e4a021eaad30b95322d785e23d694734c06..5bd47d02691c9a5c7fec968b5ea6e97265b956b2 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -202,9 +202,11 @@ impl Render for TitleBar { .children(self.render_connection_status(status, cx)) .when( user.is_none() && TitleBarSettings::get_global(cx).show_sign_in, - |el| el.child(self.render_sign_in_button(cx)), + |this| this.child(self.render_sign_in_button(cx)), ) - .child(self.render_app_menu_button(cx)) + .when(TitleBarSettings::get_global(cx).show_user_menu, |this| { + this.child(self.render_user_menu_button(cx)) + }) .into_any_element(), ); @@ -685,7 +687,7 @@ impl TitleBar { }) } - pub fn render_app_menu_button(&mut self, cx: &mut Context) -> impl Element { + pub fn render_user_menu_button(&mut self, cx: &mut Context) -> impl Element { let user_store = self.user_store.read(cx); let user = user_store.current_user(); diff --git a/crates/title_bar/src/title_bar_settings.rs b/crates/title_bar/src/title_bar_settings.rs index 29fae4d31eb33ac70a22c21010f09350847439c2..155b7b7bc797567927a70b12c677372cb92c9453 100644 --- a/crates/title_bar/src/title_bar_settings.rs +++ b/crates/title_bar/src/title_bar_settings.rs @@ -8,6 +8,7 @@ pub struct TitleBarSettings { pub show_branch_name: bool, pub show_project_items: bool, pub show_sign_in: bool, + pub show_user_menu: bool, pub show_menus: bool, } @@ -21,6 +22,7 @@ impl Settings for TitleBarSettings { show_branch_name: content.show_branch_name.unwrap(), show_project_items: content.show_project_items.unwrap(), show_sign_in: content.show_sign_in.unwrap(), + show_user_menu: content.show_user_menu.unwrap(), show_menus: content.show_menus.unwrap(), } } diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index 477885a4537580aaf562aa596c1a06cae1c65bc8..76c0b528fa106ae087297d3c9191ee70620116ba 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -4309,6 +4309,7 @@ Run the {#action theme_selector::Toggle} action in the command palette to see a "show_project_items": true, "show_onboarding_banner": true, "show_user_picture": true, + "show_user_menu": true, "show_sign_in": true, "show_menus": false } @@ -4321,6 +4322,7 @@ Run the {#action theme_selector::Toggle} action in the command palette to see a - `show_project_items`: Whether to show the project host and name in the titlebar - `show_onboarding_banner`: Whether to show onboarding banners in the titlebar - `show_user_picture`: Whether to show user picture in the titlebar +- `show_user_menu`: Whether to show the user menu button in the titlebar (the one that displays your avatar by default and contains options like Settings, Keymap, Themes, etc.) - `show_sign_in`: Whether to show the sign in button in the titlebar - `show_menus`: Whether to show the menus in the titlebar diff --git a/docs/src/visual-customization.md b/docs/src/visual-customization.md index e5185719279dde488c40573d94fd842c06860f4d..234776b1d3223a4b8634b42df1973a27c736616c 100644 --- a/docs/src/visual-customization.md +++ b/docs/src/visual-customization.md @@ -118,6 +118,7 @@ To disable this behavior use: "show_project_items": true, // Show/hide project host and name "show_onboarding_banner": true, // Show/hide onboarding banners "show_user_picture": true, // Show/hide user avatar + "show_user_menu": true, // Show/hide app user button "show_sign_in": true, // Show/hide sign-in button "show_menus": false // Show/hide menus },