Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Shift+wheel click opens a folder's tab the other way round

gelenmedya239a7898fe28
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index 0693ce63..38e1406f 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -351,6 +351,8 @@ pub enum FolderEvent {
OpenInNewTab(Location),
/// Open a folder in a new tab without switching to it, whatever the "switch to new tabs" setting says.
OpenInBackgroundTab(Location),
+ /// Open a folder in a new tab and switch to it, whatever that setting says.
+ OpenInFrontTab(Location),
/// Open the workspace's sidebar context menu for a Home drive card.
SidebarMenu(PathBuf),
BulkRename(Vec<PathBuf>),
@@ -1514,7 +1516,7 @@ impl FolderView {
MouseButton::Right,
cx.listener(move |this, _: &MouseDownEvent, window, cx| this.on_row_right_down(vi, None, window, cx)),
)
- .on_mouse_down(MouseButton::Middle, cx.listener(move |this, _: &MouseDownEvent, _, cx| this.middle_open(vi, cx)))
+ .on_mouse_down(MouseButton::Middle, cx.listener(move |this, ev: &MouseDownEvent, _, cx| this.middle_open(vi, ev.modifiers.shift, cx)))
.when_some(self.path_of(ei), |d, path| file_drop_target(d, path, is_dir, &p))
// (not while a menu is open: the details stood behind the right-click menu, a Discord report)
.when(item_tips, |d| d.tooltip(move |w, cx| {
@@ -4204,7 +4206,7 @@ impl FolderView {
MouseButton::Right,
cx.listener(move |this, ev: &MouseDownEvent, window, cx| this.on_row_right_down(vi, Some(ev.position), window, cx)),
)
- .on_mouse_down(MouseButton::Middle, cx.listener(move |this, _: &MouseDownEvent, _, cx| this.middle_open(vi, cx)))
+ .on_mouse_down(MouseButton::Middle, cx.listener(move |this, ev: &MouseDownEvent, _, cx| this.middle_open(vi, ev.modifiers.shift, cx)))
.when_some(self.path_of(ei), |d, path| file_drop_target(d, path, e.is_dir(), &p))
// (not while a menu is open: the details stood behind the right-click menu, a Discord report)
.when(item_tips, |d| d.tooltip(move |w, cx| {
@@ -5417,12 +5419,16 @@ impl FolderView {
}
}
- fn middle_open(&mut self, vi: usize, cx: &mut Context<Self>) {
+ /// A wheel click on a folder opens it in a new tab, in front or behind as Settings › "Always switch to a newly opened tab" says;
+ /// with Shift held, the other way this once, as in browsers (Discord, 2026-12-02: "a foreground tab instead ... no keyboard
+ /// modifier toggles this behavior on the fly").
+ fn middle_open(&mut self, vi: usize, shift: bool, cx: &mut Context<Self>) {
let Some(&ei) = self.visible.get(vi) else { return };
if self.entries[ei as usize].is_dir() {
if let Some(p) = self.path_of(ei) {
cx.stop_propagation();
- cx.emit(FolderEvent::OpenInNewTab(Location::Path(p)));
+ let front = cx.global::<crate::settings::Settings>().focus_new_tab != shift;
+ cx.emit(if front { FolderEvent::OpenInFrontTab(Location::Path(p)) } else { FolderEvent::OpenInBackgroundTab(Location::Path(p)) });
}
}
}
@@ -6453,7 +6459,7 @@ impl FolderView {
cx.listener(move |this, ev: &MouseDownEvent, window, cx| this.on_row_right_down(vi, Some(ev.position), window, cx)),
)
.when_some(self.path_of(ei), |d, path| file_drop_target(d, path, e.is_dir(), &p))
- .on_mouse_down(MouseButton::Middle, cx.listener(move |this, _: &MouseDownEvent, _, cx| this.middle_open(vi, cx)))
+ .on_mouse_down(MouseButton::Middle, cx.listener(move |this, ev: &MouseDownEvent, _, cx| this.middle_open(vi, ev.modifiers.shift, cx)))
.child(
h_flex()
.map(|d| match name_w {
diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rs
index c47f3d0c..445b1f70 100644
--- a/crates/rf-app/src/workspace.rs
+++ b/crates/rf-app/src/workspace.rs
@@ -1460,6 +1460,8 @@ impl Workspace {
this.open_tab(loc.clone(), window, cx);
this.activate(keep, window, cx);
}
+ // (and for the front: the new tab is the one shown)
+ FolderEvent::OpenInFrontTab(loc) => this.open_tab(loc.clone(), window, cx),
FolderEvent::OpenInNewWindow(loc) => {
let loc = loc.clone();
let mut b = window.bounds();