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.

Start at sign-in through a task; Explorer's taskbar starts hidden with the Dock

gelenmedya469d66a8d522
diff --git a/crates/rf-app/src/installer.rs b/crates/rf-app/src/installer.rs
index 3a3d7817..acac295a 100644
--- a/crates/rf-app/src/installer.rs
+++ b/crates/rf-app/src/installer.rs
@@ -17,7 +17,7 @@ pub const APP_ID: &str = "velopack.rustyfiles";
/// Whether a process started with this first argument may apply a waiting update as it starts. Velopack does that before any code
/// of ours runs, and it ends every running rustyfiles process to do it.
///
-/// WHY NOT EVERY PROCESS (the updater's log on the user's PC, 2026-11-14: an update from 0.7.0 to 0.7.2 was applied by a process
+/// WHY NOT EVERY PROCESS (the updater's log: an update from 0.7.0 to 0.7.2 was applied by a process
/// started with `--pick`, that is by another program's Open dialog; the dock, the picker, the quick search and the main app in the
/// background are all started without the user asking for rustyfiles). Only a start the user means as "open rustyfiles" applies it:
/// no argument, a folder or file to open, or a Settings page. Everything that begins with `--` otherwise is a side process (and
@@ -85,6 +85,10 @@ fn before_uninstall() {
let none = Path::new("");
let _ = rf_win::dialogs::set_start_with_windows_as("DirectLook", none, &[], false);
let _ = rf_win::dialogs::set_start_with_windows(none, false);
+ // Explorer's auto-hide, if the Dock turned it on, back to the user's own value
+ if let Some(dir) = crate::settings::path().and_then(|p| p.parent().map(Path::to_path_buf)) {
+ rf_win::taskbar_autohide::release(&dir);
+ }
// DirectLook holds its exe open
rf_win::single_instance::send_to(&crate::look::ipc::app_name(), &crate::look::ipc::Msg::Quit.encode());
std::thread::sleep(Duration::from_millis(500));
@@ -114,8 +118,7 @@ static STATE: Mutex<Option<State>> = Mutex::new(None);
static IMPORTANT: Mutex<Option<String>> = Mutex::new(None);
/// The mark that makes a release an important one: a line in its release notes on GitHub, an HTML comment, so nobody reading the
-/// notes sees it. WHY (the owner, 2026-11-17, the morning 0.8.6 left the dock empty: "güncelleme denetimine de önemli fix modu
-/// ekleyelim. bunun gibi önemli fixleri yayınlayınca önemli bir güncelleme olduğunu belirtsin uygulamada"): an update was always
+/// notes sees it. WHY (0.8.6 left the dock empty): an update was always
/// announced the same quiet way, "ready, restart", which a fix for a broken dock should not be.
pub const IMPORTANT_MARK: &str = "<!-- rustyfiles: important -->";
diff --git a/crates/rf-app/src/shell/taskbar_hide.rs b/crates/rf-app/src/shell/taskbar_hide.rs
index 7ba9eff3..a323c7da 100644
--- a/crates/rf-app/src/shell/taskbar_hide.rs
+++ b/crates/rf-app/src/shell/taskbar_hide.rs
@@ -147,6 +147,9 @@ fn state_dir() -> Option<std::path::PathBuf> {
fn stale_check() {
let Some(dir) = state_dir() else { return };
let spawned = std::thread::Builder::new().name("taskbar-stale-check".into()).spawn(move || {
+ // Explorer's auto-hide, turned on while the hide was wanted, goes back to the user's value (the hide was turned off while
+ // rustyfiles was not running)
+ rf_win::taskbar_autohide::release(&dir);
if !taskbar_hide::stale_record_present(&dir) {
return;
}
@@ -171,6 +174,10 @@ fn start(cx: &mut App) {
// The bottom edge waits for the dock's word: a hider that starts before the dock has said what its band is would give the whole
// monitor to maximised windows over the dock and set the work area a second time when the band arrives.
let band = current_band();
+ // Explorer's own auto-hide too, so that at the next sign-in its taskbar is out of sight before rustyfiles has started
+ // (`rf_win::taskbar_autohide`; a message to Explorer, so off the interface thread)
+ let dir = state_dir.clone();
+ let _ = std::thread::Builder::new().name("taskbar-autohide".into()).spawn(move || rf_win::taskbar_autohide::engage(&dir));
let cfg = Config { state_dir, guard_exe: taskbar_hide::guard_next_to_exe(), band_px: band.flatten(), band_known: band.is_some() };
match TaskbarHider::start(cfg) {
Ok(hider) => {
@@ -212,7 +219,14 @@ fn turn_off(cx: &mut App) {
crate::dock::parts_status::note(Part::Taskbar, None);
let Hiding { hider } = cx.remove_global::<Hiding>();
hider.set_wanted(false);
- std::thread::spawn(move || hider.stop(Duration::from_secs(5)));
+ let dir = state_dir();
+ std::thread::spawn(move || {
+ hider.stop(Duration::from_secs(5));
+ // and Explorer's auto-hide goes back to the user's own value
+ if let Some(dir) = dir {
+ rf_win::taskbar_autohide::release(&dir);
+ }
+ });
}
/// The host is shutting down: the taskbar is shown again before anything else is torn down. Waits for the thread for three seconds
diff --git a/crates/rf-win/src/dialogs.rs b/crates/rf-win/src/dialogs.rs
index be3d20bb..97f42edf 100644
--- a/crates/rf-win/src/dialogs.rs
+++ b/crates/rf-win/src/dialogs.rs
@@ -82,10 +82,89 @@ pub fn starts_with_windows_as(name: &str) -> bool {
windows_registry::CURRENT_USER.open(RUN_KEY).and_then(|k| k.get_string(name)).is_ok()
}
-/// The app's own entry starts it with `--background`: no window at sign-in, only what runs in the background (a user, 2026-11-30:
-/// "rustyfiles itself comes onto the screen as it starts; starting in the background would be enough").
+/// The app's own entry starts it with `--background`: no window at sign-in, only what runs in the background (a window at sign-in is more than is wanted).
+///
+/// Two entries do it. The Run value is the switch's state and the fallback; Windows starts its Run list only after the desktop is
+/// up and then late on purpose (about 19 s after Explorer on a desktop PC), so Explorer's taskbar was seen before the Dock every
+/// time. A Task Scheduler task with a sign-in trigger starts the app at once, beside Explorer, at normal priority. When both run,
+/// the later start only greets the running app and opens nothing, so the Run value costs one short process and keeps the app
+/// starting if the task cannot be made or is removed.
pub fn set_start_with_windows(exe: &Path, on: bool) -> windows::core::Result<()> {
- set_start_with_windows_as(RUN_VALUE, exe, &["--background"], on)
+ set_start_with_windows_as(RUN_VALUE, exe, &["--background"], on)?;
+ if let Err(e) = set_sign_in_task(exe, on) {
+ log::warn!("start with Windows: the sign-in task could not be {}: {e}", if on { "made" } else { "removed" });
+ }
+ Ok(())
+}
+
+/// The sign-in task's name: one per user (the root folder of the Task Scheduler is shared by every account of the PC).
+fn sign_in_task_name() -> String {
+ format!("rustyfiles start ({})", std::env::var("USERNAME").unwrap_or_default())
+}
+
+fn xml_escape(s: &str) -> String {
+ s.replace('&', "&amp;").replace('<', "&lt;").replace('>', "&gt;").replace('"', "&quot;")
+}
+
+/// The task's definition: the user's own sign-in, the user's own rights (no administrator), normal priority (a task's default is
+/// below normal), no time limit, also on battery.
+fn sign_in_task_xml(exe: &Path, user: &str) -> String {
+ let (exe, user) = (xml_escape(&exe.to_string_lossy()), xml_escape(user));
+ format!(
+ r#"<?xml version="1.0" encoding="UTF-16"?>
+<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
+ <RegistrationInfo><Description>Starts rustyfiles when you sign in, without the delay of Windows' start-up list, so the Dock is there first. Made and removed by Settings in rustyfiles (Start with Windows).</Description></RegistrationInfo>
+ <Triggers><LogonTrigger><Enabled>true</Enabled><UserId>{user}</UserId></LogonTrigger></Triggers>
+ <Principals><Principal id="Author"><UserId>{user}</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals>
+ <Settings>
+ <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
+ <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
+ <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
+ <AllowHardTerminate>false</AllowHardTerminate>
+ <StartWhenAvailable>false</StartWhenAvailable>
+ <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
+ <IdleSettings><StopOnIdleEnd>false</StopOnIdleEnd><RestartOnIdle>false</RestartOnIdle></IdleSettings>
+ <AllowStartOnDemand>true</AllowStartOnDemand>
+ <Enabled>true</Enabled>
+ <Hidden>false</Hidden>
+ <RunOnlyIfIdle>false</RunOnlyIfIdle>
+ <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
+ <Priority>4</Priority>
+ </Settings>
+ <Actions Context="Author"><Exec><Command>{exe}</Command><Arguments>--background</Arguments></Exec></Actions>
+</Task>
+"#
+ )
+}
+
+/// Makes (or replaces) or removes the sign-in task, through `schtasks.exe` (no administrator rights needed for a task of one's
+/// own account). Removing a task that is not there is not an error.
+pub fn set_sign_in_task(exe: &Path, on: bool) -> std::io::Result<()> {
+ use std::os::windows::process::CommandExt;
+ const CREATE_NO_WINDOW: u32 = 0x0800_0000;
+ let schtasks = std::env::var_os("WINDIR").map(PathBuf::from).unwrap_or_else(|| PathBuf::from(r"C:\Windows")).join(r"System32\schtasks.exe");
+ let name = sign_in_task_name();
+ if !on {
+ let out = std::process::Command::new(&schtasks).args(["/Delete", "/TN", &name, "/F"]).creation_flags(CREATE_NO_WINDOW).output()?;
+ let _ = out;
+ return Ok(());
+ }
+ let user = format!("{}\\{}", std::env::var("USERDOMAIN").unwrap_or_default(), std::env::var("USERNAME").unwrap_or_default());
+ // schtasks reads the file as UTF-16 (the encoding the XML names)
+ let mut bytes = vec![0xFF, 0xFE];
+ for u in sign_in_task_xml(exe, &user).encode_utf16() {
+ bytes.extend_from_slice(&u.to_le_bytes());
+ }
+ let file = std::env::temp_dir().join(format!("rustyfiles-sign-in-task-{}.xml", std::process::id()));
+ std::fs::write(&file, &bytes)?;
+ let out = std::process::Command::new(&schtasks).args(["/Create", "/TN", &name, "/XML"]).arg(&file).arg("/F").creation_flags(CREATE_NO_WINDOW).output();
+ let _ = std::fs::remove_file(&file);
+ let out = out?;
+ if out.status.success() {
+ Ok(())
+ } else {
+ Err(std::io::Error::other(String::from_utf8_lossy(&out.stderr).trim().to_string()))
+ }
}
/// Run value `name` → `"exe" args…` (HKCU, no admin rights).
diff --git a/crates/rf-win/src/lib.rs b/crates/rf-win/src/lib.rs
index 24282aea..1c38f930 100644
--- a/crates/rf-win/src/lib.rs
+++ b/crates/rf-win/src/lib.rs
@@ -68,6 +68,7 @@ pub mod portable;
pub mod neighbours;
pub mod openrules;
pub mod ownfolder;
+pub mod taskbar_autohide;
pub mod taskbar_hide;
pub mod taskbar_progress;
pub mod usn;
diff --git a/crates/rf-win/src/taskbar_autohide.rs b/crates/rf-win/src/taskbar_autohide.rs
new file mode 100644
index 00000000..7acfc38d
--- /dev/null
+++ b/crates/rf-win/src/taskbar_autohide.rs
@@ -0,0 +1,87 @@
+//! Explorer's own "Automatically hide the taskbar" while the Dock hides the taskbar.
+//!
+//! WHY: the Dock hides Explorer's taskbar windows once it runs, but at sign-in Explorer is up some seconds before rustyfiles, and
+//! its taskbar was seen every time until the Dock came. With Explorer's own auto-hide on, Explorer starts with its taskbar already
+//! out of sight, so the Dock is the first bar seen.
+//!
+//! The rule: [`engage`] (the hide is wanted) notes the user's own value once, in `taskbar-autohide-before` in the settings folder,
+//! and turns auto-hide on; [`release`] (the hide was turned off, or rustyfiles is uninstalled) puts the noted value back and
+//! removes the note. A shutdown does neither: the setting has to stay on for the next sign-in. A crash leaves auto-hide on, which
+//! is harmless (the taskbar still slides up at the screen's edge) and is undone the next time the hide is turned off.
+//!
+//! The change goes through `SHAppBarMessage(ABM_SETSTATE)`, as the Settings app's switch does (Explorer keeps it in its own
+//! `StuckRects3` value); it sends a message to Explorer, so it is never called on an interface thread.
+
+use std::path::{Path, PathBuf};
+
+use windows::Win32::UI::Shell::{ABM_GETSTATE, ABM_SETSTATE, ABS_ALWAYSONTOP, ABS_AUTOHIDE, APPBARDATA, SHAppBarMessage};
+use windows::Win32::UI::WindowsAndMessaging::FindWindowW;
+use windows::core::w;
+
+/// The note of the user's own value, in the settings folder.
+pub const NOTE_FILE: &str = "taskbar-autohide-before";
+
+/// Whether Explorer's auto-hide is on now (`None` without Explorer's taskbar).
+pub fn get() -> Option<bool> {
+ let tray = unsafe { FindWindowW(w!("Shell_TrayWnd"), None) }.ok()?;
+ let mut d = APPBARDATA { cbSize: std::mem::size_of::<APPBARDATA>() as u32, hWnd: tray, ..Default::default() };
+ let state = unsafe { SHAppBarMessage(ABM_GETSTATE, &mut d) } as u32;
+ Some(state & ABS_AUTOHIDE != 0)
+}
+
+/// Turns Explorer's auto-hide on or off (keeping "always on top", which every Windows since 7 forces anyway).
+pub fn set(on: bool) -> bool {
+ let Ok(tray) = (unsafe { FindWindowW(w!("Shell_TrayWnd"), None) }) else { return false };
+ let mut d = APPBARDATA { cbSize: std::mem::size_of::<APPBARDATA>() as u32, hWnd: tray, ..Default::default() };
+ d.lParam = windows::Win32::Foundation::LPARAM((if on { ABS_AUTOHIDE } else { 0 } | ABS_ALWAYSONTOP) as isize);
+ unsafe { SHAppBarMessage(ABM_SETSTATE, &mut d) };
+ get() == Some(on)
+}
+
+fn note(dir: &Path) -> PathBuf {
+ dir.join(NOTE_FILE)
+}
+
+/// What the note says the user's own value was (`None`: no note).
+pub fn noted(dir: &Path) -> Option<bool> {
+ std::fs::read_to_string(note(dir)).ok().map(|s| s.trim() == "1")
+}
+
+/// The hide is wanted: the user's value is noted (only when no note is there yet, so a second engage never notes our own "on"),
+/// then auto-hide goes on. Without Explorer's taskbar nothing is done.
+pub fn engage(dir: &Path) {
+ let Some(now) = get() else { return };
+ if noted(dir).is_none() && std::fs::write(note(dir), if now { "1" } else { "0" }).is_err() {
+ // without a note the value could not be put back: better not to change it
+ log::warn!("taskbar auto-hide: the user's value could not be noted; left as it is");
+ return;
+ }
+ if !now && !set(true) {
+ log::warn!("taskbar auto-hide: could not be turned on");
+ }
+}
+
+/// The hide is no longer wanted: the noted value goes back and the note goes. Nothing is done without a note.
+pub fn release(dir: &Path) {
+ let Some(before) = noted(dir) else { return };
+ if get().is_some() && get() != Some(before) && !set(before) {
+ log::warn!("taskbar auto-hide: the user's value could not be put back; the note is kept for the next try");
+ return;
+ }
+ let _ = std::fs::remove_file(note(dir));
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn the_note_reads_back_and_a_missing_note_is_none() {
+ let dir = std::env::temp_dir().join(format!("rf-autohide-test-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ assert_eq!(super::noted(&dir), None);
+ std::fs::write(dir.join(super::NOTE_FILE), "1").unwrap();
+ assert_eq!(super::noted(&dir), Some(true));
+ std::fs::write(dir.join(super::NOTE_FILE), "0\n").unwrap();
+ assert_eq!(super::noted(&dir), Some(false));
+ let _ = std::fs::remove_dir_all(&dir);
+ }
+}