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.

Pins of the same name show their parent folder; drive cards show % used

gelenmedyab9ada1423fde
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index 5b18f417..b99aeddb 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -6873,6 +6873,10 @@ impl FolderView {
// equal-width columns: a card alone on the last row is as wide as the others
let avail = f32::from(self.content_width) - 48.; // p_6 on both sides
let mut pinned_grid = div().grid().grid_cols(tile_cols(avail, 140., 220., 12.)).gap_3();
+ let labels = {
+ let named: Vec<(String, &std::path::Path)> = pinned.iter().map(|f| (crate::i18n::td(&f.title), f.path.as_path())).collect();
+ crate::places::pin_labels(&named)
+ };
for (i, f) in pinned.into_iter().enumerate() {
let path = f.path.clone();
let menu_path = f.path.clone();
@@ -6889,7 +6893,7 @@ impl FolderView {
pinned_grid = pinned_grid.child(
card(("pin", i).into())
.child(home_icon(picture.or(shell_icon), f.icon, 28., (!windows_file_explorer_theme).then_some(p.accent)))
- .child(div().text_sm().child(crate::i18n::td(&f.title)))
+ .child(div().text_sm().child(labels[i].clone()))
.on_click(cx.listener(move |this, _, _, cx| this.navigate(Location::Path(path.clone()), cx)))
// the sidebar's menu for the folder (Open in a new tab, Remove from the sidebar, …), as the drive tiles have it
// (a Discord report: Quick access items had no right-click menu)
@@ -6937,11 +6941,15 @@ impl FolderView {
.bg(p.pressed)
.child(div().h_full().rounded_full().bg(bar_color).w(relative(frac))),
)
- .child(div().text_xs().text_color(p.text_secondary).child(if d.total > 0 {
- format!("{} {} / {}", format::size(d.free), t!("boş"), format::size(d.total))
- } else {
- String::new()
- })),
+ // free of total, and how full in per cent at the right (a Discord request: the card had room for it)
+ .child(
+ h_flex()
+ .justify_between()
+ .text_xs()
+ .text_color(p.text_secondary)
+ .child(if d.total > 0 { format!("{} {} / {}", format::size(d.free), t!("boş"), format::size(d.total)) } else { String::new() })
+ .when(d.total > 0, |r| r.child(format!("{}%", (frac * 100.).round() as u32))),
+ ),
)
// where the space goes, as its own tab (the card itself opens the drive)
.child(
diff --git a/crates/rf-app/src/places.rs b/crates/rf-app/src/places.rs
index 1096e56d..47a6a3b3 100644
--- a/crates/rf-app/src/places.rs
+++ b/crates/rf-app/src/places.rs
@@ -41,6 +41,34 @@ pub fn set_drive_place_icon(path: std::path::PathBuf, key: &'static str, cx: &mu
}
/// Drive display name with the generic fallback labels translated ("Yerel Disk (C:)").
+/// The names pinned folders are shown with: a name two or more of them share gets its parent folder after it ("work (Clients)",
+/// "work (Projects)"), so that each says where it is (a Discord report: two pins named "work" could not be told apart).
+pub fn pin_labels(pins: &[(String, &std::path::Path)]) -> Vec<String> {
+ pins.iter()
+ .map(|(title, path)| {
+ let shared = pins.iter().filter(|(t, _)| t == title).count() > 1;
+ match path.parent().and_then(|p| p.file_name()).filter(|_| shared) {
+ Some(parent) => format!("{title} ({})", parent.to_string_lossy()),
+ None => title.clone(),
+ }
+ })
+ .collect()
+}
+
+#[cfg(test)]
+mod pin_label_tests {
+ use std::path::Path;
+
+ #[test]
+ fn only_names_shared_by_two_pins_get_their_parent() {
+ let pins = [("work".to_string(), Path::new(r"C:\Clients\work")), ("work".to_string(), Path::new(r"D:\Projects\work")), ("Music".to_string(), Path::new(r"C:\Users\a\Music"))];
+ assert_eq!(super::pin_labels(&pins), ["work (Clients)", "work (Projects)", "Music"]);
+ // a drive's root has no parent to name
+ let roots = [("D:".to_string(), Path::new(r"D:\")), ("D:".to_string(), Path::new(r"D:\"))];
+ assert_eq!(super::pin_labels(&roots), ["D:", "D:"]);
+ }
+}
+
pub fn drive_name(d: &Drive) -> String {
if d.label.is_empty() {
let kind = match d.kind {
diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rs
index 916d48bd..83bfff7c 100644
--- a/crates/rf-app/src/workspace.rs
+++ b/crates/rf-app/src/workspace.rs
@@ -4839,10 +4839,14 @@ impl Workspace {
let accent = p.accent;
// 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 = {
+ let named: Vec<(String, &std::path::Path)> = pinned.iter().map(|f| (crate::i18n::td(&f.title), f.path.as_path())).collect();
+ crate::places::pin_labels(&named)
+ };
for (i, f) in pinned.into_iter().enumerate() {
let loc = Location::Path(f.path.clone());
let active = cur == loc;
- let title = crate::i18n::td(&f.title);
+ let title = labels[i].clone();
let drag = PinDrag { ix: i, path: f.path.clone(), title: title.clone().into() };
let target_path = f.path.clone();
let item = self.sidebar_item(("sb-pin", i).into(), f.icon, p.accent, title, loc, active, true, None, p, cx, crate::icon_theme::FOLDER_NAMES);