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