Make all status bar tools able to hide its button via UI (#54971)
Closes https://github.com/zed-industries/zed/discussions/53471 Adds a requirement on status bar items to provide a way to hide themselves. <img width="329" height="153" alt="image" src="https://github.com/user-attachments/assets/b98ee5ba-a439-44d7-9ab5-f4511b66a574" /> <img width="464" height="40" alt="image" src="https://github.com/user-attachments/assets/b41d9189-3475-4e61-b3a4-bc731dd52c53" /> Release Notes: - Added a way to hide sidebar buttons
This commit is contained in:
1 parent
b270b1d63d
commit
c049193fd9
24 files changed
+292
-35
No files matched your search
@@ -3,13 +3,13 @@ use crate::{EncodingSelector, Toggle};
|
||||
use editor::Editor;
|
||||
use encoding_rs::{Encoding, UTF_8};
|
||||
use gpui::{
|
||||
Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window,
|
||||
div,
|
||||
App, Context, Entity, IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity,
|
||||
Window, div,
|
||||
};
|
||||
use project::Project;
|
||||
use ui::{Button, ButtonCommon, Clickable, LabelSize, Tooltip};
|
||||
use workspace::{
|
||||
StatusBarSettings, StatusItemView, Workspace,
|
||||
EncodingDisplayOptions, HideStatusItem, StatusBarSettings, StatusItemView, Workspace,
|
||||
item::{ItemHandle, Settings},
|
||||
};
|
||||
|
||||
@@ -131,4 +131,13 @@ impl StatusItemView for ActiveBufferEncoding {
|
||||
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn hide_setting(&self, _: &App) -> Option<HideStatusItem> {
|
||||
Some(HideStatusItem::new(|settings| {
|
||||
settings
|
||||
.status_bar
|
||||
.get_or_insert_default()
|
||||
.active_encoding_button = Some(EncodingDisplayOptions::Disabled);
|
||||
}))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user