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.

Sidebar: HyperDownload can be pinned to the top

Alpha Malick DIAWARA38ce7a385219
diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rs
index 05fce578..96d43032 100644
--- a/crates/rf-app/src/settings.rs
+++ b/crates/rf-app/src/settings.rs
@@ -1071,6 +1071,8 @@ pub struct Settings {
/// The thumbnail cache's limit in MB (the cache is in memory); `None` = the default, 64 MB, and no key in the file.
pub thumb_cache_mb: Option<u32>,
pub show_libraries: bool,
+ /// HyperDownload's row stands with the pinned folders, at the top of the sidebar, instead of above the Recycle Bin.
+ pub hd_pinned_top: bool,
/// Each drive in the sidebar says how much of it is used, in numbers ("238 GB / 500 GB"), under its bar. Issue 167.
pub sidebar_drive_space: bool,
/// A "Klasörler" section in the sidebar: the folder tree (drives and the profile folder as roots). Off by default.
@@ -1532,6 +1534,7 @@ impl Default for Settings {
transfer_progress: TransferProgress::StatusBar,
thumb_cache_mb: None,
show_libraries: false,
+ hd_pinned_top: false,
sidebar_drive_space: false,
sidebar_tree: false,
sidebar_tree_follow: true,
diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rs
index 47e1207d..2df2bff1 100644
--- a/crates/rf-app/src/workspace.rs
+++ b/crates/rf-app/src/workspace.rs
@@ -3206,6 +3206,40 @@ impl Workspace {
);
}
+ /// Right-click on HyperDownload's sidebar row (it is a page of the add-on, not a folder): pin it to the top, or put it back.
+ fn hd_menu(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ use crate::fluent_menu::{Item, Menu, MenuIcon};
+ let top = cx.global::<crate::settings::Settings>().hd_pinned_top;
+ let me = cx.entity().downgrade();
+ let items = vec![
+ Item::action(t!("Aç"), MenuIcon::Lucide(L::SquareArrowOutUpRight), {
+ let me = me.clone();
+ move |w: &mut Window, cx: &mut App| {
+ let _ = me.update(cx, |ws, cx| ws.navigate(Location::Downloads, w, cx));
+ }
+ }),
+ Item::action(t!("Yeni sekmede aç"), MenuIcon::Lucide(L::SquarePlus), {
+ let me = me.clone();
+ move |w: &mut Window, cx: &mut App| {
+ let _ = me.update(cx, |ws, cx| {
+ let keep = ws.active;
+ ws.open_tab(Location::Downloads, w, cx);
+ if !cx.global::<crate::settings::Settings>().focus_new_tab {
+ ws.activate(keep, w, cx);
+ }
+ });
+ }
+ }),
+ Item::Separator,
+ if top {
+ Item::action(t!("Kenar çubuğundan kaldır"), MenuIcon::Lucide(L::PinOff), |_, cx: &mut App| crate::settings::update(cx, |s| s.hd_pinned_top = false))
+ } else {
+ Item::action(t!("Kenar çubuğuna sabitle"), MenuIcon::Lucide(L::Pin), |_, cx: &mut App| crate::settings::update(cx, |s| s.hd_pinned_top = true))
+ },
+ ];
+ crate::fluent_menu::show_context(Menu { quick: Vec::new(), items }, window.mouse_position(), window, cx);
+ }
+
/// Right-click on a sidebar folder/drive: the Explorer menu (eject, properties, format…)
/// plus open in new tab/window and pin/unpin.
fn sidebar_menu(&mut self, path: PathBuf, window: &mut Window, cx: &mut Context<Self>) {
@@ -4782,6 +4816,15 @@ impl Workspace {
}),
)
})
+ .when(matches!(target3, Location::Downloads), |d| {
+ d.on_mouse_down(
+ MouseButton::Right,
+ cx.listener(|this, _: &MouseDownEvent, window, cx| {
+ cx.stop_propagation();
+ this.hd_menu(window, cx);
+ }),
+ )
+ })
.on_mouse_down(
MouseButton::Middle,
cx.listener(move |this, _: &MouseDownEvent, window, cx| {
@@ -4997,6 +5040,7 @@ impl Workspace {
})),
);
let accent = p.accent;
+ let hd_top = self.hd_installed && cx.global::<crate::settings::Settings>().hd_pinned_top;
// the open folder is already a selected row of the sidebar (a pinned folder or a drive): the tree draws no second selection
let mut shown_elsewhere = pinned.iter().any(|f| cur == Location::Path(f.path.clone()));
let labels = {
@@ -5027,6 +5071,22 @@ impl Workspace {
.child(item),
);
}
+ // HyperDownload, when the user pinned it: right under the pinned folders
+ if hd_top {
+ head = head.child(self.sidebar_item(
+ "sb-downloads".into(),
+ L::ArrowDownToLine,
+ crate::downloads_view::ember(),
+ "HyperDownload".into(),
+ Location::Downloads,
+ cur == Location::Downloads,
+ false,
+ None,
+ p,
+ cx,
+ &["folder-downloads", "user-downloads"],
+ ));
+ }
// (the narrow rail has no header to say it in: there the row stays)
if ext_drag && rail {
head = head.child(
@@ -5242,7 +5302,7 @@ impl Workspace {
}
col = col.child(div().h_2().when(explorer_look, |d| d.flex_shrink_0()));
// HyperDownload's page, when the add-on is installed (above the Recycle Bin)
- if self.hd_installed {
+ if self.hd_installed && !hd_top {
col = col.child(self.sidebar_item(
"sb-downloads".into(),
L::ArrowDownToLine,