1use db::anyhow;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4use settings::{Settings, SettingsSources};
5
6#[derive(Copy, Clone, Deserialize, Debug)]
7pub struct TitleBarSettings {
8 pub show_branch_icon: bool,
9 pub show_onboarding_banner: bool,
10 pub show_user_picture: bool,
11 pub show_branch_name: bool,
12 pub show_project_items: bool,
13}
14
15#[derive(Copy, Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
16pub struct TitleBarSettingsContent {
17 /// Whether to show the branch icon beside branch switcher in the title bar.
18 ///
19 /// Default: false
20 pub show_branch_icon: Option<bool>,
21 /// Whether to show onboarding banners in the title bar.
22 ///
23 /// Default: true
24 pub show_onboarding_banner: Option<bool>,
25 /// Whether to show user avatar in the title bar.
26 ///
27 /// Default: true
28 pub show_user_picture: Option<bool>,
29 /// Whether to show the branch name button in the titlebar.
30 ///
31 /// Default: true
32 pub show_branch_name: Option<bool>,
33 /// Whether to show the project host and name in the titlebar.
34 ///
35 /// Default: true
36 pub show_project_items: Option<bool>,
37}
38
39impl Settings for TitleBarSettings {
40 const KEY: Option<&'static str> = Some("title_bar");
41
42 type FileContent = TitleBarSettingsContent;
43
44 fn load(sources: SettingsSources<Self::FileContent>, _: &mut gpui::App) -> anyhow::Result<Self>
45 where
46 Self: Sized,
47 {
48 sources.json_merge()
49 }
50
51 fn import_from_vscode(_: &settings::VsCodeSettings, _: &mut Self::FileContent) {}
52}