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:
Kirill Bulatov 2025-05-12 15:34:52 +02:00 committed by GitHub
parent a6c3d49bb9
commit a3105c92a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 76 additions and 20 deletions

View file

@ -6,6 +6,8 @@ use gpui::{
WeakEntity, Window,
};
use language::Diagnostic;
use project::project_settings::ProjectSettings;
use settings::Settings;
use ui::{Button, ButtonLike, Color, Icon, IconName, Label, Tooltip, h_flex, prelude::*};
use workspace::{StatusItemView, ToolbarItemEvent, Workspace, item::ItemHandle};
@ -22,6 +24,11 @@ pub struct DiagnosticIndicator {
impl Render for DiagnosticIndicator {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let indicator = h_flex().gap_2();
if !ProjectSettings::get_global(cx).diagnostics.button {
return indicator;
}
let diagnostic_indicator = match (self.summary.error_count, self.summary.warning_count) {
(0, 0) => h_flex().map(|this| {
this.child(
@ -84,8 +91,7 @@ impl Render for DiagnosticIndicator {
None
};
h_flex()
.gap_2()
indicator
.child(
ButtonLike::new("diagnostic-indicator")
.child(diagnostic_indicator)