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