Add setting to hide onboarding banners (#29709)

Closes #28637 aka #29219.

Release Notes:

- Added `workspace.title_bar.show_onboarding_banner` preference to hide
onboarding banners.
- Relocated `workspace.show_user_picture` preference to
`workspace.title_bar.show_user_picture`.
This commit is contained in:
anteater 2025-05-06 18:54:09 +00:00 committed by GitHub
parent c92b2e31e1
commit bd11bb5409
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 11 deletions

View file

@ -310,7 +310,11 @@
// Titlebar related settings // Titlebar related settings
"title_bar": { "title_bar": {
// Whether to show the branch icon beside branch switcher in the titlebar. // Whether to show the branch icon beside branch switcher in the titlebar.
"show_branch_icon": false "show_branch_icon": false,
// Whether to show onboarding banners in the titlebar.
"show_onboarding_banner": true,
// Whether to show user picture in the titlebar.
"show_user_picture": true
}, },
// Scrollbar related settings // Scrollbar related settings
"scrollbar": { "scrollbar": {
@ -1606,8 +1610,6 @@
// "W": "workspace::Save" // "W": "workspace::Save"
// } // }
"command_aliases": {}, "command_aliases": {},
// Whether to show user picture in titlebar.
"show_user_picture": true,
// ssh_connections is an array of ssh connections. // ssh_connections is an array of ssh connections.
// You can configure these from `project: Open Remote` in the command palette. // You can configure these from `project: Open Remote` in the command palette.
// Zed's ssh support will pull configuration from your ~/.ssh too. // Zed's ssh support will pull configuration from your ~/.ssh too.

View file

@ -208,7 +208,10 @@ impl Render for TitleBar {
.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()), .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()),
) )
.child(self.render_collaborator_list(window, cx)) .child(self.render_collaborator_list(window, cx))
.child(self.banner.clone()) .when(
TitleBarSettings::get_global(cx).show_onboarding_banner,
|title_bar| title_bar.child(self.banner.clone()),
)
.child( .child(
h_flex() h_flex()
.gap_1() .gap_1()
@ -723,7 +726,7 @@ impl TitleBar {
h_flex() h_flex()
.gap_0p5() .gap_0p5()
.children( .children(
workspace::WorkspaceSettings::get_global(cx) TitleBarSettings::get_global(cx)
.show_user_picture .show_user_picture
.then(|| Avatar::new(user.avatar_uri.clone())), .then(|| Avatar::new(user.avatar_uri.clone())),
) )

View file

@ -6,6 +6,8 @@ use settings::{Settings, SettingsSources};
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)] #[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
pub struct TitleBarSettings { pub struct TitleBarSettings {
pub show_branch_icon: bool, pub show_branch_icon: bool,
pub show_onboarding_banner: bool,
pub show_user_picture: bool,
} }
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)] #[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
@ -14,6 +16,14 @@ pub struct TitleBarSettingsContent {
/// ///
/// Default: false /// Default: false
pub show_branch_icon: Option<bool>, pub show_branch_icon: Option<bool>,
/// Whether to show onboarding banners in the title bar.
///
/// Default: true
pub show_onboarding_banner: Option<bool>,
/// Whether to show user avatar in the title bar.
///
/// Default: true
pub show_user_picture: Option<bool>,
} }
impl Settings for TitleBarSettings { impl Settings for TitleBarSettings {

View file

@ -23,7 +23,6 @@ pub struct WorkspaceSettings {
pub use_system_path_prompts: bool, pub use_system_path_prompts: bool,
pub use_system_prompts: bool, pub use_system_prompts: bool,
pub command_aliases: HashMap<String, String>, pub command_aliases: HashMap<String, String>,
pub show_user_picture: bool,
pub max_tabs: Option<NonZeroUsize>, pub max_tabs: Option<NonZeroUsize>,
pub when_closing_with_no_tabs: CloseWindowWhenNoItems, pub when_closing_with_no_tabs: CloseWindowWhenNoItems,
pub on_last_window_closed: OnLastWindowClosed, pub on_last_window_closed: OnLastWindowClosed,
@ -189,10 +188,6 @@ pub struct WorkspaceSettingsContent {
/// ///
/// Default: true /// Default: true
pub command_aliases: Option<HashMap<String, String>>, pub command_aliases: Option<HashMap<String, String>>,
/// Whether to show user avatar in the title bar.
///
/// Default: true
pub show_user_picture: Option<bool>,
/// Maximum open tabs in a pane. Will not close an unsaved /// Maximum open tabs in a pane. Will not close an unsaved
/// tab. Set to `None` for unlimited tabs. /// tab. Set to `None` for unlimited tabs.
/// ///