Repository: flxzt/rnote (language: rust)

Issue:
Option to open Workspace in file manager
**Problem**

The Workspace file browser doesn't have much features like searching, renaming etc.

**Suggested solution**

Add an option to open the Workspace in the default file manager. I think this option is useful even if you add searching, renaming etc. features in the app.

**Optional**

You may add the option in the red marked location or wherever you find good.

**Additional context**

![image](https://github.com/flxzt/rnote/assets/121625152/b3ac22f2-d115-4645-86e9-8b3f3ce75bd4)



Discussion / hints:
Do you want to rename the workspace or a file/folder in the workspace? Because there is an option for both. You can rename files and folders from the the three dots menu (or open them in the default app):
![image](https://github.com/flxzt/rnote/assets/128063006/4f59ef46-2674-4ce2-a746-a3deac983869)

And you can edit workspaces by pressing on the pen in the bottom right:
![image](https://github.com/flxzt/rnote/assets/128063006/db29517b-bc34-418e-a890-0347e57e8cc0)

The appropriate place to add the ability to open the workspace location with the default file manager would be an additional action in the folder-actions menu (the one that can be opened with the folder-three-dots button)
Sounds good.

But I have a suggestion. Because there will be just two actions, why not directly add two icons for two actions reducing clicks. Decision is up to you.
I'd prefer it to be in the menu, that's the intended place for such additions
Okay, no problem.

Fix patch:
diff --git a/crates/rnote-ui/data/ui/workspacebrowser.ui b/crates/rnote-ui/data/ui/workspacebrowser.ui
index a952af41fd..c0d91e6e21 100644
--- a/crates/rnote-ui/data/ui/workspacebrowser.ui
+++ b/crates/rnote-ui/data/ui/workspacebrowser.ui
@@ -163,6 +163,10 @@
             <attribute name="label" translatable="yes">Create new Folder</attribute>
             <attribute name="action">workspacebrowser.create-folder</attribute>
           </item>
+          <item>
+            <attribute name="label" translatable="yes">Open Workspace Folder</attribute>
+            <attribute name="action">workspacebrowser.open-folder</attribute>
+          </item>
         </section>
       </menu>
     </object>
diff --git a/crates/rnote-ui/src/workspacebrowser/mod.rs b/crates/rnote-ui/src/workspacebrowser/mod.rs
index b35ea1ef62..5f7aa8540d 100644
--- a/crates/rnote-ui/src/workspacebrowser/mod.rs
+++ b/crates/rnote-ui/src/workspacebrowser/mod.rs
@@ -195,6 +195,9 @@ impl RnWorkspaceBrowser {
         self.imp()
             .action_group
             .add_action(&workspaceactions::create_folder(self, appwindow));
+        self.imp()
+            .action_group
+            .add_action(&workspaceactions::open_folder(self, appwindow));
     }
 
     fn setup_dir_controls(&self, _appwindow: &RnAppWindow) {
diff --git a/crates/rnote-ui/src/workspacebrowser/workspaceactions/mod.rs b/crates/rnote-ui/src/workspacebrowser/workspaceactions/mod.rs
index d5c77d7e63..a0799af398 100644
--- a/crates/rnote-ui/src/workspacebrowser/workspaceactions/mod.rs
+++ b/crates/rnote-ui/src/workspacebrowser/workspaceactions/mod.rs
@@ -1,5 +1,7 @@
 // Modules
 mod createfolder;
+mod openfolder;
 
 // Re-exports
 pub(crate) use createfolder::create_folder;
+pub(crate) use openfolder::open_folder;
diff --git a/crates/rnote-ui/src/workspacebrowser/workspaceactions/openfolder.rs b/crates/rnote-ui/src/workspacebrowser/workspaceactions/openfolder.rs
new file mode 100644
index 0000000000..dd7ccf9bdc
--- /dev/null
+++ b/crates/rnote-ui/src/workspacebrowser/workspaceactions/openfolder.rs
@@ -0,0 +1,31 @@
+use crate::{RnAppWindow, RnWorkspaceBrowser};
+use gettextrs::gettext;
+use gtk4::{gio, glib, glib::clone, prelude::*};
+
+pub(crate) fn open_folder(
+    workspacebrowser: &RnWorkspaceBrowser,
+    appwindow: &RnAppWindow,
+) -> gio::SimpleAction {
+    let open_folder_action = gio::SimpleAction::new("open-folder", None);
+
+    open_folder_action.connect_activate(clone!(
+        #[weak]
+        workspacebrowser,
+        #[weak]
+        appwindow,
+        move |_, _| {
+        if let Some(parent_path) = workspacebrowser.dir_list_file().and_then(|f| f.path()) {
+            if let Err(e) = open::that(&parent_path) {
+                let path_string =   &parent_path.into_os_string().into_string().ok().unwrap_or(String::from("Failed to get the path of the workspace folder"));
+                tracing::error!("Opening the parent folder '{path_string}' in the file manager failed, Err: {e:?}");
+                appwindow.overlays().dispatch_toast_error(&gettext("Failed to open the file in the file manager"));
+            }
+        } else {
+            tracing::warn!("No path found");
+            appwindow.overlays().dispatch_toast_error(&gettext("Failed to open the file in the file manager"));
+        }
+    }
+    ));
+
+    open_folder_action
+}


Test patch: