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
Speed test: Explorer++, Double Commander, Sigma; card in the brand's look
gelenmedya2bb75702629b
diff --git a/crates/rf-app/src/bench.rs b/crates/rf-app/src/bench.rsindex d471823a..39e7b2f5 100644--- a/crates/rf-app/src/bench.rs+++ b/crates/rf-app/src/bench.rs@@ -465,6 +465,11 @@ pub fn run(plan: &Plan, progress: &dyn Fn(Progress), cancel: &AtomicBool) -> anyif per_app[k].error.is_some() {continue;}+ // an app that takes no folder from the command line (Sigma) is measured only on its start+ if !app.kind.opens_a_folder() && t != OpenTest::Start {+ per_app[k].error = Some("opens no folder given on the command line".into());+ continue;+ }match rf_win::bench::measure_open(app, &dir, OPEN_TIMEOUT, cancel) {Ok(res) if r > 0 => per_app[k].runs.push(res),Ok(_) => {}@@ -767,3 +772,171 @@ directlook_enabled = falseend_all(&ours.exe);}}++#[cfg(test)]+mod live_all {+ /// The README's comparison, by hand: every file manager found opening every folder of the speed test, each two ways where it+ /// can be: FROM SCRATCH (no process of it left before the start: every one is ended first) and ALREADY RUNNING (its process+ /// kept in the background, as rustyfiles, Arke, Files and Sigma do in everyday use, so a start hands the folder to it). Then+ /// the copy, ZIP and search engines against Windows'. Portable copies are named by `RF_BENCH_RUSTYFILES`, `RF_BENCH_ARKE`,+ /// `RF_BENCH_EXPLORERPP`, `RF_BENCH_DOUBLECMD`, `RF_BENCH_SIGMA`:+ /// `cargo test --release -p rf-app --lib live_all -- --ignored --nocapture`. Ends those apps' processes, so it is never part of+ /// Settings › Speed test. Opens windows on top for a while; writes `%TEMP%\rf-bench-everyone.json`.+ #[test]+ #[ignore]+ fn against_everyone() {+ use rf_win::bench::{App, AppKind, OpenResult, measure_open};+ use std::path::{Path, PathBuf};+ use std::time::Duration;+ let cancel = std::sync::atomic::AtomicBool::new(false);+ let mut ours = super::rustyfiles_app();+ if let Some(exe) = std::env::var_os("RF_BENCH_RUSTYFILES") {+ ours.exe = PathBuf::from(exe);+ }+ super::prepare_rustyfiles_settings().unwrap();+ // rustyfiles kept running in the background with settings of its own (its pipe is named after its settings folder, so a+ // start hands the folder to this copy, never to the user's), as `live_arke`+ let cfg = super::bench_dir().join("rustyfiles-warm");+ std::fs::create_dir_all(&cfg).unwrap();+ std::fs::write(+ cfg.join("settings.toml"),+ "restore_session = false\nrun_in_background = true\nauto_update = false\nstar_asked = true\nstarts = 1\nsearch_index = false\nname_index = false\ndirectlook_enabled = false\n",+ )+ .unwrap();+ let warm = App {+ kind: AppKind::Rustyfiles,+ exe: ours.exe.clone(),+ env: vec![("RUSTYFILES_CONFIG_DIR".into(), cfg.to_string_lossy().into_owned()), ("RUSTYFILES_MUTE".into(), "1".into())],+ };+ let mut found = rf_win::bench::detect();+ if let Some(exe) = std::env::var_os("RF_BENCH_ARKE").map(PathBuf::from)+ && !found.iter().any(|a| a.kind == AppKind::Arke)+ {+ found.push(App { kind: AppKind::Arke, exe, env: Vec::new() });+ }+ let get = |k: AppKind| found.iter().find(|a| a.kind == k).cloned();++ // every process of one program+ let end_all = |exe: &Path| {+ let image = exe.to_string_lossy().replace('/', "\\").to_lowercase();+ let list = std::process::Command::new("powershell")+ .args(["-NoProfile", "-Command", "Get-CimInstance Win32_Process | ForEach-Object { \"$($_.ProcessId)|$($_.ExecutablePath)\" }"])+ .output()+ .map(|o| String::from_utf8_lossy(&o.stdout).into_owned())+ .unwrap_or_default();+ for line in list.lines() {+ if let Some((pid, path)) = line.trim().split_once('|')+ && path.replace('/', "\\").to_lowercase() == image+ {+ let _ = std::process::Command::new("taskkill").args(["/PID", pid, "/F"]).output();+ }+ }+ std::thread::sleep(Duration::from_millis(700));+ };++ // (name, app, ended before each run, only the start)+ let mut entries: Vec<(&str, App, bool, bool)> = vec![("rustyfiles, from scratch", ours.clone(), false, false), ("rustyfiles, already running", warm.clone(), false, false)];+ if let Some(a) = get(AppKind::Explorer) {+ entries.push(("File Explorer", a, false, false));+ }+ if let Some(a) = get(AppKind::Files) {+ entries.push(("Files, already running", a, false, false));+ }+ if let Some(a) = get(AppKind::FilePilot) {+ entries.push(("File Pilot, from scratch", a, true, false));+ }+ for (k, cold, running) in [+ (AppKind::Arke, "Arke, from scratch", Some("Arke, already running")),+ (AppKind::ExplorerPlusPlus, "Explorer++, from scratch", None),+ (AppKind::DoubleCommander, "Double Commander, from scratch", None),+ (AppKind::Sigma, "Sigma, from scratch", Some("Sigma, already running")),+ ] {+ if let Some(a) = get(k) {+ let start_only = !k.opens_a_folder();+ entries.push((cold, a.clone(), true, start_only));+ if let Some(name) = running {+ entries.push((name, a, false, start_only));+ }+ }+ }+ eprintln!("apps: {}", entries.iter().map(|e| e.0).collect::<Vec<_>>().join(", "));+ let _files = if entries.iter().any(|e| e.1.kind == AppKind::Files) { super::FilesSession::begin() } else { None };++ let mut out = serde_json::Map::new();+ for t in super::OpenTest::ALL {+ let dir = super::bench_dir().join(t.folder());+ assert!(dir.is_dir(), "{} is missing: run the speed test once", dir.display());+ let mut runs: Vec<Vec<OpenResult>> = vec![Vec::new(); entries.len()];+ let mut errors: Vec<Option<String>> = vec![None; entries.len()];+ for round in 0..=super::RUNS {+ for (k, (name, app, cold, start_only)) in entries.iter().enumerate() {+ if *start_only && t != super::OpenTest::Start {+ continue;+ }+ if *cold {+ end_all(&app.exe);+ }+ match measure_open(app, &dir, super::OPEN_TIMEOUT, &cancel) {+ Ok(r) if round > 0 => runs[k].push(r),+ Ok(_) => {}+ Err(e) => {+ eprintln!("{name}: {e:#}");+ errors[k] = Some(format!("{e:#}"));+ }+ }+ }+ }+ eprintln!("\n== {}", t.folder());+ let mut row = serde_json::Map::new();+ for (k, (name, ..)) in entries.iter().enumerate() {+ let mut ms: Vec<f64> = runs[k].iter().map(|r| r.settled_ms).collect();+ ms.sort_by(f64::total_cmp);+ let Some(&mid) = ms.get(ms.len() / 2) else {+ if let Some(e) = &errors[k] {+ eprintln!(" {name:32} - ({e})");+ }+ continue;+ };+ let m = runs[k].iter().min_by(|a, b| (a.settled_ms - mid).abs().total_cmp(&(b.settled_ms - mid).abs())).unwrap();+ eprintln!(+ " {name:32} {:>7.0} ms window {:>6.0} ms cpu {:>6.0} ms memory {:>4} MB runs {:?}{}",+ m.settled_ms,+ m.window_ms,+ m.cpu_ms,+ m.private_ws >> 20,+ ms.iter().map(|v| v.round()).collect::<Vec<_>>(),+ if runs[k].iter().any(|r| r.timed_out) { " (timed out)" } else { "" }+ );+ row.insert(name.to_string(), serde_json::json!({ "ms": m.settled_ms, "window_ms": m.window_ms, "cpu_ms": m.cpu_ms, "memory_mb": m.private_ws >> 20, "runs": ms, "shared": m.shared }));+ }+ out.insert(t.folder().to_string(), serde_json::Value::Object(row));+ }+ // the running copies the test made are ended: Arke's, Sigma's and the warm rustyfiles+ for (_, app, ..) in &entries {+ if app.kind != AppKind::Explorer && app.kind != AppKind::Files {+ end_all(&app.exe);+ }+ }++ // the engines, as Settings › Speed test measures them+ // (`run` saves its results as the speed test's last ones: those of Settings › Speed test are kept and put back)+ let last = super::bench_dir().join("results.json");+ let kept = std::fs::read(&last).ok();+ let plan = super::Plan { apps: vec![ours], open: Vec::new(), copy: true, engines: true };+ let r = super::run(&plan, &|_| {}, &cancel).unwrap();+ match kept {+ Some(b) => {+ let _ = std::fs::write(&last, b);+ }+ None => {+ let _ = std::fs::remove_file(&last);+ }+ }+ eprintln!("\nengines: {}", serde_json::to_string(&r.engines).unwrap_or_default());+ out.insert("engines".into(), serde_json::to_value(&r.engines).unwrap_or_default());+ out.insert("machine".into(), serde_json::to_value(&r.machine).unwrap_or_default());+ let path = std::env::temp_dir().join("rf-bench-everyone.json");+ std::fs::write(&path, serde_json::to_vec_pretty(&serde_json::Value::Object(out)).unwrap()).unwrap();+ eprintln!("written: {}", path.display());+ }+}diff --git a/crates/rf-app/src/bench_view.rs b/crates/rf-app/src/bench_view.rsindex 03451f07..97e708c3 100644--- a/crates/rf-app/src/bench_view.rs+++ b/crates/rf-app/src/bench_view.rs@@ -126,6 +126,9 @@ fn app_label(k: AppKind) -> &'static str {AppKind::Files => "Files",AppKind::FilePilot => "File Pilot",AppKind::Arke => "Arke",+ AppKind::ExplorerPlusPlus => "Explorer++",+ AppKind::DoubleCommander => "Double Commander",+ AppKind::Sigma => "Sigma",}}@@ -266,6 +269,9 @@ fn app_key(k: AppKind) -> &'static str {AppKind::Files => "fi",AppKind::FilePilot => "fp",AppKind::Arke => "ar",+ AppKind::ExplorerPlusPlus => "xp",+ AppKind::DoubleCommander => "dc",+ AppKind::Sigma => "sg",}}@@ -475,108 +481,192 @@ fn esc(s: &str) -> String {s.replace('&', "&").replace('<', "<").replace('>', ">").replace('"', """)}-/// The result card as SVG (1200 × 675, the size social sites show whole).+/// The first line of the card's headline: what was opened.+fn folder_phrase(t: OpenTest) -> &'static str {+ match t {+ OpenTest::Start => t!("Boş bir klasörü"),+ OpenTest::Files1k => t!("1.000 dosyalık bir klasörü"),+ OpenTest::Files10k => t!("10.000 dosyalık bir klasörü"),+ OpenTest::Files100k => t!("100.000 dosyalık bir klasörü"),+ OpenTest::Images => t!("2.000 resimli bir klasörü"),+ }+}++/// `text` as SVG tspans, with the part `{x}` stands for in `accent` (the rest takes the text element's own colour).+fn with_accent(text: &str, x: &str, accent: &str) -> String {+ match text.split_once("{x}") {+ Some((a, b)) => format!("{}<tspan fill=\"{accent}\">{}</tspan>{}", esc(a), esc(x), esc(b)),+ None => esc(text),+ }+}++/// The result card as SVG (1200 × 675, the size social sites show whole), in the look of rustyfiles' posts: the near-black+/// background with its dot grid and ember glow, the wordmark, a headline in Bricolage Grotesque that says in words what was+/// measured, the bars, and the big numbers in Doto, each with what it counts and both times under it.fn card_svg(r: &Results) -> String {- // 1200 × 675, the size social sites show whole; the same look as rustyfiles' posts:- // two-tone wordmark, one big multiplier, bars, three figures, a warm glow- let (w, h) = (1200.0, 675.0);- let orange = "#ff6a1a";+ const INK: &str = "#f2f0ec";+ const DIM: &str = "#9d9ba2";+ const FAINT: &str = "#6c6a72";+ const EMBER: &str = "#ff6a1a";+ // (quoted: a family name with "96pt" in it is not a CSS identifier, and an unquoted one dropped the whole list)+ const HEAD: &str = "font-family=\"'Bricolage Grotesque 96pt', 'Bricolage Grotesque 96pt SemiBold', 'Segoe UI'\" font-weight=\"600\"";+ const BODY: &str = "font-family=\"'Bricolage Grotesque', 'Segoe UI'\" font-weight=\"400\"";+ const NUM: &str = "font-family=\"'Doto', 'Doto Black', 'Segoe UI'\" font-weight=\"900\"";+ let (w, h, m): (f64, f64, f64) = (1200.0, 675.0, 64.0);let test = if r.open.iter().any(|o| o.test == OpenTest::Files100k) { OpenTest::Files100k } else { r.open.iter().map(|o| o.test).find(|t| *t != OpenTest::Start).unwrap_or(OpenTest::Files10k) };let row = r.open.iter().find(|o| o.test == test);- let rows: Vec<(AppKind, f64, bool)> = row.map(|o| o.apps.iter().filter_map(|a| a.median().map(|m| (a.app, m.settled_ms, m.shared))).collect()).unwrap_or_default();+ let mut rows: Vec<(AppKind, f64, bool)> = row.map(|o| o.apps.iter().filter_map(|a| a.median().map(|m| (a.app, m.settled_ms, m.shared))).collect()).unwrap_or_default();+ rows.sort_by(|a, b| a.1.total_cmp(&b.1));+ // at most four bars: rustyfiles and File Explorer always, then the fastest of the others (one very slow app would shrink the+ // others to dots)+ let mut keep: Vec<(AppKind, f64, bool)> = rows.iter().filter(|x| matches!(x.0, AppKind::Rustyfiles | AppKind::Explorer)).cloned().collect();+ for x in &rows {+ if keep.len() >= 4 {+ break;+ }+ if !keep.iter().any(|k| k.0 == x.0) {+ keep.push(x.clone());+ }+ }+ keep.sort_by(|a, b| a.1.total_cmp(&b.1));let ours = rows.iter().find(|x| x.0 == AppKind::Rustyfiles).map(|x| x.1);let explorer = rows.iter().find(|x| x.0 == AppKind::Explorer).map(|x| x.1);++ // the background, the wordmark, who measured it wherelet mut s = format!(r##"<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" viewBox="0 0 {w} {h}"><defs>-<radialGradient id="glow" cx="0.82" cy="0.42" r="0.55"><stop offset="0" stop-color="{orange}" stop-opacity="0.16"/><stop offset="1" stop-color="{orange}" stop-opacity="0"/></radialGradient>-<linearGradient id="hot" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="{orange}"/><stop offset="1" stop-color="#ff8a45"/></linearGradient>+<pattern id="dots" width="24" height="24" patternUnits="userSpaceOnUse"><circle cx="12" cy="12" r="1" fill="#ffffff" fill-opacity="0.055"/></pattern>+<radialGradient id="glow" cx="0.86" cy="0.02" r="0.62"><stop offset="0" stop-color="{EMBER}" stop-opacity="0.30"/><stop offset="1" stop-color="{EMBER}" stop-opacity="0"/></radialGradient>+<radialGradient id="glow2" cx="0.02" cy="1.0" r="0.45"><stop offset="0" stop-color="#d9480f" stop-opacity="0.13"/><stop offset="1" stop-color="#d9480f" stop-opacity="0"/></radialGradient>+<linearGradient id="hot" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="{EMBER}"/><stop offset="1" stop-color="#ff8a45"/></linearGradient></defs>-<rect width="{w}" height="{h}" fill="#0f1013"/>+<rect width="{w}" height="{h}" fill="#050505"/>+<rect width="{w}" height="{h}" fill="url(#dots)"/><rect width="{w}" height="{h}" fill="url(#glow)"/>-<text x="64" y="104" font-size="66" font-weight="800" letter-spacing="-2" fill="#f2f2f4">rusty<tspan fill="{orange}">files</tspan></text>-<text x="66" y="146" font-size="24" fill="#a3a6b0">{}</text>-<text x="66" y="178" font-size="18" fill="#6e717b">{}</text>+<rect width="{w}" height="{h}" fill="url(#glow2)"/>+{}+<text x="{}" y="74" {BODY} font-size="21" fill="{DIM}" text-anchor="end">{}</text>+<text x="{}" y="98" {BODY} font-size="15" fill="{FAINT}" text-anchor="end">{}</text>"##,+ crate::brand::wordmark_nested(m as f32, 46.0, 50.0, INK),+ w - m,esc(t!("Bilgisayarımdaki hız testi")),+ w - m,esc(&machine_line(&r.machine)),);- // the headline: how much faster than File Explorer at opening the folder- if let (Some(a), Some(b)) = (ours, explorer) {- let headline = if b > a * 1.05 { times(b, a) } else { "=".into() };- s.push_str(&format!(- r##"<text x="62" y="330" font-size="132" font-weight="800" letter-spacing="-5" fill="{orange}">{}</text>-<text x="66" y="378" font-size="28" fill="#f2f2f4">{}</text>-<text x="66" y="410" font-size="20" fill="#6e717b">{}</text>++ // the headline, in words: what was opened, and how it went against File Explorer+ let second = match (ours, explorer) {+ (Some(a), Some(b)) if b > a * 1.05 => with_accent(t!("Dosya Gezgini'nden {x} hızlı açar"), ×(b, a), EMBER),+ (Some(_), Some(_)) => esc(t!("Dosya Gezgini kadar hızlı açar")),+ (Some(a), None) => with_accent(t!("{x} içinde açar"), &ms(a), EMBER),+ _ => String::new(),+ };+ s.push_str(&format!(+ r##"<text x="{m}" y="196" {HEAD} font-size="56" letter-spacing="-1.2" fill="{INK}">{}</text>+<text x="{m}" y="260" {HEAD} font-size="56" letter-spacing="-1.2" fill="{INK}">{second}</text>"##,- esc(&headline),- esc(if b > a * 1.05 { t!("Dosya Gezgini'nden hızlı") } else { t!("Dosya Gezgini kadar hızlı") }),- esc(&t!("{test}: klasörün açılması").replace("{test}", test_label(test))),- ));- }- // bars on the right- let longest = rows.iter().map(|x| x.1).fold(1.0, f64::max);- let (bx, bw) = (640.0, 420.0);- s.push_str(&format!(r##"<text x="{bx}" y="236" font-size="18" fill="#6e717b">{}</text>"##, esc(t!("Klasörün açılması, gerçek hızda"))));- for (i, (app, v, shared)) in rows.iter().enumerate() {- let y = 262.0 + i as f64 * 62.0;- let len = (v / longest * bw).max(10.0);+ esc(folder_phrase(test)),+ ));++ // the bars: each app opening that folder, from a cold start+ let longest = keep.iter().map(|x| x.1).fold(1.0, f64::max);+ let (lx, bx, bw) = (m, m + 200.0, w - 2.0 * m - 200.0 - 110.0);+ s.push_str(&format!(+ r##"<text x="{m}" y="316" {BODY} font-size="16" fill="{FAINT}">{}</text>"##,+ esc(&format!("{} · {} · {}", t!("Klasörün açılması, gerçek hızda"), test_label(test), t!("kısa olan daha iyi")))+ ));+ for (i, (app, v, shared)) in keep.iter().enumerate() {+ let y = 334.0 + i as f64 * 30.0;+ let len = (v / longest * bw).max(8.0);let mine = *app == AppKind::Rustyfiles;s.push_str(&format!(- r##"<text x="{bx}" y="{}" font-size="20" fill="{}">{}</text><text x="{}" y="{}" font-size="20" font-weight="600" fill="{}" text-anchor="end">{}{}</text><rect x="{bx}" y="{}" width="{len:.0}" height="16" rx="5" fill="{}"/>"##,- y + 18.0,- if mine { "#f2f2f4" } else { "#a3a6b0" },+ r##"<text x="{lx}" y="{}" {} font-size="18" fill="{}">{}</text><rect x="{bx}" y="{}" width="{bw:.0}" height="12" rx="6" fill="#ffffff" fill-opacity="0.04"/><rect x="{bx}" y="{}" width="{len:.0}" height="12" rx="6" fill="{}"/><text x="{}" y="{}" {HEAD} font-size="18" fill="{}" text-anchor="end">{}{}</text>"##,+ y + 15.0,+ if mine { HEAD } else { BODY },+ if mine { INK } else { DIM },esc(app_label(*app)),- bx + bw + 76.0,- y + 18.0,- if mine { "#ff8a45" } else { "#f2f2f4" },+ y + 4.0,+ y + 4.0,+ if mine { "url(#hot)" } else { "#3a3940" },+ w - m,+ y + 15.0,+ if mine { EMBER } else { DIM },esc(&ms(*v)),if *shared { " *" } else { "" },- y + 28.0,- if mine { "url(#hot)" } else { "#444955" },));}- // three figures- let mut cells: Vec<(String, String)> = Vec::new();- if let Some(v) = &r.engines.copy_small {- if let (Some(a), Some(b)) = (v.ours_ms, v.windows_ms) {- cells.push((times(b, a), t!("10.000 küçük dosya kopyalama").to_string()));- }++ // the big numbers, each with what it counts and both times+ struct Cell {+ big: String,+ word: &'static str,+ what: String,+ times: String,}- if let Some(v) = &r.engines.unzip {- if let (Some(a), Some(b)) = (v.ours_ms, v.windows_ms) {- cells.push((times(b, a), t!("ZIP çıkarma: 10.000 dosya").to_string()));+ let mut cells: Vec<Cell> = Vec::new();+ for (v, what) in [(&r.engines.copy_small, t!("10.000 küçük dosya kopyalama")), (&r.engines.unzip, t!("ZIP çıkarma: 10.000 dosya"))] {+ if let Some(v) = v+ && let (Some(a), Some(b)) = (v.ours_ms, v.windows_ms)+ {+ cells.push(Cell { big: times(b, a), word: t!("daha hızlı"), what: what.to_string(), times: format!("rustyfiles {} · Windows {}", ms(a), ms(b)) });}}- if let Some(m) = row.and_then(|o| o.apps.iter().find(|a| a.app == AppKind::Rustyfiles)).and_then(|a| a.median()) {- cells.push((ms(m.cpu_ms), t!("işlemci süresi").to_string()));+ // the memory with that folder open, when it is less than File Explorer's (Task Manager's figure)+ let memory = |k: AppKind| row.and_then(|o| o.apps.iter().find(|a| a.app == k)).and_then(|a| a.median()).filter(|m| m.private_ws > 0).map(|m| m.private_ws);+ if let (Some(a), Some(b)) = (memory(AppKind::Rustyfiles), memory(AppKind::Explorer))+ && b as f64 > a as f64 * 1.1+ {+ cells.push(Cell {+ big: mb(a),+ word: "",+ what: t!("bellek, klasör açıkken").to_string(),+ times: format!("{} {}", app_label(AppKind::Explorer), mb(b)),+ });}- let n = cells.len().max(1) as f64;- let (cx0, cw, cy) = (64.0, (w - 128.0) / n, 470.0);+ let cells = &cells[..cells.len().min(3)];+ let (cy, ch) = (500.0, 112.0);if !cells.is_empty() {- s.push_str(&format!(r##"<rect x="{cx0}" y="{cy}" width="{}" height="104" rx="16" fill="#17191e" stroke="#262932"/>"##, w - 128.0));- }- for (i, (big, small)) in cells.iter().enumerate() {- let x = cx0 + i as f64 * cw;- if i > 0 {- s.push_str(&format!(r##"<line x1="{x}" y1="{}" x2="{x}" y2="{}" stroke="#262932"/>"##, cy, cy + 104.0));+ let cw = (w - 2.0 * m) / cells.len() as f64;+ s.push_str(&format!(r##"<rect x="{m}" y="{cy}" width="{}" height="{ch}" rx="18" fill="#ffffff" fill-opacity="0.035" stroke="#ffffff" stroke-opacity="0.09"/>"##, w - 2.0 * m));+ for (i, c) in cells.iter().enumerate() {+ let x = m + i as f64 * cw + 28.0;+ if i > 0 {+ s.push_str(&format!(r##"<line x1="{0}" y1="{1}" x2="{0}" y2="{2}" stroke="#ffffff" stroke-opacity="0.09"/>"##, x - 28.0, cy + 16.0, cy + ch - 16.0));+ }+ // the multiplier's "×" in Bricolage: Doto's would be a dot pattern too small to read+ let (num, sign) = match c.big.strip_suffix('×') {+ Some(n) => (n.to_string(), "×"),+ None => (c.big.clone(), ""),+ };+ // the digits in Doto; a decimal point in Bricolage (Doto's is one dot, lost beside the digits)+ let digits = match num.split_once('.') {+ Some((a, b)) => format!("{}</tspan><tspan {HEAD} font-size=\"40\">.</tspan><tspan {NUM} font-size=\"46\">{}", esc(a), esc(b)),+ None => esc(&num),+ };+ s.push_str(&format!(+ r##"<text x="{x}" y="{}" fill="{EMBER}"><tspan {NUM} font-size="46">{}</tspan><tspan {HEAD} font-size="30" dx="3">{sign}</tspan><tspan {BODY} font-size="19" fill="{DIM}" dx="8">{}</tspan></text><text x="{x}" y="{}" {BODY} font-size="17" fill="{INK}">{}</text><text x="{x}" y="{}" {BODY} font-size="14" fill="{FAINT}">{}</text>"##,+ cy + 50.0,+ digits,+ esc(c.word),+ cy + 76.0,+ esc(&c.what),+ cy + 97.0,+ esc(&c.times),+ ));}- s.push_str(&format!(- r##"<text x="{}" y="{}" font-size="44" font-weight="800" letter-spacing="-1" fill="#f2f2f4">{}</text><text x="{}" y="{}" font-size="18" fill="#a3a6b0">{}</text>"##,- x + 28.0,- cy + 56.0,- esc(big),- x + 30.0,- cy + 86.0,- esc(small)- ));}++ // the footer+ let shared_note = if keep.iter().any(|x| x.2) { format!(" · * {}", t!("uygulama zaten çalışıyordu (sıfırdan açılış değil)")) } else { String::new() };s.push_str(&format!(- r##"<text x="64" y="{}" font-size="22" font-weight="600" fill="#ff8a45">rustyfiles.com</text><text x="{}" y="{}" font-size="17" fill="#6e717b" text-anchor="end">{}</text></svg>"##,- h - 40.0,- w - 64.0,- h - 40.0,- esc(t!("Kendi bildirdiği sonuç · ücretsiz ve açık kaynak · Windows"))+ r##"<text x="{m}" y="{}" {HEAD} font-size="20" fill="{EMBER}">rustyfiles.com</text><text x="{}" y="{}" {BODY} font-size="14" fill="{FAINT}" text-anchor="end">{}{}</text></svg>"##,+ h - 34.0,+ w - m,+ h - 34.0,+ esc(t!("Kendi bildirdiği sonuç · ücretsiz ve açık kaynak · Windows")),+ esc(&shared_note),));s}@@ -602,19 +692,24 @@ fn copy_picture(window: &Window, cx: &mut App) {let Some(r) = state(cx).results.clone() else { return };let owner = hwnd(window);let svg = card_svg(&r);- match rf_win::bench::render_card(&svg, 1.0) {- Ok(pic) => {- // also kept as a file next to the results, for attaching- let path = crate::bench::bench_dir().join("rustyfiles-speed-test.png");- let _ = std::fs::write(&path, &pic.png);- let ok = owner.is_some_and(|h| rf_win::clipboard::set_image(windows::Win32::Foundation::HWND(h as *mut _), pic.width, pic.height, &pic.rgba, &pic.png).is_ok());- note(if ok { t!("Sonuç kartı panoya kopyalandı") } else { t!("Panoya kopyalanamadı") }, cx);- }- Err(e) => {- log::warn!("bench card: {e:#}");- note(t!("Kart çizilemedi"), cx);- }- }+ // drawn off the UI thread: the first drawing also reads the system's fonts, which took long enough to freeze the window+ cx.spawn(async move |cx| {+ let pic = cx.background_executor().spawn(async move { rf_win::bench::render_card(&svg, 1.0, crate::brand::FONTS) }).await;+ let _ = cx.update(|cx| match pic {+ Ok(pic) => {+ // also kept as a file next to the results, for attaching+ let path = crate::bench::bench_dir().join("rustyfiles-speed-test.png");+ let _ = std::fs::write(&path, &pic.png);+ let ok = owner.is_some_and(|h| rf_win::clipboard::set_image(windows::Win32::Foundation::HWND(h as *mut _), pic.width, pic.height, &pic.rgba, &pic.png).is_ok());+ note(if ok { t!("Sonuç kartı panoya kopyalandı") } else { t!("Panoya kopyalanamadı") }, cx);+ }+ Err(e) => {+ log::warn!("bench card: {e:#}");+ note(t!("Kart çizilemedi"), cx);+ }+ });+ })+ .detach();}/// Saves the card to Downloads and opens it.@@ -622,7 +717,7 @@ fn save_picture(cx: &mut App) {let Some(r) = state(cx).results.clone() else { return };let svg = card_svg(&r);std::thread::spawn(move || {- let Ok(pic) = rf_win::bench::render_card(&svg, 1.0) else { return };+ let Ok(pic) = rf_win::bench::render_card(&svg, 1.0, crate::brand::FONTS) else { return };let dir = rf_win::known::KnownFolder::Downloads.path().unwrap_or_else(std::env::temp_dir);let path = rf_win::fileops::unique_name(&dir, "rustyfiles speed test", ".png");if std::fs::write(&path, &pic.png).is_ok() {@@ -673,7 +768,7 @@ pub fn page(p: &Palette, cx: &mut App) -> Vec<AnyElement> {let machine = st.machine.as_ref().map(machine_line).unwrap_or_default();let mut chips = h_flex().gap_2().flex_wrap().child(chip(p, "bench-app-rf", "rustyfiles", true, true, |_| {}));let installed: Vec<AppKind> = st.detected.iter().map(|a| a.kind).collect();- for kind in [AppKind::Explorer, AppKind::Files, AppKind::FilePilot, AppKind::Arke] {+ for kind in [AppKind::Explorer, AppKind::Files, AppKind::FilePilot, AppKind::Arke, AppKind::ExplorerPlusPlus, AppKind::DoubleCommander, AppKind::Sigma] {let here = installed.contains(&kind);let on = here && !st.off.contains(&kind);let label = if here { app_label(kind).to_string() } else { format!("{} · {}", app_label(kind), t!("kurulu değil")) };@@ -1090,10 +1185,31 @@ mod tests {/// Draws the card from the last results on this machine (when there are any) to %TEMP%.#[test]fn card_renders() {- let Some(r) = crate::bench::last_results() else { return };- let pic = rf_win::bench::render_card(&super::card_svg(&r), 1.0).unwrap();- assert_eq!((pic.width, pic.height), (1200, 675));- std::fs::write(std::env::temp_dir().join("rf-bench-card.png"), &pic.png).unwrap();+ for (name, r) in [("rf-bench-card.png", crate::bench::last_results().filter(|r| !r.open.is_empty())), ("rf-bench-card-sample.png", Some(sample()))] {+ let Some(r) = r else { continue };+ let pic = rf_win::bench::render_card(&super::card_svg(&r), 1.0, crate::brand::FONTS).unwrap();+ assert_eq!((pic.width, pic.height), (1200, 675));+ std::fs::write(std::env::temp_dir().join(name), &pic.png).unwrap();+ }+ }++ /// Results with every part of the card filled (numbers of a real run, rounded).+ fn sample() -> crate::bench::Results {+ use crate::bench::{AppRuns, Engines, OpenResults, OpenTest, Results, Versus};+ use rf_win::bench::{AppKind, Machine, OpenResult};+ let run = |ms: f64, mb: u64| OpenResult { settled_ms: ms, private_ws: mb << 20, ..Default::default() };+ let apps = [(AppKind::Rustyfiles, 211.0, 62), (AppKind::Explorer, 1148.0, 87), (AppKind::DoubleCommander, 1395.0, 140), (AppKind::Arke, 358.0, 64), (AppKind::ExplorerPlusPlus, 14913.0, 226)]+ .into_iter()+ .map(|(app, ms, mb)| AppRuns { app, runs: vec![run(ms, mb)], error: None })+ .collect();+ let v = |ours: f64, windows: f64| Some(Versus { ours_ms: Some(ours), windows_ms: Some(windows), ..Default::default() });+ Results {+ when: 0,+ version: "1.0.7".into(),+ machine: Machine { cpu: "AMD Ryzen 7 9800X3D 8-Core Processor".into(), cores: 16, ram_gb: 32, windows: "Windows 11 Pro (26300)".into(), disk: "SSD".into() },+ open: vec![OpenResults { test: OpenTest::Files100k, apps }],+ engines: Engines { copy_small: v(1779.0, 19379.0), unzip: v(3231.0, 26216.0), ..Default::default() },+ }}#[test]diff --git a/crates/rf-app/src/brand.rs b/crates/rf-app/src/brand.rsnew file mode 100644index 00000000..93d0974d--- /dev/null+++ b/crates/rf-app/src/brand.rs@@ -0,0 +1,89 @@+//! rustyfiles' own look outside the interface: the wordmark (the logo beside the name, as outlines, from+//! `assets/rustyfiles-wordmark.svg`, made by `tools/make_wordmark.py`) and the brand fonts (Bricolage Grotesque for words,+//! Doto for the big numbers; `assets/fonts`, SIL OFL 1.1). The speed test card is drawn with them, and the About page shows the+//! wordmark at its top. The fonts are read only by the card's SVG renderer, never loaded into the interface.++use std::sync::Arc;++use gpui_kit::RenderImage;++/// The wordmark's SVG: ink `#f2f0ec` for "rusty", ember for "files" and the logo's own colours.+pub const WORDMARK: &str = include_str!("../assets/rustyfiles-wordmark.svg");++/// The ink the wordmark is made with (for a dark background).+pub const WORDMARK_INK: &str = "#f2f0ec";++/// The fonts the card names: "Bricolage Grotesque 96pt" (SemiBold, headlines), "Bricolage Grotesque" (Regular, lines) and+/// "Doto" (Black, the big numbers).+pub static FONTS: &[&[u8]] = &[+ include_bytes!("../assets/fonts/BricolageGrotesque96pt-SemiBold.otf"),+ include_bytes!("../assets/fonts/BricolageGrotesque-Regular.otf"),+ include_bytes!("../assets/fonts/Doto-Black.ttf"),+];++/// The wordmark's width over its height.+pub fn wordmark_aspect() -> f32 {+ view_box(WORDMARK).map(|(w, h)| w / h).unwrap_or(3.57)+}++fn view_box(svg: &str) -> Option<(f32, f32)> {+ let start = svg.find("viewBox=\"")? + 9;+ let end = start + svg[start..].find('"')?;+ let v: Vec<f32> = svg[start..end].split_whitespace().filter_map(|s| s.parse().ok()).collect();+ (v.len() == 4).then(|| (v[2], v[3]))+}++/// The wordmark as an `<svg>` element to put inside another SVG, `height` tall with its top left at (`x`, `y`), "rusty" in `ink`.+pub fn wordmark_nested(x: f32, y: f32, height: f32, ink: &str) -> String {+ let body = WORDMARK.find("<svg").map(|i| &WORDMARK[i..]).unwrap_or(WORDMARK);+ let width = height * wordmark_aspect();+ let body = body.replacen("<svg ", &format!("<svg x=\"{x}\" y=\"{y}\" width=\"{width}\" height=\"{height}\" "), 1);+ body.replace(WORDMARK_INK, ink)+}++/// The wordmark drawn `height_px` pixels tall (device pixels), "rusty" in `ink`, ready for GPUI: BGRA, straight alpha.+pub fn wordmark_image(height_px: u32, ink: &str) -> Option<Arc<RenderImage>> {+ use resvg::{tiny_skia, usvg};+ let svg = WORDMARK.replace(WORDMARK_INK, ink);+ let tree = usvg::Tree::from_data(svg.as_bytes(), &usvg::Options::default()).ok()?;+ let size = tree.size();+ let scale = height_px.max(1) as f32 / size.height();+ let width = (size.width() * scale).ceil() as u32;+ let mut pix = tiny_skia::Pixmap::new(width.max(1), height_px.max(1))?;+ resvg::render(&tree, tiny_skia::Transform::from_scale(scale, scale), &mut pix.as_mut());+ let mut data = pix.take();+ for px in data.chunks_exact_mut(4) {+ // premultiplied RGBA -> straight BGRA+ let a = px[3] as u32;+ if a > 0 && a < 255 {+ for c in &mut px[..3] {+ *c = ((*c as u32 * 255 + a / 2) / a).min(255) as u8;+ }+ }+ px.swap(0, 2);+ }+ let buf = image::RgbaImage::from_raw(width.max(1), height_px.max(1), data)?;+ Some(Arc::new(RenderImage::new(vec![image::Frame::new(buf)])))+}++#[cfg(test)]+mod tests {+ #[test]+ fn the_wordmark_is_whole_and_draws() {+ assert!(super::WORDMARK.contains(super::WORDMARK_INK), "the ink the app swaps is in the file");+ let a = super::wordmark_aspect();+ assert!((3.0..4.5).contains(&a), "{a}");+ let nested = super::wordmark_nested(10.0, 20.0, 50.0, "#000000");+ assert!(nested.starts_with("<svg x=\"10\" y=\"20\"") && !nested.contains(super::WORDMARK_INK));+ let img = super::wordmark_image(40, "#000000").expect("drawn");+ let size = img.size(0);+ assert_eq!(size.height.0, 40);+ }++ #[test]+ fn the_fonts_are_there() {+ for f in super::FONTS {+ assert!(f.len() > 10_000 && (f.starts_with(b"OTTO") || f.starts_with(&[0, 1, 0, 0])));+ }+ }+}diff --git a/crates/rf-app/src/lib.rs b/crates/rf-app/src/lib.rsindex baffca6e..cd511c06 100644--- a/crates/rf-app/src/lib.rs+++ b/crates/rf-app/src/lib.rs@@ -9,6 +9,7 @@ mod cut_marks;pub mod bench;mod fast_start;mod bench_view;+mod brand;mod settings_transfer;mod donate;mod ferry;@@ -517,8 +518,7 @@ const AFTER_EXIT_ENV: &str = "RUSTYFILES_AFTER_EXIT";/// Restarts rustyfiles: DirectLook and the dock are asked to stop, a new rustyfiles is started that waits for this one to end, and/// this one quits the usual way (settings and session written). The new one opens its last session and brings the dock and-/// DirectLook back as the settings say. WHY (the owner, 2026-11-17, after a morning where the dock came up empty: "bir de bir-/// kısayol ekleyelim. rustyfiles'ı restart etsin"): there was no way to start everything afresh short of ending the processes by+/// DirectLook back as the settings say. WHY (after a morning where the dock came up empty): there was no way to start everything afresh short of ending the processes by/// hand. Ctrl+Alt+Shift+R and the command palette.pub(crate) fn restart(cx: &mut App) {let Ok(me) = std::env::current_exe() else { return };diff --git a/crates/rf-win/src/bench.rs b/crates/rf-win/src/bench.rsindex 0100114a..5e32a8ba 100644--- a/crates/rf-win/src/bench.rs+++ b/crates/rf-win/src/bench.rs@@ -49,6 +49,13 @@ pub enum AppKind {FilePilot,/// Arke (github.com/Koimsurai/Arke), another Rust and GPUI file manager for Windows.Arke,+ /// Explorer++ (explorerplusplus.com), open source, Win32.+ ExplorerPlusPlus,+ /// Double Commander (doublecmd.sourceforge.io), open source, two panes, Lazarus.+ DoubleCommander,+ /// Sigma File Manager (github.com/aleksey-hoffman/sigma-file-manager), open source, Electron. It takes no folder from the+ /// command line: only its start (to its own home page) is measured.+ Sigma,}impl AppKind {@@ -59,8 +66,22 @@ impl AppKind {AppKind::Files => "Files",AppKind::FilePilot => "File Pilot",AppKind::Arke => "Arke",+ AppKind::ExplorerPlusPlus => "Explorer++",+ AppKind::DoubleCommander => "Double Commander",+ AppKind::Sigma => "Sigma File Manager",}}++ /// Whether the app's window title names the folder it opened (the window is found by that); else it is the started process's+ /// own big window (Double Commander's title is its name and version, Sigma's its name).+ pub fn titles_its_folder(self) -> bool {+ !matches!(self, AppKind::DoubleCommander | AppKind::Sigma)+ }++ /// Whether it opens a folder given on the command line (Sigma does not: its open tests are left out).+ pub fn opens_a_folder(self) -> bool {+ self != AppKind::Sigma+ }}/// An app that can be measured: how to start it with a folder.@@ -89,6 +110,22 @@ pub fn detect() -> Vec<App> {if let Some(exe) = arke() {out.push(App { kind: AppKind::Arke, exe, env: Vec::new() });}+ // the open source ones, installed or (for a measuring run) named by an environment variable: their portable copies can be anywhere+ let others: [(AppKind, &str, fn(&str) -> bool, &str); 3] = [+ (AppKind::ExplorerPlusPlus, "RF_BENCH_EXPLORERPP", |n| n.contains("explorer++"), "explorer++.exe"),+ (AppKind::DoubleCommander, "RF_BENCH_DOUBLECMD", |n| n.contains("double commander"), "doublecmd.exe"),+ (AppKind::Sigma, "RF_BENCH_SIGMA", |n| n.contains("sigma file manager"), "sigma file manager.exe"),+ ];+ for (kind, var, installed, file) in others {+ let exe = std::env::var_os(var)+ .map(PathBuf::from)+ .filter(|p| p.is_file())+ .or_else(|| installed_exe(installed))+ .or_else(|| running_exe(|f| f.eq_ignore_ascii_case(file)));+ if let Some(exe) = exe {+ out.push(App { kind, exe, env: Vec::new() });+ }+ }out}@@ -214,6 +251,19 @@ struct Win {title: String,}+/// Whether process `pid` runs `exe` (an Electron app's window belongs to a child process of the one started, or to the copy+/// already running).+fn runs_exe(pid: u32, exe: &Path) -> bool {+ let want = exe.to_string_lossy().replace('/', "\\").to_lowercase();+ Proc::open(pid).is_some_and(|p| p.image().replace('/', "\\").to_lowercase() == want)+}++/// A main window, not one of the small helper windows an app makes (tray icons, message windows).+fn big_window(h: isize) -> bool {+ let mut r = RECT::default();+ unsafe { GetWindowRect(hwnd(h), &mut r) }.is_ok() && r.right - r.left >= 400 && r.bottom - r.top >= 300+}+fn windows() -> Vec<Win> {unsafe extern "system" fn cb(h: HWND, l: LPARAM) -> BOOL {let out = unsafe { &mut *(l.0 as *mut Vec<Win>) };@@ -425,7 +475,7 @@ pub fn measure_launch(app: &App, arg: &std::ffi::OsStr, title: &str, quiet: Dura// user's copy; started as a single instance, it hands the folder to the running one// (the test's own, with the test's settings)!before.contains(&w.hwnd)- && w.title.contains(&leaf)+ && if app.kind.titles_its_folder() { w.title.contains(&leaf) } else { (w.pid == child_pid || runs_exe(w.pid, &app.exe)) && big_window(w.hwnd) }&& (app.kind != AppKind::Rustyfiles || !app.env.iter().any(|(k, _)| k == "RUSTYFILES_MULTI_INSTANCE") || w.pid == child_pid)});if let Some(w) = found {@@ -634,7 +684,8 @@ pub struct Picture {pub png: Vec<u8>,}-pub fn render_card(svg: &str, scale: f32) -> anyhow::Result<Picture> {+/// `fonts`: font files the card names besides the system's (the brand fonts); read once, by the first call.+pub fn render_card(svg: &str, scale: f32, fonts: &'static [&'static [u8]]) -> anyhow::Result<Picture> {use resvg::{tiny_skia, usvg};static FONTS: std::sync::OnceLock<std::sync::Arc<usvg::fontdb::Database>> = std::sync::OnceLock::new();let opt = usvg::Options {@@ -642,6 +693,9 @@ pub fn render_card(svg: &str, scale: f32) -> anyhow::Result<Picture> {.get_or_init(|| {let mut db = usvg::fontdb::Database::new();db.load_system_fonts();+ for f in fonts {+ db.load_font_data(f.to_vec());+ }std::sync::Arc::new(db)}).clone(),