Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add setting to hide user menu in the title bar (#44466)
Jake Goa61c14cf3b30
diff --git a/assets/settings/default.json b/assets/settings/default.jsonindex 2bca46cc383..146915dd1a2 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.rsindex 743e22b04d9..ba349b865bf 100644--- a/crates/settings/src/settings_content.rs+++ b/crates/settings/src/settings_content.rs@@ -286,6 +286,10 @@ pub struct TitleBarSettingsContent {////// Default: truepub show_sign_in: Option<bool>,+ /// Whether to show the user menu button in the title bar.+ ///+ /// Default: true+ pub show_user_menu: Option<bool>,/// Whether to show the menus in the title bar.////// Default: falsediff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rsindex b03ce327877..79fc1cc1115 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<SettingsPage> {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.rsindex bd606e4a021..5bd47d02691 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<Self>) -> impl Element {+ pub fn render_user_menu_button(&mut self, cx: &mut Context<Self>) -> 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.rsindex 29fae4d31eb..155b7b7bc79 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.mdindex 477885a4537..76c0b528fa1 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 titlebardiff --git a/docs/src/visual-customization.md b/docs/src/visual-customization.mdindex e5185719279..234776b1d32 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},