Repository: lapce/lapce (language: rust)

Issue:
Allow completely hiding the "Open Editors" Panel
Hey !

It would be great to be able to show/hide this panel via a configuration flag : 

![2023-03-21_16-27](https://user-images.githubusercontent.com/3624853/226655979-4d31f9e1-1406-4f9a-91e1-e6c9ad5cdd5b.png)

IMHO, its usefulness is quite limited, given that the files are already shown in the tabs over the editors. And in my case, it's an annoyance to have, even if it can be folded. It still takes some space, and sometimes opens automatically for some reason.

I think the idea to have it comes form VSCode/ium. But even there, it's possible to hide any of the panel on the left side, by clicking on the 3 dots : 

![2023-03-21_16-31](https://user-images.githubusercontent.com/3624853/226656865-4cfba7d5-2953-4333-ac81-b99d254aa7be.png)

Cheers ! 


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d9584c5671..45953e6d45 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
 - [#3053](https://github.com/lapce/lapce/pull/3053): Add tooltips to various places
 - [#3069](https://github.com/lapce/lapce/pull/3069): Allow color variables for themes
 - [#3086](https://github.com/lapce/lapce/pull/3086): Add folding to panels
+- [#3095](https://github.com/lapce/lapce/pull/3095): Add option to hide the Open Editors section in the explorer
 
 ### Bug Fixes
 - [#2779](https://github.com/lapce/lapce/pull/2779): Fix files detection on fresh git/VCS repository
diff --git a/defaults/settings.toml b/defaults/settings.toml
index 20d1d4c907..fbe2fcf4c1 100644
--- a/defaults/settings.toml
+++ b/defaults/settings.toml
@@ -89,3 +89,4 @@ hover-font-size = 0
 trim-search-results-whitespace = true
 list-line-height = 25
 tab-close-button = "Right"
+open-editors-visible = true
diff --git a/lapce-app/src/config/ui.rs b/lapce-app/src/config/ui.rs
index 3512923163..1f175fbd5b 100644
--- a/lapce-app/src/config/ui.rs
+++ b/lapce-app/src/config/ui.rs
@@ -51,6 +51,9 @@ pub struct UIConfig {
 
     #[field_names(desc = "Set position of the close button in editor tabs")]
     pub tab_close_button: TabCloseButton,
+
+    #[field_names(desc = "Display the Open Editors section in the explorer")]
+    pub open_editors_visible: bool,
 }
 
 #[derive(
diff --git a/lapce-app/src/file_explorer/view.rs b/lapce-app/src/file_explorer/view.rs
index 458c188fbc..ec171b216c 100644
--- a/lapce-app/src/file_explorer/view.rs
+++ b/lapce-app/src/file_explorer/view.rs
@@ -68,11 +68,12 @@ pub fn file_explorer_panel(
     let config = window_tab_data.common.config;
     let data = window_tab_data.file_explorer.clone();
     PanelBuilder::new(config, position)
-        .add_height(
+        .add_height_style(
             "Open Editors",
             150.0,
             container(open_editors_view(window_tab_data.clone()))
                 .style(|s| s.size_full()),
+            move |s| s.apply_if(!config.get().ui.open_editors_visible, Style::hide),
         )
         .add(
             "File Explorer",
diff --git a/lapce-app/src/panel/view.rs b/lapce-app/src/panel/view.rs
index a4d2cf2c3b..4f99d81f18 100644
--- a/lapce-app/src/panel/view.rs
+++ b/lapce-app/src/panel/view.rs
@@ -151,6 +151,18 @@ impl PanelBuilder {
         self.add_general(name, Some(height.into()), view, std::convert::identity)
     }
 
+    /// Add a view to the panel with a custom height that is only used when the panel is open
+    /// and a custom style applied to the overall header+section-content
+    pub fn add_height_style(
+        self,
+        name: &'static str,
+        height: impl Into<PxPctAuto>,
+        view: impl View + 'static,
+        style: impl Fn(Style) -> Style + 'static,
+    ) -> Self {
+        self.add_general(name, Some(height.into()), view, style)
+    }
+
     /// Add a view to the panel with a custom height that is only used when the panel is open
     pub fn add_height_pct(
         self,


Test patch: