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}}`
This commit is contained in:
David Baldwin 2024-04-18 03:14:06 -04:00 committed by GitHub
parent 4c3178e7a8
commit 1b75f9d620
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 2 deletions

View file

@ -1899,8 +1899,10 @@ impl Panel for ProjectPanel {
cx.notify();
}
fn icon(&self, _: &WindowContext) -> Option<ui::IconName> {
Some(ui::IconName::FileTree)
fn icon(&self, cx: &WindowContext) -> Option<IconName> {
ProjectPanelSettings::get_global(cx)
.button
.then(|| IconName::FileTree)
}
fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {

View file

@ -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<bool>,
/// Customise default width (in pixels) taken by project panel
///
/// Default: 240