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.

Prepare persisted bottom and right dock position preferences

Atharv Tamboli4e4c08609c57
diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rs
index 22061027..cbcb556b 100644
--- a/crates/rf-app/src/settings.rs
+++ b/crates/rf-app/src/settings.rs
@@ -180,6 +180,24 @@ pub enum DockSearch {
Hidden,
}
+/// The edge on which the dock is placed. Older settings keep the bottom dock.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
+#[serde(rename_all = "lowercase")]
+pub enum DockPosition {
+ #[default]
+ Bottom,
+ Right,
+}
+
+impl DockPosition {
+ pub fn edge(self) -> rf_win::dock::layout::DockEdge {
+ match self {
+ Self::Bottom => rf_win::dock::layout::DockEdge::Bottom,
+ Self::Right => rf_win::dock::layout::DockEdge::Right,
+ }
+ }
+}
+
/// Settings -> Dock: which dock shows which running app when there is a dock on every monitor.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "lowercase")]
@@ -1041,6 +1059,8 @@ pub struct Settings {
pub dock_enabled: bool,
/// The dock keeps other windows from going under it (it registers as an application desktop toolbar).
pub dock_reserve: bool,
+ // Internal until the vertical island views and position control are wired together.
+ pub(crate) dock_position: DockPosition,
/// The city the dock's weather is for. Empty: no weather and no network request.
pub dock_weather_city: String,
/// The dock's weather is for the PC's approximate position from Windows' location service (off by default). The order: the position
@@ -1448,6 +1468,7 @@ impl Default for Settings {
palette_folder_history: true,
dock_enabled: false,
dock_reserve: true,
+ dock_position: DockPosition::Bottom,
dock_weather_city: String::new(),
dock_weather_location: false,
dock_own_start: true,
@@ -2546,12 +2567,15 @@ dock_own_notifications = 3
#[test]
fn the_dock_settings_round_trip() {
- let s = Settings { dock_enabled: true, dock_reserve: false, dock_weather_city: "Erzincan".into(), ..Default::default() };
+ assert_eq!(Settings::default().dock_position, DockPosition::Bottom);
+ let s = Settings { dock_enabled: true, dock_reserve: false, dock_position: DockPosition::Right, dock_weather_city: "Erzincan".into(), ..Default::default() };
let text = toml::to_string_pretty(&s).unwrap();
let back = Settings::parse_lenient(&text).unwrap();
assert!(back.dock_enabled);
assert!(!back.dock_reserve);
assert_eq!(back.dock_weather_city, "Erzincan");
+ assert_eq!(back.dock_position, DockPosition::Right);
+ assert_eq!(back.dock_position.edge(), rf_win::dock::layout::DockEdge::Right);
}
#[test]