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