title_bar_settings.rs

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