From 1b75f9d62035601c5e00be5c51454c9e1ef48102 Mon Sep 17 00:00:00 2001 From: David Baldwin Date: Thu, 18 Apr 2024 03:14:06 -0400 Subject: [PATCH] Add a setting to show/hide the project panel button in the status bar (#10707) ### What? A setting has been added to control the visibility of the Project Panel button in the status bar. ### Why? I don't tend to use the Project Panel, but use a keyboard shortcut to access if needed. Thus, the button in the status bar provides me little more than visual clutter. Additionally, there is precedent for this configurability with other panels (collaboration, chat, notification, terminal, etc). Release Notes: - Added a setting to show/hide the Project Panel button in the status bar. `{"project_panel": {"button": false}}` --- assets/settings/default.json | 2 ++ crates/project_panel/src/project_panel.rs | 6 ++++-- crates/project_panel/src/project_panel_settings.rs | 5 +++++ docs/src/configuring_zed.md | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 0f20e7d629bbd06b27fc3dea0ef1b9ffc15ef29a..ee50d43670ccf5da538404da34adc2616581d33a 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -212,6 +212,8 @@ "scroll_debounce_ms": 50 }, "project_panel": { + // Whether to show the project panel button in the status bar + "button": true, // Default width of the project panel. "default_width": 240, // Where to dock the project panel. Can be 'left' or 'right'. diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 837e563b1c464af6f7cdd20662513c4edaed229b..830f0226072bbffae790d794193d08f22273a51c 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1899,8 +1899,10 @@ impl Panel for ProjectPanel { cx.notify(); } - fn icon(&self, _: &WindowContext) -> Option { - Some(ui::IconName::FileTree) + fn icon(&self, cx: &WindowContext) -> Option { + ProjectPanelSettings::get_global(cx) + .button + .then(|| IconName::FileTree) } fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> { diff --git a/crates/project_panel/src/project_panel_settings.rs b/crates/project_panel/src/project_panel_settings.rs index 500f33be411c6708c9db3decb5812b3b787c95c0..0a41c6ea6c533f3dac72c7bcdd469747d1533fed 100644 --- a/crates/project_panel/src/project_panel_settings.rs +++ b/crates/project_panel/src/project_panel_settings.rs @@ -13,6 +13,7 @@ pub enum ProjectPanelDockPosition { #[derive(Deserialize, Debug, Clone, Copy, PartialEq)] pub struct ProjectPanelSettings { + pub button: bool, pub default_width: Pixels, pub dock: ProjectPanelDockPosition, pub file_icons: bool, @@ -25,6 +26,10 @@ pub struct ProjectPanelSettings { #[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)] pub struct ProjectPanelSettingsContent { + /// Whether to show the project panel button in the status bar. + /// + /// Default: true + pub button: Option, /// Customise default width (in pixels) taken by project panel /// /// Default: 240 diff --git a/docs/src/configuring_zed.md b/docs/src/configuring_zed.md index 23a4c1040ad88f58b6fcbaedfe0ce2d8cd6650af..c3393e1d236415239cca8866408b461ec33f7a28 100644 --- a/docs/src/configuring_zed.md +++ b/docs/src/configuring_zed.md @@ -1294,6 +1294,7 @@ Run the `theme selector: toggle` action in the command palette to see a current ```json "project_panel": { + "button": true, "dock": "left", "git_status": true, "default_width": "N/A - width in pixels"