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.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
HyperDownload: a download folder of one's own, Show in folder in a tab, no stale speed graph
gelenmedya4c2515adca71
diff --git a/crates/rf-app/src/addons_page.rs b/crates/rf-app/src/addons_page.rsindex db241eda..32c85025 100644--- a/crates/rf-app/src/addons_page.rs+++ b/crates/rf-app/src/addons_page.rs@@ -139,6 +139,45 @@ fn open_url(url: String) {});}+/// HyperDownload's folder for what the browsers hand it (HyperDownload issues 1 and 3). The browser's helper reads it from+/// `host.json`, written again at each change, so it holds from the next download on.+fn download_folder_card(p: &Palette, cx: &mut App) -> AnyElement {+ let s = cx.global::<crate::settings::Settings>();+ let custom = !s.hd_downloads.trim().is_empty();+ let shown = crate::hyperdownload::download_folder(s).map(|d| d.display().to_string()).unwrap_or_default();+ card(+ p,+ L::FolderDown,+ t!("İndirme klasörü"),+ Some(shown.as_str()),+ h_flex()+ .gap_2()+ .children(custom.then(|| {+ button("hd-downloads-reset", p, t!("Varsayılan"), |_, cx| {+ crate::settings::update(cx, |s| s.hd_downloads.clear());+ crate::hyperdownload::register_host();+ })+ }))+ .child(button("hd-downloads", p, t!("Değiştir…"), |_, cx| {+ let (tx, rx) = futures::channel::oneshot::channel::<Option<std::path::PathBuf>>();+ let title = t!("İndirmelerin klasörünü seçin");+ rf_win::sta::run(move |owner| {+ let _ = tx.send(rf_win::dialogs::pick(owner, title, rf_win::dialogs::Pick::Folder));+ });+ cx.spawn(async move |cx| {+ if let Ok(Some(path)) = rx.await {+ let _ = cx.update(|cx| {+ crate::settings::update(cx, |s| s.hd_downloads = path.to_string_lossy().into_owned());+ crate::hyperdownload::register_host();+ });+ }+ })+ .detach();+ }))+ .into_any_element(),+ )+}+pub fn page(p: &Palette, cx: &mut App) -> Vec<AnyElement> {if state(cx).manifest.is_none() {load(cx);@@ -229,6 +268,9 @@ pub fn page(p: &Palette, cx: &mut App) -> Vec<AnyElement> {(None, None) => div().into_any_element(),};out.push(card(p, L::Download, &info.name, Some(&desc), control));+ if id == crate::hyperdownload::ID && have.is_some() {+ out.push(download_folder_card(p, cx));+ }let source = info.source.clone();if !source.is_empty() {out.push(diff --git a/crates/rf-app/src/downloads_view.rs b/crates/rf-app/src/downloads_view.rsindex e908014a..d9f0668b 100644--- a/crates/rf-app/src/downloads_view.rs+++ b/crates/rf-app/src/downloads_view.rs@@ -161,11 +161,19 @@ impl DownloadsView {let reload = this.update(cx, |v, cx| {v.rpc = rpc;let total: u64 = live.as_ref().map_or(0, |l| l.iter().map(|d| d.speed).sum());- v.speeds.push_back(total);+ // nothing downloading (all finished, cancelled or paused): the skyline goes, it does not stand on for a minute+ // as if something were still running (HyperDownload issue 3)+ let running = live.as_ref().is_some_and(|l| l.iter().any(|d| d.status == "active"));+ let emptied = !running && total == 0 && !v.speeds.is_empty();+ if running || total > 0 {+ v.speeds.push_back(total);+ } else {+ v.speeds.clear();+ }while v.speeds.len() > HISTORY {v.speeds.pop_front();}- if live != v.live || total > 0 {+ if live != v.live || total > 0 || emptied {v.live = live;cx.notify();}@@ -529,7 +537,7 @@ fn done_row(i: usize, e: &Entry, there: bool, p: &Palette) -> AnyElement {.gap_1().when(there, |d| {d.child(icon_button(("dl-show", i), L::FolderOpen, t!("Klasörde göster"), p).on_click(move |_, _, cx| {- crate::workspace::route_ipc(format!("{}{}", crate::workspace::SELECT_PREFIX, show.display()), cx);+ crate::workspace::route_ipc(format!("{}{}", crate::workspace::SELECT_TAB_PREFIX, show.display()), cx);}))}).child(icon_button(("dl-forget", i), L::X, t!("Listeden kaldır"), p).on_click(move |_, _, _| hd_history::forget(&forget))),diff --git a/crates/rf-app/src/hyperdownload.rs b/crates/rf-app/src/hyperdownload.rsindex cd3cd949..83f51240 100644--- a/crates/rf-app/src/hyperdownload.rs+++ b/crates/rf-app/src/hyperdownload.rs@@ -34,7 +34,7 @@ const HOST_KEYS: &[&str] = &[pub fn register_host() {let (Some(exe), Some(data)) = (crate::addons::program(ID), data_dir()) else { return };let Some(dir) = exe.parent() else { return };- let downloads = dirs::download_dir().unwrap_or_else(|| data.clone());+ let downloads = download_folder(&crate::settings::Settings::load()).unwrap_or_else(|| data.clone());let me = std::env::current_exe().ok();let host = json!({ "data": data, "downloads": downloads, "rustyfiles": me });let _ = std::fs::write(dir.join("host.json"), serde_json::to_vec_pretty(&host).unwrap_or_default());@@ -69,10 +69,19 @@ pub fn unregister_host() {/// Shows a download HyperDownload already has (handed over by the browser) as a card, into the Downloads folder.pub fn follow(gid: String, cx: &mut gpui_kit::App) {- let dir = dirs::download_dir().unwrap_or_default();+ let dir = download_folder(cx.global::<crate::settings::Settings>()).unwrap_or_default();download_source(Source::Follow(gid), dir, cx)}+/// Where the browsers' downloads go: the folder chosen in Settings › Add-ons, else the Downloads folder.+pub fn download_folder(s: &crate::settings::Settings) -> Option<PathBuf> {+ let chosen = s.hd_downloads.trim();+ if !chosen.is_empty() {+ return Some(PathBuf::from(chosen));+ }+ dirs::download_dir()+}+/// Where the add-on keeps its lists, its torrent session and `rpc.json`.fn data_dir() -> Option<PathBuf> {crate::settings::local_data_dir().map(|d| d.join("hyperdownload"))@@ -163,7 +172,7 @@ pub fn connect() -> Result<Rpc, Unavailable> {register_host();let _ = std::fs::create_dir_all(&dir);let _ = std::fs::remove_file(dir.join("rpc.json"));- let downloads = dirs::download_dir().unwrap_or_else(|| dir.clone());+ let downloads = download_folder(&crate::settings::Settings::load()).unwrap_or_else(|| dir.clone());let mut cmd = std::process::Command::new(&exe);cmd.arg("serve").arg("--data").arg(&dir).arg("--downloads").arg(&downloads);#[cfg(windows)]diff --git a/crates/rf-app/src/i18n_en.rs b/crates/rf-app/src/i18n_en.rsindex 645e816f..4407081f 100644--- a/crates/rf-app/src/i18n_en.rs+++ b/crates/rf-app/src/i18n_en.rs@@ -2329,6 +2329,8 @@ pub const EN: &[(&str, &str)] = &[("Diğer cihazlar bu bilgisayarı bu adla görür. Boş bırakırsanız bilgisayarın adı kullanılır.", "Other devices see this PC by this name. Leave it empty to use the computer's name."),("Gelen dosyalar", "Received files"),("Gelen dosyaların klasörünü seçin", "Choose the folder for received files"),+ ("İndirme klasörü", "Download folder"),+ ("İndirmelerin klasörünü seçin", "Choose the folder for downloads"),("Güvenilir cihazlardan sormadan al", "Take files from trusted devices without asking"),("Eşleştirdiğiniz cihazların gönderdikleri doğrudan Gelen dosyalar klasörüne iner; diğer cihazlar her seferinde sorulur.", "Files from devices you paired with go straight to the Received files folder; other devices are asked about every time."),("Yakındaki cihazlar", "Nearby devices"),diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rsindex 313c570e..317f643d 100644--- a/crates/rf-app/src/settings.rs+++ b/crates/rf-app/src/settings.rs@@ -1150,6 +1150,8 @@ pub struct Settings {pub ferry_name: String,/// Where received files go; empty: the Downloads folder.pub ferry_inbox: String,+ /// Where HyperDownload puts what the browsers hand it; empty: the Downloads folder (HyperDownload issues 1 and 3).+ pub hd_downloads: String,/// Files from a trusted device are taken without asking, into the folder above (on).pub ferry_auto_accept_trusted: bool,}@@ -1444,6 +1446,7 @@ impl Default for Settings {ferry_visibility: FerryVisibility::Trusted,ferry_name: String::new(),ferry_inbox: String::new(),+ hd_downloads: String::new(),ferry_auto_accept_trusted: true,}}diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rsindex 08ba35f0..20f4818e 100644--- a/crates/rf-app/src/workspace.rs+++ b/crates/rf-app/src/workspace.rs@@ -488,6 +488,10 @@ pub const SELECT_PREFIX: &str = "\u{1}select:";/// see rf_win::shell_window): selected in place, or its folder opened when no window shows it.pub const SELECT_HERE_PREFIX: &str = "\u{1}select-here:";+/// A file to show selected from inside rustyfiles itself (the Downloads page's "Show in folder"): a new tab of the last window,+/// even with "open folders from other programs in a new window" on, which is about other programs (HyperDownload issue 1).+pub const SELECT_TAB_PREFIX: &str = "\u{1}select-tab:";+/// A second launch on a shell folder (a phone, Network…) reaches the running window as this/// prefix plus the folder's parsing name (and, in a saved session, a tab and its name).pub const SHELL_PREFIX: &str = "rustyfiles-shell:";@@ -735,9 +739,13 @@ pub fn route_ipc_shown(msg: String, cx: &mut App) -> bool {return true;}crate::shell::desktop::open::mark("main: the line to open a place arrived");+ let (msg, ours) = match msg.strip_prefix(SELECT_TAB_PREFIX) {+ Some(file) => (format!("{SELECT_PREFIX}{file}"), true),+ None => (msg, false),+ };let (loc, select) = parse_launch(&msg);// (with "open folders from other programs in a new window" on, no window takes it as a tab: issue 77)- let list = if cx.global::<crate::settings::Settings>().launch_in_new_window {+ let list = if cx.global::<crate::settings::Settings>().launch_in_new_window && !ours {Vec::new()} else {cx.try_global::<OpenWorkspaces>().map(|g| g.0.clone()).unwrap_or_default()