Allow to hide more buttons with the settings (#30565)
* project search button in the status bar ```jsonc "search": { "button": false }, ``` * project diagnostics button in the status bar ```jsonc "diagnostics": { "button": false } ``` * project name and host buttons in the title bar ```jsonc "title_bar": { "show_project_items": false } ``` * git branch button in the title bar ```jsonc "title_bar": { "show_branch_name": false } ``` Before: <img width="1728" alt="before" src="https://github.com/user-attachments/assets/4b13b431-3ac1-43b3-8ac7-469e5a9ccf7e" /> After: <img width="1728" alt="after" src="https://github.com/user-attachments/assets/baf2765a-e27b-47a3-8897-89152b7a7c95" /> Release Notes: - Added more settings to hide buttons from Zed UI
This commit is contained in:
parent
a6c3d49bb9
commit
a3105c92a4
8 changed files with 76 additions and 20 deletions
|
@ -128,6 +128,7 @@ pub struct TitleBar {
|
|||
|
||||
impl Render for TitleBar {
|
||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let title_bar_settings = *TitleBarSettings::get_global(cx);
|
||||
let close_action = Box::new(workspace::CloseWindow);
|
||||
let height = Self::height(window);
|
||||
let supported_controls = window.window_controls();
|
||||
|
@ -191,26 +192,38 @@ impl Render for TitleBar {
|
|||
h_flex()
|
||||
.gap_1()
|
||||
.map(|title_bar| {
|
||||
let mut render_project_items = true;
|
||||
let mut render_project_items = title_bar_settings.show_branch_name
|
||||
|| title_bar_settings.show_project_items;
|
||||
title_bar
|
||||
.when_some(self.application_menu.clone(), |title_bar, menu| {
|
||||
render_project_items = !menu.read(cx).all_menus_shown();
|
||||
render_project_items &= !menu.read(cx).all_menus_shown();
|
||||
title_bar.child(menu)
|
||||
})
|
||||
.when(render_project_items, |title_bar| {
|
||||
title_bar
|
||||
.children(self.render_project_host(cx))
|
||||
.child(self.render_project_name(cx))
|
||||
.children(self.render_project_branch(cx))
|
||||
.when(
|
||||
title_bar_settings.show_project_items,
|
||||
|title_bar| {
|
||||
title_bar
|
||||
.children(self.render_project_host(cx))
|
||||
.child(self.render_project_name(cx))
|
||||
},
|
||||
)
|
||||
.when(
|
||||
title_bar_settings.show_branch_name,
|
||||
|title_bar| {
|
||||
title_bar
|
||||
.children(self.render_project_branch(cx))
|
||||
},
|
||||
)
|
||||
})
|
||||
})
|
||||
.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()),
|
||||
)
|
||||
.child(self.render_collaborator_list(window, cx))
|
||||
.when(
|
||||
TitleBarSettings::get_global(cx).show_onboarding_banner,
|
||||
|title_bar| title_bar.child(self.banner.clone()),
|
||||
)
|
||||
.when(title_bar_settings.show_onboarding_banner, |title_bar| {
|
||||
title_bar.child(self.banner.clone())
|
||||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
|
|
|
@ -2,11 +2,19 @@ use db::anyhow;
|
|||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::{Settings, SettingsSources};
|
||||
use util::serde::default_true;
|
||||
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct TitleBarSettings {
|
||||
#[serde(default)]
|
||||
pub show_branch_icon: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub show_branch_name: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub show_project_items: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub show_onboarding_banner: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub show_user_picture: bool,
|
||||
}
|
||||
|
||||
|
@ -24,6 +32,14 @@ pub struct TitleBarSettingsContent {
|
|||
///
|
||||
/// Default: true
|
||||
pub show_user_picture: Option<bool>,
|
||||
/// Whether to show the branch name button in the titlebar.
|
||||
///
|
||||
/// Default: true
|
||||
pub show_branch_name: Option<bool>,
|
||||
/// Whether to show the project host and name in the titlebar.
|
||||
///
|
||||
/// Default: true
|
||||
pub show_project_items: Option<bool>,
|
||||
}
|
||||
|
||||
impl Settings for TitleBarSettings {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue