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.

Desktop: copy the Windows desktop layout on request

Alpha Malick DIAWARA0a5a6fee2049
diff --git a/crates/rf-app/src/desktop_page.rs b/crates/rf-app/src/desktop_page.rs
index 26f7ae49..bd7f6028 100644
--- a/crates/rf-app/src/desktop_page.rs
+++ b/crates/rf-app/src/desktop_page.rs
@@ -146,6 +146,17 @@ pub(crate) fn entries() -> Vec<Entry> {
None,
Control::Radius(|s| s.desktop_corner_radius, |s, v| s.desktop_corner_radius = v),
),
+ // A request that is taken once: see `Settings::desktop_copy_windows` (the desktop process clears it when it has copied).
+ e(
+ "desktop-copy-windows",
+ "desktop_copy_windows",
+ General,
+ L::Copy,
+ t!("Windows masaüstünün yerleşimini kopyala"),
+ t!("rustyfiles masaüstü bir sonraki açılışında, simgelerin Windows masaüstündeki yerlerini yeniden alır; böylece simgeleriniz karışmaz. Windows'un masaüstü kullanılırken bu anahtarı açıp \"Windows'un kendi masaüstünü kullan\"ı kapatın. Kopyalanınca kendiliğinden kapanır; rustyfiles masaüstündeki mevcut yerleşimin yerini alır."),
+ None,
+ Control::Switch(|s| s.desktop_copy_windows, |s, v| s.desktop_copy_windows = v),
+ ),
e(
"desktop-icon-this-pc",
"desktop_icon_this_pc",
@@ -297,7 +308,7 @@ mod tests {
let g = grouped(&entries());
assert_eq!(g.iter().map(|(s, _)| *s).collect::<Vec<_>>(), Section::ALL.to_vec());
let fields = |sec: Section| g.iter().find(|(s, _)| *s == sec).map(|(_, v)| v.iter().map(|e| e.field).collect::<Vec<_>>()).unwrap();
- assert_eq!(fields(Section::General), ["shell_desktop_cover", "desktop_show_icons", "desktop_corner_radius"]);
+ assert_eq!(fields(Section::General), ["shell_desktop_cover", "desktop_show_icons", "desktop_corner_radius", "desktop_copy_windows"]);
assert_eq!(
fields(Section::Icons),
["desktop_icon_this_pc", "desktop_icon_user_files", "desktop_icon_network", "desktop_icon_recycle_bin", "desktop_icon_control_panel"]
@@ -379,9 +390,9 @@ mod tests {
#[test]
fn the_desktop_comes_with_the_dock_unless_windows_own_is_kept_and_every_other_choice_is_a_dropdown() {
- // one switch: "use Windows' own desktop". Everything else here is the desktop's own choices, saved before the desktop runs
+ // two switches: "use Windows' own desktop" and the one-time request to copy Windows' layout. Everything else here is the desktop's own choices, saved before the desktop runs
let switches: Vec<Entry> = entries().into_iter().filter(|e| matches!(e.control, Control::Switch(..))).collect();
- assert_eq!(switches.iter().map(|e| e.field).collect::<Vec<_>>(), ["shell_desktop_cover"]);
+ assert_eq!(switches.iter().map(|e| e.field).collect::<Vec<_>>(), ["shell_desktop_cover", "desktop_copy_windows"]);
assert_eq!(entries()[0].field, "shell_desktop_cover", "first on the page: it decides whether the rest does anything");
// the desktop runs with the dock and stops with it
let on = Settings { dock_enabled: true, ..Default::default() };
diff --git a/crates/rf-app/src/i18n_en.rs b/crates/rf-app/src/i18n_en.rs
index 5b33cb3b..64cb07a0 100644
--- a/crates/rf-app/src/i18n_en.rs
+++ b/crates/rf-app/src/i18n_en.rs
@@ -2494,4 +2494,13 @@ pub const EN: &[(&str, &str)] = &[
("Kapalıyken Ctrl+9, 9. sekmeye geçer.", "When off, Ctrl+9 switches to the 9th tab."),
("Saatte saniyeleri göster", "Show seconds in the clock"),
("Dock'un saati saniyeleri de gösterir; saat o zaman dakikada bir değil, saniyede bir yeniden çizilir.", "The Dock's clock shows the seconds too; it is then drawn again every second instead of once a minute."),
+ ("Masaüstündeyken Dock'u gizle", "Hide the dock on the desktop"),
+ ("Otomatik gizleme açıkken Dock, ekranı kaplayan büyütülmüş bir pencere yokken (masaüstü, ortada duran küçük pencereler dahil) saklanır; bir pencere büyütülünce ya da imleç alt kenara gelince geri gelir. OLED ekranlarda ekran yanmasını önler.", "With auto-hide on, the dock hides while no maximized window fills the screen (the desktop, even with small windows floating on it) and comes back when a window is maximized or the pointer reaches the bottom edge. It keeps an OLED screen from burn-in."),
+ ("Dock boyu", "Dock height"),
+ ("Otomatik: ekranda büyütülmüş bir pencere varken orta ada yan adalar kadar inceleşir ve pencere o kadar yer kazanır. Büyük ve Kompakt: Dock pencerelere bakmadan hep o boyda kalır. Her üçünde de fareyi yaklaştırınca simgeler büyür.", "Automatic: while a maximized window is on the screen the middle island becomes as thin as the side islands and the window gains that room. Large and Compact: the dock always keeps that height, whatever the windows do. In all three the icons grow when the pointer comes near."),
+ ("Kompakt", "Compact"),
+ ("Klasik Başlat menüsü", "Classic Start menu"),
+ ("Başlat paneli, sabitlenmiş uygulamaları solda bir liste, Belgeler, Resimler, Bu bilgisayar, Denetim Masası gibi konumları sağda gösteren klasik bir menü olarak açılır. Kapalıyken simge ızgarası görünür.", "The Start panel opens as a classic menu: the pinned apps as a list on the left, and places such as Documents, Pictures, This PC and Control Panel on the right. Off: the grid of tiles is shown."),
+ ("Windows masaüstünün yerleşimini kopyala", "Copy the Windows desktop layout"),
+ ("rustyfiles masaüstü bir sonraki açılışında, simgelerin Windows masaüstündeki yerlerini yeniden alır; böylece simgeleriniz karışmaz. Windows'un masaüstü kullanılırken bu anahtarı açıp \"Windows'un kendi masaüstünü kullan\"ı kapatın. Kopyalanınca kendiliğinden kapanır; rustyfiles masaüstündeki mevcut yerleşimin yerini alır.", "The next time the rustyfiles desktop starts, it takes the icon positions from the Windows desktop again, so your icons are not mixed up. While Windows' desktop is in use, turn this on and turn off \"Use Windows' own desktop\". It turns itself off once copied, and replaces the layout the rustyfiles desktop has now."),
];
diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rs
index 5399681f..05fce578 100644
--- a/crates/rf-app/src/settings.rs
+++ b/crates/rf-app/src/settings.rs
@@ -1298,6 +1298,9 @@ pub struct Settings {
/// All four corners of every monitor, black behind them (`rf_core::desktop::corners` for the bottom pixel row). An experiment
/// to go with the dock's round islands.
pub desktop_corner_radius: u8,
+ /// A request, taken once: the next time rustyfiles' own desktop starts, it takes the icon positions of Windows' desktop again (as the
+ /// first start does) and clears this. Off by itself afterwards.
+ pub desktop_copy_windows: bool,
// ---- Ferry (sending files to rustyfiles on the network's other devices; Settings -> "Ferry"; crates/rf-nearby and ferry.rs)
/// Ferry runs in the main process (off by default: it listens on a network port, and Windows' firewall may ask about that).
@@ -1619,6 +1622,7 @@ impl Default for Settings {
desktop_icon_control_panel: Default::default(),
desktop_show_icons: Default::default(),
desktop_corner_radius: 0,
+ desktop_copy_windows: false,
ferry_enabled: false,
ferry_visibility: FerryVisibility::Trusted,
ferry_name: String::new(),
diff --git a/crates/rf-app/src/shell/cover.rs b/crates/rf-app/src/shell/cover.rs
index c9d3f081..924cbe3d 100644
--- a/crates/rf-app/src/shell/cover.rs
+++ b/crates/rf-app/src/shell/cover.rs
@@ -340,9 +340,14 @@ fn start(cx: &mut App) {
let mut args = super::desktop::args::parse(&[], env_dir.as_deref());
args.writable = guard.is_none();
let settings = cx.global::<Settings>();
+ // "Copy Windows' desktop layout" (Settings > Masaüstü): taken once, here, and cleared; the loader below imports again for it
+ let copy_windows = settings.desktop_copy_windows;
let visibility = Visibility { show_hidden: settings.show_hidden, show_system: settings.show_system_files, dot_hidden: false };
let config_dir = crate::settings::app_dir();
+ if copy_windows {
+ crate::settings::update(cx, |s| s.desktop_copy_windows = false);
+ }
let load_tx = tx.clone();
let spawned = std::thread::Builder::new().name("rf-cover-load".into()).spawn(move || {
let change_tx = parking_lot::Mutex::new(load_tx.clone());
@@ -355,6 +360,9 @@ fn start(cx: &mut App) {
let (user, public) = (rf_win::desktop::items::user_desktop_dir(), rf_win::desktop::items::public_desktop_dir());
let specs = loaded.backend.specs.clone();
// (a protected Desktop imports nothing either: it is not meant to be touched, and the layout file is not ours to settle yet)
+ if copy_windows {
+ loaded.store.imported_from_explorer = false;
+ }
let outcome = import_view_once(&mut loaded.store, scratch || loaded.backend.read_only, &specs, || rf_win::desktop::import::read_explorer_positions(user, public).map(|p| RawView { positions: p.positions, spacing: p.spacing, icon_px: p.icon_px }));
match &outcome {
ImportOutcome::Imported { fit, total } => log::info!("cover: imported the positions of {fit} of {total} icons from Explorer"),