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
Sidebar text size and compact sidebar settings (#266)
ishiichan-dayo52b63e418f85
diff --git a/crates/rf-app/src/i18n_en.rs b/crates/rf-app/src/i18n_en.rsindex 8b9cabee..5afd1453 100644--- a/crates/rf-app/src/i18n_en.rs+++ b/crates/rf-app/src/i18n_en.rs@@ -67,6 +67,11 @@ pub const EN: &[(&str, &str)] = &[("Tümünü seç", "Select all"),("Kopyala", "Copy"),("Sıkışık öğeler", "Compact items"),+ ("Kenar çubuğunda yazı boyutu", "Sidebar text size"),+ ("Yalnızca kenar çubuğundaki yazıların boyutu; pencerenin geri kalanı değişmez", "The size of the sidebar's text only; the rest of the window stays as it is"),+ ("Pencereyle aynı", "Same as the window"),+ ("Sıkışık kenar çubuğu", "Compact sidebar"),+ ("Kenar çubuğunun satırları incelir, kaydırmadan daha çok yer görünür", "Thinner sidebar rows: more places show without scrolling"),("Explorer'ın sıkışık görünümü gibi: ayrıntılar görünümünde satırlar incelir, ızgarada öğeler birbirine ve adlar simgelerine yaklaşır. Her klasörde geçerlidir.", "Like Explorer's compact view: rows in Details are thinner, and in the grid the items sit closer together and names closer to their pictures. Applies to every folder."),("Dönüşümlü satır renkleri", "Alternating row colors"),("Ayrıntılar, Liste ve Sütunlar görünümlerinde satırların biri açık biri koyu olur, yan yana satırlar daha kolay ayırt edilir.", "In Details, List and Columns, every other row is lightly shaded, so that rows next to each other are easier to tell apart."),diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rsindex ab069a1b..f2ec1300 100644--- a/crates/rf-app/src/settings.rs+++ b/crates/rf-app/src/settings.rs@@ -594,6 +594,13 @@ pub struct Settings {pub explorer_sidebar_width: Option<f32>,/// Sidebar sections the user turned off ("drives", "cloud", "libraries", "network", "tags").pub sidebar_hidden: Vec<String>,+ /// The sidebar's text size, percent of the usual like `text_percent` (87, 93, 100 or 112); 0 = the same as the window's+ /// (issue 266: the sidebar denser without the rest of the window changing).+ #[serde(skip_serializing_if = "is_zero_u16")]+ pub sidebar_text_percent: u16,+ /// Thinner sidebar rows (32 → 24, 36 → 28 in the Windows File Explorer look), for more places without scrolling (issue 266).+ #[serde(skip_serializing_if = "std::ops::Not::not")]+ pub sidebar_compact: bool,/// Folders of the user's own listed in the sidebar's Drives section after the drives (issue 408: a folder a phone is synced to,/// a share used every day).#[serde(skip_serializing_if = "Vec::is_empty")]@@ -1242,6 +1249,8 @@ impl Default for Settings {sidebar_open: true,sidebar_rail: false,sidebar_width: DEFAULT_SIDEBAR_WIDTH,+ sidebar_text_percent: 0,+ sidebar_compact: false,explorer_sidebar_width: None,sidebar_hidden: Vec::new(),drive_places: Vec::new(),diff --git a/crates/rf-app/src/settings_view.rs b/crates/rf-app/src/settings_view.rsindex c7374e40..8a973fee 100644--- a/crates/rf-app/src/settings_view.rs+++ b/crates/rf-app/src/settings_view.rs@@ -2010,6 +2010,32 @@ fn appearance(p: &Palette, s: &Settings, cx: &mut App) -> Vec<AnyElement> {Some(t!("Explorer'ın sıkışık görünümü gibi: ayrıntılar görünümünde satırlar incelir, ızgarada öğeler birbirine ve adlar simgelerine yaklaşır. Her klasörde geçerlidir.")),sw("compact-items", p, s.compact_items, |s, v| s.compact_items = v),),+ card(+ p,+ L::PanelLeft,+ t!("Kenar çubuğunda yazı boyutu"),+ Some(t!("Yalnızca kenar çubuğundaki yazıların boyutu; pencerenin geri kalanı değişmez")),+ dropdown(+ "sidebar-text-size",+ p,+ u32::from(s.sidebar_text_percent),+ vec![+ (0, t!("Pencereyle aynı").into()),+ (87, t!("Çok küçük").into()),+ (93, t!("Küçük").into()),+ (100, t!("Normal").into()),+ (112, t!("Büyük").into()),+ ],+ |s, v| s.sidebar_text_percent = v as u16,+ ),+ ),+ card(+ p,+ L::Rows3,+ t!("Sıkışık kenar çubuğu"),+ Some(t!("Kenar çubuğunun satırları incelir, kaydırmadan daha çok yer görünür")),+ sw("sidebar-compact", p, s.sidebar_compact, |s, v| s.sidebar_compact = v),+ ),card(p,L::Rows2,diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rsindex 83bfff7c..7e587d7d 100644--- a/crates/rf-app/src/workspace.rs+++ b/crates/rf-app/src/workspace.rs@@ -4468,6 +4468,10 @@ impl Workspace {(b.len() <= 3 && b.len() >= 2 && b[1] == b':' && b[0].is_ascii_alphabetic()).then(|| (b[0] as char).to_ascii_uppercase())});let windows_theme = cx.global::<crate::settings::Settings>().windows_file_explorer_theme;+ let (compact, text_percent) = {+ let s = cx.global::<crate::settings::Settings>();+ (s.sidebar_compact, s.sidebar_text_percent)+ };let pin_target = if pin_indicator && !rail && windows_theme {target.path().map(Path::to_path_buf)} else {@@ -4525,16 +4529,22 @@ impl Workspace {.id(id)// A row of the scrolling sidebar never shrinks: squeezed to its least height, a drive's second line ran into the next row..flex_shrink_0()- // (Explorer's measures: its navigation pane's rows 32 px apart and its 12 px text)- .min_h(px(if metrics && !rail { 32. } else if windows_theme || rail { 36. } else { 32. }))+ // (Explorer's measures: its navigation pane's rows 32 px apart and its 12 px text; 8 px less in a compact sidebar)+ .min_h(px(sidebar_row_height(if metrics && !rail { 32. } else if windows_theme || rail { 36. } else { 32. }, compact))).when(windows_theme, |d| d.pl(if rail { px(8.) } else { px(24.) }).pr_2()).when(!windows_theme, |d| d.px_2())- .py_1()+ .when(!compact, |d| d.py_1()).gap(if windows_theme { px(4.) } else { px(8.) }).items_center().when(rail, |d| d.justify_center()).rounded(theme::RADIUS_SM).map(|d| if metrics { d.text_size(px(12.)) } else { d.text_sm() })+ // the sidebar's own text size (Settings > Appearance), as a share of the usual: 12 px with Explorer's measures, otherwise+ // `text_sm`'s 14 px on 20 px lines+ .when(text_percent != 0, |d| {+ let k = f32::from(text_percent.clamp(75, 125)) / 100.;+ if metrics { d.text_size(px(12. * k)) } else { d.text_size(px(14. * k)).line_height(px((20. * k).round())) }+ }).relative().when(fluent, |d| d.bg(p.selection).child(theme::selection_pill(p)))// while the row moves (the sidebar scrolls) the scene paints the pill itself: the engine's lens would trail the row@@ -4708,6 +4718,10 @@ impl Workspace {let places_loaded = places.loaded;let rail = self.sidebar_rail;let explorer_look = cx.global::<crate::settings::Settings>().windows_file_explorer_theme;+ // the compact sidebar (Settings > Appearance) also closes up the room under a section's divider and above its heading: the+ // heading's small grey text reads as farther off than it is, so the line keeps no room of its own under it+ let compact = cx.global::<crate::settings::Settings>().sidebar_compact;+ let below_divider = if compact { px(0.) } else { px(8.) };let section_divider = if p.dark || self.glass_shown || theme::light_explorer_uses_material() {p.divider} else {@@ -4734,7 +4748,7 @@ impl Workspace {}let d = div().px_2()- .pt_3()+ .pt(if compact { px(8.) } else { px(12.) }).pb_1().text_xs().font_weight(FontWeight::SEMIBOLD)@@ -4803,7 +4817,7 @@ impl Workspace {&["user-home", "folder-home"],));if !rail && explorer_look {- head = head.child(div().mx_2().my_2().h(px(1.)).flex_shrink_0().bg(section_divider));+ head = head.child(div().mx_2().mt_2().mb(below_divider).h(px(1.)).flex_shrink_0().bg(section_divider));}// Dropping folders on the header pins them. While files are dragged the header itself says so, in its own place and at its// own height. (It was a row of its own under the pins, which came with the drag and pushed everything below it down:@@ -4890,7 +4904,7 @@ impl Workspace {}let pins_apart = self.shows_tree(rail) && !explorer_look;if explorer_look && !pins_apart {- head = head.child(div().mx_2().my_2().h(px(1.)).flex_shrink_0().bg(section_divider));+ head = head.child(div().mx_2().mt_2().mb(below_divider).h(px(1.)).flex_shrink_0().bg(section_divider));}let pins_top = if pins_apart {Some(@@ -5387,6 +5401,11 @@ const TAB_CHROME_W: f32 = 12. + 14. + 8. + 8. + 22. + 4. + 2.;/// The terminal button and its gap, on a tab that has one.const TAB_TERMINAL_W: f32 = 22. + 8.;const SIDEBAR_MIN: f32 = 160.;++/// The least height of a sidebar row: the look's own (`base`), 8 px less when compact (Settings > Appearance, issue 266).+fn sidebar_row_height(base: f32, compact: bool) -> f32 {+ base - if compact { 8. } else { 0. }+}/// The icons-only sidebar, and the width below which a drag collapses to it.const RAIL_W: f32 = 56.;/// The full sidebar's way out of the rail: the spring's time and how far it swings past its place (a little: it is a panel, not a