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.

Switching the Dock off gives the taskbar's auto-hide back

gelenmedya11228cc58bbd
diff --git a/crates/rf-app/src/dock/host.rs b/crates/rf-app/src/dock/host.rs
index d970869a..31e94c97 100644
--- a/crates/rf-app/src/dock/host.rs
+++ b/crates/rf-app/src/dock/host.rs
@@ -1669,6 +1669,7 @@ fn apply_reloaded(fresh: Option<Settings>, stamp: Option<SystemTime>, cx: &mut A
if was_on.is_some_and(|was_on| switch_stops(was_on, fresh.dock_enabled)) {
log::info!("dock: the switch is off in the settings file; stopping");
crate::shell::exits::log_exit(crate::shell::exits::Exit::SwitchOff, "");
+ crate::shell::taskbar_hide::release_autohide_now();
shutdown(cx);
return;
}
@@ -2128,6 +2129,7 @@ pub fn run(messages: Option<UnboundedReceiver<String>>, cx: &mut App) {
match control::parse_command(&line) {
Command::Stop => {
crate::shell::exits::log_exit(crate::shell::exits::Exit::StopMessage, "");
+ crate::shell::taskbar_hide::release_autohide_now();
cx.update(shutdown);
break;
}
diff --git a/crates/rf-app/src/shell/taskbar_hide.rs b/crates/rf-app/src/shell/taskbar_hide.rs
index ed289f6e..679d3f8e 100644
--- a/crates/rf-app/src/shell/taskbar_hide.rs
+++ b/crates/rf-app/src/shell/taskbar_hide.rs
@@ -235,6 +235,22 @@ fn turn_off(cx: &mut App) {
});
}
+/// The Dock was switched off, or told to stop by the main app (its switch, or "Exit"): Explorer's auto-hide goes back to the user's
+/// own value now. A plain shutdown (signing out, the PC going down) keeps it on, so that the taskbar is out of sight at the next
+/// sign-in; a Dock the user turned off must not leave the taskbar hiding at the edge of the screen, with nothing in its place.
+/// A message to Explorer: on a thread of its own, waited for two seconds at most.
+pub fn release_autohide_now() {
+ let Some(dir) = state_dir() else { return };
+ let (tx, rx) = std::sync::mpsc::channel();
+ let spawned = std::thread::Builder::new().name("taskbar-autohide".into()).spawn(move || {
+ rf_win::taskbar_autohide::release(&dir);
+ let _ = tx.send(());
+ });
+ if spawned.is_ok() {
+ let _ = rx.recv_timeout(Duration::from_secs(2));
+ }
+}
+
/// The host is shutting down: the taskbar is shown again before anything else is torn down. Waits for the thread for three seconds
/// at most; what it did not finish is the guard's to finish.
pub fn stop(cx: &mut App) {
diff --git a/crates/rf-win/src/taskbar_autohide.rs b/crates/rf-win/src/taskbar_autohide.rs
index e4dec805..539dc2b5 100644
--- a/crates/rf-win/src/taskbar_autohide.rs
+++ b/crates/rf-win/src/taskbar_autohide.rs
@@ -5,8 +5,9 @@
//! 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
+//! and turns auto-hide on; [`release`] (the hide was turned off, the Dock was switched off or told to stop, or rustyfiles is
+//! uninstalled) puts the noted value back and removes the note. A plain shutdown (signing out, the PC going down) 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