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
Implement live vertical right-edge dock rendering and position switching
Atharv Tamboli71c25a6ce2cf
diff --git a/crates/rf-app/locales/_source.json b/crates/rf-app/locales/_source.jsonindex d98d8289..0320c8cd 100644--- a/crates/rf-app/locales/_source.json+++ b/crates/rf-app/locales/_source.json@@ -14939,5 +14939,17 @@"key": "Adres çubuğuna @ad yazarak klasöre gidin. Eklemek için bir klasöre Shift basılıyken sağ tıklayıp \"Takma ad ver…\" seçin (ya da Ayarlar › Genel › Sağ tık menüsünde her zaman tüm komutlar).","tr": "Adres çubuğuna @ad yazarak klasöre gidin. Eklemek için bir klasöre Shift basılıyken sağ tıklayıp \"Takma ad ver…\" seçin (ya da Ayarlar › Genel › Sağ tık menüsünde her zaman tüm komutlar).","en": "Type @name in the address bar to go to a folder. To add one, right-click a folder with Shift held and choose \"Add alias…\" (or turn on Settings › General › Always every command in the right-click menu)."+ },+ {+ "id": "cd401ec5",+ "key": "Dock sag kenarda",+ "tr": "Dock sag kenarda",+ "en": "Dock on the right edge"+ },+ {+ "id": "7ddaefd0",+ "key": "Dock'u ekranin sag kenarina tasi. Kapaliyken alt kenarda kalir.",+ "tr": "Dock'u ekranin sag kenarina tasi. Kapaliyken alt kenarda kalir.",+ "en": "Move the dock to the right edge. When off, it stays at the bottom."}-]\ No newline at end of file+]diff --git a/crates/rf-app/src/dock/app_menu.rs b/crates/rf-app/src/dock/app_menu.rsindex 6911c894..fc436b60 100644--- a/crates/rf-app/src/dock/app_menu.rs+++ b/crates/rf-app/src/dock/app_menu.rs@@ -158,6 +158,7 @@ fn open_now(req: MenuRequest, started: Instant, cx: &mut App) {return;};let dark = req.glass.borrow().dark();+ let vertical = host::vertical(cx);let anchor_x = req.anchor_x.round() as i32;let serial = {let was_open = cx.try_global::<MenuHost>().is_some_and(|h| h.open);@@ -173,7 +174,7 @@ fn open_now(req: MenuRequest, started: Instant, cx: &mut App) {p.opened_at = Some(Instant::now());p.been_front = false;p.mouse_was_down = geo::any_button_down();- p.basis = Some(Basis { scale, work, glass_top: glass.top });+ p.basis = Some(Basis { scale, work, glass_top: if vertical { glass.left } else { glass.top } });p.anchor_x = anchor_x;p.serial};@@ -186,7 +187,7 @@ fn open_now(req: MenuRequest, started: Instant, cx: &mut App) {(model::WIDTH, v.height())}).unwrap_or((model::WIDTH, 160.0));- let rect = place::above_icon(anchor_x, glass.top, size, scale, host::size_on(host::active(cx), cx), work);+ let rect = if vertical { place::beside_icon(anchor_x, glass.left, size, scale, host::size_on(host::active(cx), cx), work) } else { place::above_icon(anchor_x, glass.top, size, scale, host::size_on(host::active(cx), cx), work) };host_g(cx).rect = rect;// show, bring to the front, then glass (in this order: the engine attaches to a window that is on the screen)cx.spawn(async move |cx| {@@ -238,14 +239,14 @@ fn sections_arrived(serial: u64, sections: Vec<Section>, cx: &mut App) {let (basis, anchor_x) = (h.basis, h.anchor_x);let Some(basis) = basis else { return };// (the room above the dock: a long jump list is cut to what fits, so that the fixed rows at the bottom are never cut off)- let room = place::room_above(basis.glass_top, basis.scale, host::size_on(host::active(cx), cx), basis.work);+ let room = if host::vertical(cx) { basis.work.height() as f32 / basis.scale } else { place::room_above(basis.glass_top, basis.scale, host::size_on(host::active(cx), cx), basis.work) };let Ok(height) = handle.update(cx, |v, _, cx| {v.set_sections(sections, room, cx);v.height()}) else {return;};- let rect = place::above_icon(anchor_x, basis.glass_top, (model::WIDTH, height), basis.scale, host::size_on(host::active(cx), cx), basis.work);+ let rect = if host::vertical(cx) { place::beside_icon(anchor_x, basis.glass_top, (model::WIDTH, height), basis.scale, host::size_on(host::active(cx), cx), basis.work) } else { place::above_icon(anchor_x, basis.glass_top, (model::WIDTH, height), basis.scale, host::size_on(host::active(cx), cx), basis.work) };if cx.global::<MenuHost>().rect == rect {return;}@@ -279,7 +280,7 @@ fn watch_once(serial: u64, cx: &mut App) -> bool {close(CloseCause::FullScreen, cx);return false;}- let now = popup_win::anchor_basis(cx).map(|(scale, work, glass)| Basis { scale, work, glass_top: glass.top });+ let now = popup_win::anchor_basis(cx).map(|(scale, work, glass)| Basis { scale, work, glass_top: if host::vertical(cx) { glass.left } else { glass.top } });if then.is_some_and(|t| basis_changed(&t, now)) {close(CloseCause::LayoutChanged, cx);return false;diff --git a/crates/rf-app/src/dock/control.rs b/crates/rf-app/src/dock/control.rsindex 3558c943..15a5c525 100644--- a/crates/rf-app/src/dock/control.rs+++ b/crates/rf-app/src/dock/control.rs@@ -119,6 +119,7 @@ static TOLD: Mutex<Told> = Mutex::new(Told { started: None, keys: None });#[derive(Clone, Debug, PartialEq, Eq)]pub struct Keys {pub reserve: bool,+ pub position: crate::settings::DockPosition,pub city: String,/// The weather from the PC's position: the running dock must start (or stop) asking Windows for it.pub weather_location: bool,@@ -178,6 +179,7 @@ impl Keys {pub fn of(s: &Settings) -> Keys {Keys {reserve: s.dock_reserve,+ position: s.dock_position,city: s.dock_weather_city.trim().to_string(),weather_location: s.dock_weather_location,look: [s.hg_frost, s.hg_tint, s.hg_refraction, s.hg_saturation],@@ -387,7 +389,7 @@ mod tests {}fn keys(reserve: bool, city: &str) -> Keys {- Keys { reserve, city: city.into(), weather_location: false, look: [52, 50, 67, 62], magnify: crate::settings::DockMagnify::Full, animations: crate::settings::AnimPref::System, own_start: true, own_control_centre: true, own_calendar: true, own_notifications: true, status: Default::default(), side_tall: false, tray_compact: false, tray_two_rows: false, show_desktop: false, clock_seconds: false, labels: false, pins_left: false, hover_previews: true, app_menu: true, thin_when_maximized: true, start_recommended: true, start_grow: true, size: Default::default(), all_monitors: true, apps_where: crate::settings::DockAppsWhere::All, middle_shape: (false, false, String::new()), shell: [false; 5], corner_radius: 24, preview_size: 100 }+ Keys { reserve, position: crate::settings::DockPosition::Bottom, city: city.into(), weather_location: false, look: [52, 50, 67, 62], magnify: crate::settings::DockMagnify::Full, animations: crate::settings::AnimPref::System, own_start: true, own_control_centre: true, own_calendar: true, own_notifications: true, status: Default::default(), side_tall: false, tray_compact: false, tray_two_rows: false, show_desktop: false, clock_seconds: false, labels: false, pins_left: false, hover_previews: true, app_menu: true, thin_when_maximized: true, start_recommended: true, start_grow: true, size: Default::default(), all_monitors: true, apps_where: crate::settings::DockAppsWhere::All, middle_shape: (false, false, String::new()), shell: [false; 5], corner_radius: 24, preview_size: 100 }}#[test]@@ -434,6 +436,7 @@ mod tests {Settings { dock_status_order: vec!["volume".into(), "network".into()], ..base.clone() },Settings { dock_status_hidden: vec!["security".into()], ..base.clone() },Settings { dock_side_tall: true, ..base.clone() },+ Settings { dock_position: crate::settings::DockPosition::Right, ..base.clone() },] {let mut told = Some(k.clone());assert!(needs_reload(&mut told, Keys::of(&change)), "{:?}", Keys::of(&change));diff --git a/crates/rf-app/src/dock/host.rs b/crates/rf-app/src/dock/host.rsindex d87537ff..708d3c1c 100644--- a/crates/rf-app/src/dock/host.rs+++ b/crates/rf-app/src/dock/host.rs@@ -36,7 +36,7 @@ use gpui_kit::prelude::FluentBuilder as _;use gpui_kit::*;use rf_win::dock::hit;use rf_win::dock::island;-use rf_win::dock::layout::{self, Islands, Placement, Placements, radius, Rect, Widths};+use rf_win::dock::layout::{self, DockEdge, Islands, Placement, Placements, radius, Rect, Widths};use rf_win::dock::monitors::{self, Change, Content, Search, Wants};use rf_win::dock::size_live::{self, Act, File as SizeFile, Live as SizeLive, Msg as SizeMsg, Redo, Step};use rf_win::dock::thin::Squeeze;@@ -83,6 +83,7 @@ impl MonId {pub struct Prefs {/// Keep other windows from going under the dock (the application desktop toolbar).pub reserve: bool,+ pub position: DockEdge,/// The weather city, trimmed. Empty: no weather from a city.pub city: String,/// The weather from the PC's position (Windows' location service); the city is the fallback.@@ -113,6 +114,7 @@ impl Prefs {pub fn of(s: &Settings) -> Prefs {Prefs {reserve: s.dock_reserve,+ position: s.dock_position.edge(),city: s.dock_weather_city.trim().to_string(),location: s.dock_weather_location,size: s.dock_size,@@ -157,15 +159,15 @@ pub struct Changes {pub fn changes(old: &Prefs, new: &Prefs) -> Changes {Changes {- reserve: old.reserve != new.reserve,+ reserve: old.reserve != new.reserve || old.position != new.position,city: old.city != new.city || old.location != new.location,- size: old.size != new.size,+ size: old.size != new.size || old.position != new.position,monitors: old.all_monitors != new.all_monitors,apps: old.apps_where != new.apps_where || old.pins_left != new.pins_left,// (a new corner radius: the islands' windows take new regions and their glass new corners, as when their height changes)- side: old.side_tall != new.side_tall || old.radius != new.radius,- status: old.status != new.status,- search: old.search != new.search,+ side: old.side_tall != new.side_tall || old.radius != new.radius || old.position != new.position,+ status: old.status != new.status || old.position != new.position,+ search: old.search != new.search || old.position != new.position,autohide: old.autohide != new.autohide,opaque: old.opaque != new.opaque,}@@ -255,7 +257,7 @@ pub fn insets_on(mon: MonId, kind: Kind, cx: &App) -> Insets {};let mut insets = Insets::of(&geo, kind);if kind != Kind::Middle {- insets.margins[1] += drop as f32 / geo.scale;+ insets.margins[if vertical(cx) { 0 } else { 1 }] += drop as f32 / geo.scale;}insets}@@ -366,7 +368,9 @@ impl Host {self.system.as_ref().and_then(|s| s.placement_area()).or_else(|| rf_win::dock::primary_monitor().map(|m| (m, m.work)))} else {let told: &[i32] = if self.hide_in_force { &dock.told_bands } else { &[] };- Some((dock.monitor, monitors::placement_area(dock.monitor.rect, dock.monitor.work, told)))+ let edge = self.prefs.position;+ let area = monitors::placement_area(layout::edge_axes(dock.monitor.rect, edge), layout::edge_axes(dock.monitor.work, edge), told);+ Some((dock.monitor, layout::edge_axes(area, edge)))}}@@ -378,13 +382,13 @@ impl Host {/// The layout for a dock's display as it is now.fn compute_geo(&self, dock: &Dock) -> Option<Geo> {let (mon, area) = self.area_of(dock)?;- Some(geo_for(&mon, area, dock.widths, fitted_factor(self.prefs.size, &mon), self.prefs.side_tall))+ Some(geo_for(&mon, area, dock.widths, fitted_factor(self.prefs.size, &mon, self.prefs.position), self.prefs.side_tall, self.prefs.position))}/// The scale and the size factor a dock is drawn at.fn scale_size_of(&self, dock: &Dock) -> Option<(f32, f32)> {let (mon, _) = self.area_of(dock)?;- Some((mon.scale(), fitted_factor(self.prefs.size, &mon)))+ Some((mon.scale(), fitted_factor(self.prefs.size, &mon, self.prefs.position)))}/// What a dock holds at its width now (the home dock: everything, at every width).@@ -393,11 +397,11 @@ impl Host {return Content::HOME;}let Some((mon, area)) = self.area_of(dock) else { return dock.content };- let unit = rf_win::dock::size::unit(mon.scale(), fitted_factor(self.prefs.size, &mon)).max(0.01);+ let unit = rf_win::dock::size::unit(mon.scale(), fitted_factor(self.prefs.size, &mon, self.prefs.position)).max(0.01);monitors::content(false,&Wants {- area: area.width() as f32 / unit,+ area: layout::edge_axes(area, self.prefs.position).width() as f32 / unit,left_field: plan::left_width_secondary(Search::Field),left_button: plan::left_width_secondary(Search::Button),right_with_bell: plan::right_width_secondary(self.clock_width, true),@@ -416,20 +420,28 @@ impl Host {/// length of the layout is a number of dock units, so the layout is given the unit (the monitor's scale times the size) where it used/// to be given the monitor's scale: the one place the size enters./// `side_tall`: the side islands are as tall as the middle one (the setting); the layout then gives them that height at rest.-fn geo_for(mon: &MonitorInfo, area: Rect, widths: Widths, size: f32, side_tall: bool) -> Geo {+fn geo_for(mon: &MonitorInfo, area: Rect, widths: Widths, size: f32, side_tall: bool, edge: DockEdge) -> Geo {let scale = mon.scale();let unit = rf_win::dock::size::unit(scale, size);- let islands = layout::islands_with(area, unit, widths, layout::side_height(side_tall));- Geo { scale, unit, islands, placements: layout::placements(&islands, mon.rect, unit, layout::shadow_on()), growth_px: layout::growth_room(&islands, unit), area_width: area.width() }+ let islands = layout::islands_on_edge(area, unit, widths, layout::side_height(side_tall || edge == DockEdge::Right), edge);+ Geo { scale, unit, islands, placements: layout::placements_on_edge(&islands, mon.rect, unit, layout::shadow_on(), edge), growth_px: layout::growth_room_on_edge(&islands, unit, edge), area_width: layout::edge_axes(area, edge).width() }}/// The size factor the dock is drawn at on this monitor: the setting, cut to what the screen's width can hold (`size_live::fit_to_width`)./// The ONE place the setting becomes a factor, so the layout, the band and the views cannot disagree about it.-fn fitted_factor(size: super::size_pref::DockSizePref, mon: &MonitorInfo) -> f32 {- size_live::factor(size_live::fit_to_width(size.permille(), mon.work.width() as f32 / mon.scale()))+fn fitted_factor(size: super::size_pref::DockSizePref, mon: &MonitorInfo, edge: DockEdge) -> f32 {+ size_live::factor(size_live::fit_to_width(size.permille(), layout::edge_axes(mon.work, edge).width() as f32 / mon.scale()))}/// Whether a size slider is at work: the islands follow it but the deferred work (the band, the icons) has not been done yet.+pub fn dock_edge(cx: &App) -> DockEdge {+ cx.try_global::<Host>().map_or_else(|| cx.try_global::<Settings>().map_or(DockEdge::Bottom, |s| s.dock_position.edge()), |h| h.prefs.position)+}++pub fn vertical(cx: &App) -> bool {+ dock_edge(cx) == DockEdge::Right+}+pub fn size_drag_active(cx: &App) -> bool {cx.try_global::<Host>().is_some_and(|h| h.live.dragging())}@@ -461,7 +473,7 @@ pub fn visible_glass_rect_on(mon: MonId, kind: Kind, cx: &App) -> Option<Rect> {pub fn current_glass_rect_on(mon: MonId, kind: Kind, cx: &App) -> Option<Rect> {let dock = cx.try_global::<Host>()?.dock(mon)?;let glass = dock.geo?.glass(kind);- Some(if kind == Kind::Middle { glass } else { lowered_rect(glass, dock.side_drop) })+ Some(if kind == Kind::Middle { glass } else { layout::edge_axes(lowered_rect(layout::edge_axes(glass, dock_edge(cx)), dock.side_drop), dock_edge(cx)) })}/// The glass of this monitor's dock that is FULL height, as one rectangle: what a window docked to the band's edge is measured against@@ -471,7 +483,10 @@ pub fn current_glass_rect_on(mon: MonId, kind: Kind, cx: &App) -> Option<Rect> {pub fn full_glass_span_on(mon: MonId, cx: &App) -> Option<Rect> {let host = cx.try_global::<Host>()?;let geo = host.dock(mon)?.geo?;- Some(full_glass_span(&geo.islands, host.prefs.side_tall))+ let edge = host.prefs.position;+ let axes = |r| layout::edge_axes(r, edge);+ let logical = Islands { left: axes(geo.islands.left), middle: axes(geo.islands.middle), right: axes(geo.islands.right) };+ Some(axes(full_glass_span(&logical, host.prefs.side_tall || edge == DockEdge::Right)))}fn full_glass_span(islands: &Islands, side_tall: bool) -> Rect {@@ -483,7 +498,7 @@ fn full_glass_span(islands: &Islands, side_tall: bool) -> Rect {pub fn side_height_on(mon: MonId, cx: &App) -> f32 {let Some(host) = cx.try_global::<Host>() else { return layout::SIDE_HEIGHT };match host.dock(mon).and_then(|d| d.geo.map(|g| (g, d.side_drop))) {- Some((g, drop)) => (g.glass(Kind::Left).height() - drop) as f32 / g.unit.max(0.01),+ Some((g, drop)) => (layout::edge_axes(g.glass(Kind::Left), host.prefs.position).height() - drop) as f32 / g.unit.max(0.01),None => layout::side_height(host.prefs.side_tall),}}@@ -745,12 +760,12 @@ struct Job {/// The pieces of a window that take the pointer when nothing sticks out of the glass: the glass itself.fn rest_parts(pl: &Placement, unit: f32) -> Vec<hit::Part> {- side_parts(pl, unit, 0)+ side_parts(pl, unit, 0, DockEdge::Bottom)}/// [`rest_parts`] for a side island whose glass is lowered by `drop` device px.-fn side_parts(pl: &Placement, unit: f32, drop: i32) -> Vec<hit::Part> {- hit::parts(lowered(pl.glass_in_window(), drop), layout::px(radius(), unit) as f32, &[], pl.window.width(), pl.window.height())+fn side_parts(pl: &Placement, unit: f32, drop: i32, edge: DockEdge) -> Vec<hit::Part> {+ hit::parts(lowered_on_edge(pl.glass_in_window(), drop, edge), layout::px(radius(), unit) as f32, &[], pl.window.width(), pl.window.height())}/// A glass rectangle (x, y, w, h) with its top `drop` px lower and its bottom where it was.@@ -759,6 +774,12 @@ fn lowered(glass: [f32; 4], drop: i32) -> [f32; 4] {[glass[0], glass[1] + d, glass[2], glass[3] - d]}+fn lowered_on_edge(glass: [f32; 4], drop: i32, edge: DockEdge) -> [f32; 4] {+ if edge == DockEdge::Bottom { return lowered(glass, drop); }+ let b = lowered([glass[1], glass[0], glass[3], glass[2]], drop);+ [b[1], b[0], b[3], b[2]]+}+fn lowered_rect(glass: Rect, drop: i32) -> Rect {Rect { top: glass.top + drop.clamp(0, glass.height().max(0)), ..glass }}@@ -780,10 +801,11 @@ pub fn side_drop(tall: bool, full_px: i32, unit: f32, sq: &Squeeze) -> i32 {/// one they have. Like the middle island's frame, the region and the glass go in one task from the message loop, the region first.pub fn set_side_squeeze(mon: MonId, sq: &Squeeze, cx: &mut App) {let Some(host) = host_mut(cx) else { return };- let tall = host.prefs.side_tall;+ let edge = host.prefs.position;+ let tall = host.prefs.side_tall || edge == DockEdge::Right;let Some(dock) = host.dock_mut(mon) else { return };let Some(geo) = dock.geo else { return };- let drop = side_drop(tall, geo.glass(Kind::Left).height(), geo.unit, sq);+ let drop = side_drop(tall, layout::edge_axes(geo.glass(Kind::Left), edge).height(), geo.unit, sq);if drop == dock.side_drop {return;}@@ -794,7 +816,7 @@ pub fn set_side_squeeze(mon: MonId, sq: &Squeeze, cx: &mut App) {.filter(|p| p.kind != Kind::Middle).map(|p| {let pl = geo.placement(p.kind);- (p.hwnd, p.glass.clone(), lowered(pl.glass_in_window(), drop), side_parts(&pl, geo.unit, drop))+ (p.hwnd, p.glass.clone(), lowered_on_edge(pl.glass_in_window(), drop, edge), side_parts(&pl, geo.unit, drop, edge))}).collect();let (left, right) = (dock.left.clone(), dock.right.clone());@@ -826,7 +848,8 @@ pub fn request_layout(cx: &mut App) {// (how thin each dock is right now: a tall side island's glass is placed for it, see `side_drop`)let squeezes: Vec<(MonId, Squeeze)> = cx.try_global::<Host>().map(|h| h.docks.iter().map(|d| (d.id, super::thin::squeeze(d.id, cx))).collect()).unwrap_or_default();let Some(host) = host_mut(cx) else { return };- let tall = host.prefs.side_tall;+ let edge = host.prefs.position;+ let tall = host.prefs.side_tall || edge == DockEdge::Right;let mut jobs: Vec<Job> = Vec::new();for (id, sq) in squeezes {// (what the dock holds depends on the room it has, and the layout on what it holds: the content first)@@ -838,15 +861,15 @@ pub fn request_layout(cx: &mut App) {dock.content = c;}dock.geo = Some(geo);- let drop = side_drop(tall, geo.glass(Kind::Left).height(), geo.unit, &sq);+ let drop = side_drop(tall, layout::edge_axes(geo.glass(Kind::Left), edge).height(), geo.unit, &sq);dock.side_drop = drop;for p in &dock.placed {let pl = geo.placement(p.kind);let own = p.kind != Kind::Middle;if own {- p.glass.borrow_mut().set_shape(lowered(pl.glass_in_window(), drop));+ p.glass.borrow_mut().set_shape(lowered_on_edge(pl.glass_in_window(), drop, edge));}- jobs.push(Job { hwnd: p.hwnd, window: pl.window, parts: own.then(|| side_parts(&pl, geo.unit, drop)) });+ jobs.push(Job { hwnd: p.hwnd, window: pl.window, parts: own.then(|| side_parts(&pl, geo.unit, drop, edge)) });}dock.region = None;}@@ -954,7 +977,7 @@ pub(super) fn bring_up(mon: MonId, cx: &mut App) {/// Puts the (re)read system facts where the views and the glass can see them. `scale` is the home monitor's.fn publish_env(scale: f32, cx: &mut App) {- let size = cx.try_global::<Host>().map_or(1.0, |h| h.area().map_or_else(|| h.prefs.size.factor(), |(m, _)| fitted_factor(h.prefs.size, &m)));+ let size = cx.try_global::<Host>().map_or(1.0, |h| h.area().map_or_else(|| h.prefs.size.factor(), |(m, _)| fitted_factor(h.prefs.size, &m, h.prefs.position)));let env = Env::read_sized(scale, size);let changed = cx.try_global::<Env>().is_none_or(|old| *old != env);cx.set_global(env);@@ -1032,13 +1055,13 @@ fn apply_home_reserve(cx: &mut App) {let Some(system) = host.system.as_ref() else { return };let band = if host.prefs.reserves() {// the band is the dock's own height and margins: it follows the size too- let unit = host.area().map_or(1.0, |(m, _)| rf_win::dock::size::unit(m.scale(), fitted_factor(host.prefs.size, &m)));+ let unit = host.area().map_or(1.0, |(m, _)| rf_win::dock::size::unit(m.scale(), fitted_factor(host.prefs.size, &m, host.prefs.position)));// (the thin band while the thin dock's setting is on, whatever the windows do: see thin.rs)let thickness = rf_win::dock::thin::reserved_thickness(unit, super::thin::band_is_thin(cx));- system.reserve(thickness);+ system.reserve_on(Some(thickness), host.prefs.position);Some(thickness)} else {- system.release();+ system.reserve_on(None, host.prefs.position);None};// with Explorer's taskbar hidden by us the host sets the work area itself, from this band (see shell::taskbar_hide)@@ -1219,7 +1242,7 @@ fn open_dock(d: &monitors::Display, cx: &mut App) {dock.widths.left = plan::left_width_secondary(dock.content.search);dock.widths.right = plan::right_width_secondary(plan::clock_width(&lines), dock.content.bell);let Some(geo) = host.compute_geo(&dock) else { return };- let (scale, size) = (d.info.scale(), fitted_factor(host.prefs.size, &d.info));+ let (scale, size) = (d.info.scale(), fitted_factor(host.prefs.size, &d.info, host.prefs.position));dock.geo = Some(geo);// (all three or none: a dock that got only some of its islands would stay that way)if !make_islands(&mut dock, &geo, scale, &lines, "", false, cx) || dock.placed.len() < 3 {@@ -1490,6 +1513,9 @@ fn autohide_step(cx: &mut App) -> bool {let Some(h) = host_mut(cx) else { return false };for (id, r, band, covered) in looks {let Some(d) = h.docks.iter_mut().find(|d| d.id == id) else { continue };+ let edge = h.prefs.position;+ let r = layout::edge_axes(r, edge);+ let (x, y) = if edge == DockEdge::Right { (y, x) } else { (x, y) };let in_x = x >= r.left && x < r.right;let (at_edge, near, kept) = (in_x && y >= r.bottom - 2, in_x && y >= r.bottom - band - 16, busy && id == active);if !d.tucked && (near || kept) {@@ -1944,13 +1970,13 @@ pub fn run(messages: Option<UnboundedReceiver<String>>, cx: &mut App) {return;};let scale = monitor.scale();- let size = fitted_factor(prefs.size, &monitor);+ let size = fitted_factor(prefs.size, &monitor, prefs.position);let env = Env::read_sized(scale, size);cx.set_global(env);let lines = rf_win::dock::clock::system_lines(super::right::clock_seconds_on(cx));let widths = Widths { left: plan::left_width(None), middle: plan::middle_width_at_rest(2, 0), right: plan::right_width(&lines) };- let geo = geo_for(&monitor, area, widths, size, prefs.side_tall);+ let geo = geo_for(&monitor, area, widths, size, prefs.side_tall, prefs.position);let mut home = Dock {id: MonId::HOME,@@ -2222,7 +2248,7 @@ mod tests {}fn prefs(reserve: bool, city: &str) -> Prefs {- Prefs { reserve, city: city.into(), location: false, size: Default::default(), all_monitors: true, apps_where: crate::settings::DockAppsWhere::All, pins_left: false, side_tall: false, status: Default::default(), search: Default::default(), autohide: false, opaque: false, radius: 24 }+ Prefs { reserve, position: DockEdge::Bottom, city: city.into(), location: false, size: Default::default(), all_monitors: true, apps_where: crate::settings::DockAppsWhere::All, pins_left: false, side_tall: false, status: Default::default(), search: Default::default(), autohide: false, opaque: false, radius: 24 }}#[test]diff --git a/crates/rf-app/src/dock/hover_preview.rs b/crates/rf-app/src/dock/hover_preview.rsindex cf4c7027..8460c0c2 100644--- a/crates/rf-app/src/dock/hover_preview.rs+++ b/crates/rf-app/src/dock/hover_preview.rs@@ -319,9 +319,9 @@ fn show_now(key: String, started: Instant, cx: &mut App) {let unknown = sources.iter().take(cards.len()).filter(|s| s.is_none()).count();let probe_took = probe_started.elapsed();// Never taller than the room above the dock: a layout that would not fit has its boxes capped (the rows are not cut off).- let layout = preview::layout_in(&sources, work.width() as f32 / scale, preview::room_above(glass.top, scale, host::size_on(host::active(cx), cx), work));+ let layout = preview::layout_in(&sources, work.width() as f32 / scale, if host::vertical(cx) { work.height() as f32 / scale } else { preview::room_above(glass.top, scale, host::size_on(host::active(cx), cx), work) });let size = layout.size();- let rect = preview::above_icon(info.anchor_x.round() as i32, glass.top, size, scale, host::size_on(host::active(cx), cx), work);+ let rect = if host::vertical(cx) { preview::beside_icon(info.anchor_x.round() as i32, glass.left, size, scale, host::size_on(host::active(cx), cx), work) } else { preview::above_icon(info.anchor_x.round() as i32, glass.top, size, scale, host::size_on(host::active(cx), cx), work) };let dark = info.glass.borrow().dark();let (count, hidden, anchor) = (cards.len(), grid.hidden, info.anchor_x.round() as i32);let _ = handle.update(cx, |v, _, cx| v.set_cards(cards, layout, info.icon.clone(), info.icon_small.clone(), scale, cx));@@ -403,7 +403,7 @@ fn look_once(generation: u64, cx: &mut App) -> bool {// the preview, or from an icon up out of the dock's window, is never reported by the toolkit's hover events. Read it here; the// machine ignores a repeat of what it already knows.if let (Some(cursor), Some((scale, _, glass))) = (geo::cursor(), popup_win::anchor_basis(cx))- && preview::pointer_away(cursor, rect, glass, scale, host::size_on(host::active(cx), cx))+ && { let edge = host::dock_edge(cx); let axes = |r| rf_win::dock::layout::edge_axes(r, edge); let pointer = if host::vertical(cx) { (cursor.1, cursor.0) } else { cursor }; preview::pointer_away(pointer, axes(rect), axes(glass), scale, host::size_on(host::active(cx), cx)) }{feed(Input::Icon(None), cx);feed(Input::Preview(false), cx);diff --git a/crates/rf-app/src/dock/island_menu.rs b/crates/rf-app/src/dock/island_menu.rsindex b45a43f7..2110e78e 100644--- a/crates/rf-app/src/dock/island_menu.rs+++ b/crates/rf-app/src/dock/island_menu.rs@@ -301,7 +301,7 @@ pub fn open(req: MenuRequest, cx: &mut App) {fn basis_of(mon: MonId, kind: host::Kind, cx: &App) -> Option<(f32, Rect, i32)> {let (scale, work) = host::monitor_work(cx)?;let glass = host::current_glass_rect_on(mon, kind, cx)?;- Some((scale, work, glass.top))+ Some((scale, work, if host::vertical(cx) { glass.left } else { glass.top }))}fn on_window_close(cx: &mut App) {@@ -350,7 +350,7 @@ fn open_now(req: MenuRequest, cx: &mut App) {}let h = height(&items);let _ = handle.update(cx, |v, _, cx| v.on_open(items, req.glass.clone(), cx));- let rect = place::above_icon(req.anchor_x.round() as i32, glass_top, (WIDTH, h), scale, host::size_on(req.mon, cx), work);+ let rect = if host::vertical(cx) { let y = geo::cursor().map_or(req.anchor_x.round() as i32, |(_, y)| y); place::beside_icon(y, glass_top, (WIDTH, h), scale, host::size_on(req.mon, cx), work) } else { place::above_icon(req.anchor_x.round() as i32, glass_top, (WIDTH, h), scale, host::size_on(req.mon, cx), work) };host_g(cx).rect = rect;cx.spawn(async move |cx| {rf_win::window::set_dark_mode(hwnd, dark);diff --git a/crates/rf-app/src/dock/left.rs b/crates/rf-app/src/dock/left.rsindex 4b7f50c3..c08ed32d 100644--- a/crates/rf-app/src/dock/left.rs+++ b/crates/rf-app/src/dock/left.rs@@ -217,9 +217,19 @@ impl LeftIsland {cx.notify();}+ fn wanted_length(&self, cx: &App) -> f32 {+ if !super::host::vertical(cx) { return self.width(); }+ let search = plan::shown_search(self.search).is_some();+ 2.0 * plan::SIDE_PAD + plan::LOGO+ + if search { plan::LOGO_GAP + plan::SEARCH_BUTTON } else { 0.0 }+ + if self.weather.is_some() { plan::WEATHER_GAP + 36.0 } else { 0.0 }+ + pins_extra(self.pins_n)+ }+fn report_width(&mut self, cx: &mut Context<Self>) {self.sync_room(cx);- if let Some(w) = width_to_report(self.reported, self.width()) {+ let wanted = self.wanted_length(cx);+ if let Some(w) = width_to_report(self.reported, wanted) {self.reported = w;super::host::set_width(self.mon, Kind::Left, w, cx);}@@ -375,7 +385,7 @@ impl Render for LeftIsland {}// a layout that changed the display's room (a monitor, a size) may take the condition line away or give it back: the width is// reported again from a task, never from inside this render- if self.sync_room(cx) | self.sync_content(cx) {+ if self.sync_room(cx) | self.sync_content(cx) || (self.wanted_length(cx) - self.reported).abs() > 0.5 {cx.spawn(async move |this, cx| {let _ = this.update(cx, |me, cx| me.report_width(cx));})@@ -397,6 +407,7 @@ impl Render for LeftIsland {let k = super::host::size_on(self.mon, cx);let me = cx.entity();let mon = self.mon;+ let vertical = super::host::vertical(cx);let logo = div().id("dock-logo").relative()@@ -429,10 +440,11 @@ impl Render for LeftIsland {// on a narrow secondary monitor the field is a button: the search picture alone; the setting can make it a button anywhere, or// hide it (`plan::shown_search`)let shown = plan::shown_search(self.search);- let button = shown == Some(Search::Button);+ let button = vertical || shown == Some(Search::Button);let search = shown.is_some().then(|| h_flex().id("dock-search")- .ml(px(plan::LOGO_GAP * k))+ .when(!vertical, |d| d.ml(px(plan::LOGO_GAP * k)))+ .when(vertical, |d| d.mt(px(plan::LOGO_GAP * k))).w(px(if button { plan::SEARCH_BUTTON } else { plan::SEARCH_W } * k)).h(px(if button { plan::SEARCH_BUTTON } else { plan::SEARCH_H } * k)).when(!button, |d| d.px(px(plan::FIELD_PAD_X * k)).gap(px(plan::FIELD_GAP * k)))@@ -466,7 +478,7 @@ impl Render for LeftIsland {}));// the picture at the left of the temperature and, when the display has room, the condition in words under it- let words = self.condition_text();+ let words = if vertical { None } else { self.condition_text() };let weather = self.weather.map(|o| {// the text column is exactly as wide as the plan says (the island's width is the sum), whatever the real font makes of the// words: a longer one is cut with an ellipsis inside the column and never pushes into the search field@@ -482,8 +494,8 @@ impl Render for LeftIsland {None => text_14(div(), k).child(o.text()).into_any_element(),};h_flex()- .ml(px(plan::WEATHER_GAP * k))- .gap(px(plan::WEATHER_TEXT_GAP * k))+ .when(!vertical, |d| d.ml(px(plan::WEATHER_GAP * k)).gap(px(plan::WEATHER_TEXT_GAP * k)))+ .when(vertical, |d| d.flex_col().mt(px(plan::WEATHER_GAP * k)).gap(px(2. * k))).items_center().opacity(weather_alpha)// (the panel's widened field lies under this part of the island's window: a press here is a press on that field)@@ -502,7 +514,7 @@ impl Render for LeftIsland {let hover = pal.hover_fill().hsla();// (the Start panel's field stops before the launchers, so they keep their place and take clicks while it is open:// only the weather fades into the room the field takes)- let mut row = h_flex().ml(px(PIN_START_GAP * k)).gap(px(PIN_GAP * k)).items_center();+ let mut row = h_flex().when(!vertical, |d| d.ml(px(PIN_START_GAP * k))).when(vertical, |d| d.flex_col().mt(px(PIN_START_GAP * k))).gap(px(PIN_GAP * k)).items_center();for (i, (app, picture)) in pins.into_iter().enumerate() {let glass = self.glass.clone();let (for_click, for_menu, menu_pic) = (app.clone(), app.clone(), picture.clone());@@ -525,7 +537,7 @@ impl Render for LeftIsland {.on_click(move |_, _, _| super::actions::click_app_reporting(&for_click, rf_win::dock::foreground_root(), |_| {})).on_mouse_up(MouseButton::Right, move |ev: &MouseUpEvent, window, cx| {cx.stop_propagation();- let anchor_x = (f32::from(window.bounds().origin.x) + f32::from(ev.position.x)) * window.scale_factor();+ let anchor_x = if super::host::vertical(cx) { (f32::from(window.bounds().origin.y) + f32::from(ev.position.y)) * window.scale_factor() } else { (f32::from(window.bounds().origin.x) + f32::from(ev.position.x)) * window.scale_factor() };super::app_menu::open(super::app_menu::MenuRequest { app: for_menu.clone(), icon: menu_pic.clone(), anchor_x, glass: glass.clone() }, cx);}),);@@ -537,7 +549,7 @@ impl Render for LeftIsland {// a right click on the glass between and around the controls: Windows' Task Manager (the controls are told from the glass// by their boxes, `empty.rs::left_controls`, which mirror the row below: padding, logo, gap, field; change one, change both).on_mouse_up(MouseButton::Right, cx.listener(|me, ev: &MouseUpEvent, _, cx| me.right_click(ev.position, cx)))- .child(h_flex().size_full().px(px(plan::SIDE_PAD * k)).items_center().child(logo).children(search).children(weather).children(launchers))+ .child(h_flex().size_full().when(!vertical, |d| d.px(px(plan::SIDE_PAD * k))).when(vertical, |d| d.flex_col().py(px(plan::SIDE_PAD * k))).items_center().child(logo).children(search).children(weather).children(launchers))}}diff --git a/crates/rf-app/src/dock/middle.rs b/crates/rf-app/src/dock/middle.rsindex aadd7ef3..cffd482b 100644--- a/crates/rf-app/src/dock/middle.rs+++ b/crates/rf-app/src/dock/middle.rs@@ -570,6 +570,7 @@ impl MiddleIsland {/// icon in the hand is first moved to where the button came up, so that a release well outside the dock (the moves out there are not/// delivered) puts it back instead of dropping it at the last place it was seen.fn released_at(&mut self, at: Point<Pixels>, cx: &mut Context<Self>) {+ let at = if host::vertical(cx) { point(at.y, at.x) } else { at };let k = host::size_on(self.mon, cx);let now = self.now_ms();if let Some(d) = self.drag.as_mut() {@@ -591,6 +592,7 @@ impl MiddleIsland {/// A button went down on the icon `ix`: it dips until the button is up (`released`).fn item_pressed(&mut self, ix: usize, at: Point<Pixels>, cx: &mut Context<Self>) {+ let at = if host::vertical(cx) { point(at.y, at.x) } else { at };let k = host::size_on(self.mon, cx);self.press_at = Some((ix, f32::from(at.x) / k, f32::from(at.y) / k));self.swallow_click = false;@@ -658,6 +660,8 @@ impl MiddleIsland {return;}let Some(mut glass) = host::visible_glass_rect_on(self.mon, Kind::Middle, cx) else { return };+ let edge = host::dock_edge(cx);+ glass = rf_win::dock::layout::edge_axes(glass, edge);let unit = host::env_on(self.mon, cx).unit();let thin = sq.grow == 0.0;let now = (glass.left, glass.top, glass.bottom, unit.to_bits(), thin);@@ -677,7 +681,8 @@ impl MiddleIsland {for (item, &(x, w)) in self.items.iter().zip(spans) {let DockItem::App(a) = item else { continue };let (left, right) = min_target_span(glass.left, x, w, unit);- targets.extend(a.windows.iter().map(|&h| (h, [left, glass.top, right, glass.bottom])));+ let r = rf_win::dock::layout::edge_axes(rf_win::dock::layout::Rect::new(left, glass.top, right, glass.bottom), edge);+ targets.extend(a.windows.iter().map(|&h| (h, [r.left, r.top, r.right, r.bottom])));}rf_win::shellhost::shellhook::set_min_targets(self.mon.0, targets);}@@ -686,7 +691,7 @@ impl MiddleIsland {fn icon_anchor_x(&self, ix: usize, cx: &App) -> Option<f32> {let &(x, w) = self.rest_items.get(ix)?;let glass = host::visible_glass_rect_on(self.mon, Kind::Middle, cx)?;- Some(screen_center_x(glass.left, x, w, host::env_on(self.mon, cx).unit()))+ Some(screen_center_x(if host::vertical(cx) { glass.top } else { glass.left }, x, w, host::env_on(self.mon, cx).unit()))}/// The wheel was turned over item `ix`: a running app's own sound level goes a step up or down for each notch (issue 21: "control@@ -790,6 +795,7 @@ impl MiddleIsland {/// A right click anywhere in the dock's window at `at` (logical px of the window): on the empty glass - not on an icon, whose own/// click is the app menu - the dock's menu (`island_menu`: Task Manager, the dock's quick switches).fn row_right_click(&mut self, at: Point<Pixels>, cx: &mut Context<Self>) {+ let at = if host::vertical(cx) { point(at.y, at.x) } else { at };if self.right.row_up() || self.drag.is_some() {return;}@@ -800,7 +806,8 @@ impl MiddleIsland {if let Some(ix) = super::empty::mark_owner(&self.last_icons, point) {self.right_click(ix, cx);} else if super::empty::middle_is_empty(self.last_glass, &self.last_icons, point) {- let Some((x, _)) = rf_win::dock::panel::cursor() else { return };+ let Some((x, y)) = rf_win::dock::panel::cursor() else { return };+ let x = if host::vertical(cx) { y } else { x };super::island_menu::open(super::island_menu::MenuRequest {kind: host::Kind::Middle,@@ -990,7 +997,8 @@ impl MiddleIsland {/// held).fn drag_pointer(&mut self, ev: &MouseMoveEvent, cx: &mut Context<Self>) -> bool {let k = host::size_on(self.mon, cx);- let (x, y) = (f32::from(ev.position.x) / k, f32::from(ev.position.y) / k);+ let pos = if host::vertical(cx) { point(ev.position.y, ev.position.x) } else { ev.position };+ let (x, y) = (f32::from(pos.x) / k, f32::from(pos.y) / k);let left = ev.pressed_button == Some(MouseButton::Left);if self.drag.is_none() {let Some((ix, x0, _)) = self.press_at else { return false };@@ -1013,7 +1021,8 @@ impl MiddleIsland {}let now = self.now_ms();// the magnification follows the icon in the hand as it follows the pointer; it was held where the button went down- let bx = (f32::from(ev.position.x) - host::insets_on(self.mon, Kind::Middle, cx).margins[0]) / k;+ let margin = host::insets_on(self.mon, Kind::Middle, cx).margins[if host::vertical(cx) { 1 } else { 0 }];+ let bx = (f32::from(pos.x) - margin) / k;let bell_moved = self.pointer_x.is_none_or(|old| (old - bx).abs() > 0.25);self.pointer_x = Some(bx);let slid = self.drag.as_mut().is_some_and(|d| d.moved(x, y, self.last_glass, &self.last_slots, now));@@ -1203,6 +1212,8 @@ impl Render for MiddleIsland {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {let env = host::env_on(self.mon, cx);let mon = self.mon;+ let vertical = host::vertical(cx);+ let physical = |b: [f32; 4]| if vertical { [b[1], b[0], b[3], b[2]] } else { b };// the dock's size factor: the arithmetic below is in dock units, a length is drawn as units times `k`let k = env.size;let u = move |v: f32| px(v * k);@@ -1242,12 +1253,14 @@ impl Render for MiddleIsland {}let mut inset = host::insets_on(mon, Kind::Middle, cx);inset.margins = inset.margins.map(|v| v / k);+ if vertical { inset.margins = [inset.margins[1], inset.margins[0], inset.margins[3], inset.margins[2]]; }inset.growth /= k;let [ml, _, mr, mb] = inset.margins;// The window may be narrower than the icons want (the side islands and the screen leave it less): lay the icons out for the// island's real width at rest (the window less its margins), so none falls outside it.let size = window.viewport_size();- let (vw, vh) = (f32::from(size.width) / k, f32::from(size.height) / k);+ let (physical_w, physical_h) = (f32::from(size.width) / k, f32::from(size.height) / k);+ let (vw, vh) = if vertical { (physical_h, physical_w) } else { (physical_w, physical_h) };let real = vw - ml - mr;let rest_width = if real > 0.0 { real.min(self.width()) } else { self.width() };let rest = plan::rest_layout(&self.slots, rest_width);@@ -1339,7 +1352,7 @@ impl Render for MiddleIsland {// the glass and the part of the window that takes the pointer follow the frame (only what moved is sent on)let scale = env.unit();- let boxes: Vec<[f32; 4]> = pic.out_of_glass.iter().chain(&posed).map(|b| plan::to_device(*b, scale)).collect();+ let boxes: Vec<[f32; 4]> = pic.out_of_glass.iter().chain(&posed).map(|b| physical(plan::to_device(*b, scale))).collect();let mut glass_px = plan::to_device(pic.glass, scale);// (the glass's bottom edge, which does not move while the dock grows or shrinks)let bottom_px = (pic.glass[1] + pic.glass[3]) * scale;@@ -1351,7 +1364,7 @@ impl Render for MiddleIsland {pic.glass[3]} else {if let Some(rest) = host::visible_glass_rect_on(mon, Kind::Middle, cx) {- glass_px[3] = rest.height() as f32;+ glass_px[3] = if vertical { rest.width() } else { rest.height() } as f32;}glass_px[3] / env.scale};@@ -1359,12 +1372,13 @@ impl Render for MiddleIsland {let glass_h = if sq.is_full() {glass_h} else {- let full_px = if k == 1.0 { MIDDLE_HEIGHT * scale } else { host::visible_glass_rect_on(mon, Kind::Middle, cx).map_or(MIDDLE_HEIGHT * scale, |r| r.height() as f32) };+ let full_px = if k == 1.0 { MIDDLE_HEIGHT * scale } else { host::visible_glass_rect_on(mon, Kind::Middle, cx).map_or(MIDDLE_HEIGHT * scale, |r| if vertical { r.width() } else { r.height() } as f32) };super::thin::fit_glass(&mut glass_px, bottom_px, &sq, scale, full_px);glass_px[3] / env.scale};- let parts = hit::parts(glass_px, rf_win::dock::layout::px(radius(), scale) as f32, &boxes, (vw * scale).round() as i32, (vh * scale).round() as i32);- host::set_middle_frame(mon, &self.glass, glass_px, parts, cx);+ let physical_glass = physical(glass_px);+ let parts = hit::parts(physical_glass, rf_win::dock::layout::px(radius(), scale) as f32, &boxes, (physical_w * scale).round() as i32, (physical_h * scale).round() as i32);+ host::set_middle_frame(mon, &self.glass, physical_glass, parts, cx);// side islands that are as tall as the dock (a setting) are as low as it is while it is thinhost::set_side_squeeze(mon, &sq, cx);@@ -1379,10 +1393,8 @@ impl Render for MiddleIsland {let cell = match item {DockItem::Separator => div().absolute()- .left(u(x))- .bottom(u(mb + baseline + (ICON_REST - 36.0) * sq.icon / 2.0))- .w(u(w))- .h(u(36. * sq.icon))+ .when(!vertical, |d| d.left(u(x)).bottom(u(mb + baseline + (ICON_REST - 36.0) * sq.icon / 2.0)).w(u(w)).h(u(36. * sq.icon)))+ .when(vertical, |d| d.top(u(x)).right(u(mb + baseline + (ICON_REST - 36.0) * sq.icon / 2.0)).h(u(w)).w(u(36. * sq.icon))).bg(pal.separator().hsla()).into_any_element(),DockItem::App(_) | DockItem::Place(_) => {@@ -1419,13 +1431,13 @@ impl Render for MiddleIsland {picture} else {let g = grow * w;- div().absolute().left(u(dx - g)).top(u(-up - g)).w(u(w + 2.0 * g)).h(u(w + 2.0 * g)).opacity(opacity).child(picture).into_any_element()+ div().absolute().when(!vertical, |d| d.left(u(dx - g)).top(u(-up - g))).when(vertical, |d| d.top(u(dx - g)).left(u(-up - g))).w(u(w + 2.0 * g)).h(u(w + 2.0 * g)).opacity(opacity).child(picture).into_any_element()};div().id(("dock-item", ix)).absolute()- .left(u(x))- .bottom(u(mb + baseline))+ .when(!vertical, |d| d.left(u(x)).bottom(u(mb + baseline)))+ .when(vertical, |d| d.top(u(x)).right(u(mb + baseline))).w(u(w)).h(u(w)).cursor_pointer()@@ -1504,7 +1516,7 @@ impl Render for MiddleIsland {};let (dw, dh) = (dw * size, dh * size);// the mark stays under its icon: it is the icon's child, and the icons stand on one baseline- d.child(div().absolute().bottom(u(-DOT_DROP - if labels { LABEL_H } else { 0.0 })).left(u((w - dw) / 2.0)).w(u(dw)).h(u(dh)).rounded_full().bg(color))+ d.child(div().absolute().when(!vertical, |d| d.bottom(u(-DOT_DROP - if labels { LABEL_H } else { 0.0 })).left(u((w - dw) / 2.0)).w(u(dw)).h(u(dh))).when(vertical, |d| d.right(u(-DOT_DROP - if labels { LABEL_H } else { 0.0 })).top(u((w - dw) / 2.0)).w(u(dh)).h(u(dw))).rounded_full().bg(color))}).on_mouse_down(MouseButton::Left, cx.listener(move |me, ev: &MouseDownEvent, _, cx| me.item_pressed(ix, ev.position, cx))).on_click(cx.listener(move |me, _, _, cx| me.click(ix, cx)))@@ -1536,10 +1548,8 @@ impl Render for MiddleIsland {let fill = fallback.then(|| {div().absolute()- .left(u(pic.glass[0]))- .top(u(pic.glass[1]))- .w(u(pic.glass[2]))- .h(px(glass_h))+ .when(!vertical, |d| d.left(u(pic.glass[0])).top(u(pic.glass[1])).w(u(pic.glass[2])).h(px(glass_h)))+ .when(vertical, |d| d.top(u(pic.glass[0])).left(u(pic.glass[1])).h(u(pic.glass[2])).w(px(glass_h))).rounded(u(radius())).bg(pal.fallback_fill().hsla())});@@ -1549,7 +1559,7 @@ impl Render for MiddleIsland {.text_color(pal.text().hsla()).children(fill)// the quiet highlight while an app dragged out of the Start panel is over the island (nothing at rest: `drop_hint.rs`)- .children(super::drop_hint::overlay(cx, pal, [u(pic.glass[0]), u(pic.glass[1]), u(pic.glass[2]), px(glass_h)], u(radius())))+ .children(super::drop_hint::overlay(cx, pal, if vertical { [u(pic.glass[1]), u(pic.glass[0]), px(glass_h), u(pic.glass[2])] } else { [u(pic.glass[0]), u(pic.glass[1]), u(pic.glass[2]), px(glass_h)] }, u(radius()))).child(// The row covers the whole window, so the pointer over an icon that has grown out of the glass is still over the dock.// (What of the window the system hands to this view at all is the region, see `hit`.)@@ -1571,7 +1581,8 @@ impl Render for MiddleIsland {let k = host::size_on(mon, cx);// (the pointer is on the dock: a thin dock grows now, not at the next look at the cursor)super::thin::pointer_on_island(mon, cx);- me.pointer_moved((f32::from(ev.position.x) - host::insets_on(mon, Kind::Middle, cx).margins[0]) / k, strength, ev.pressed_button.is_some(), cx)+ let (p, margin) = if vertical { (ev.position.y, 1) } else { (ev.position.x, 0) };+ me.pointer_moved((f32::from(p) - host::insets_on(mon, Kind::Middle, cx).margins[margin]) / k, strength, ev.pressed_button.is_some(), cx)})).on_mouse_down(MouseButton::Right, cx.listener(|me, _, _, cx| me.right_down(cx))).on_mouse_up(MouseButton::Right, cx.listener(|me, ev: &MouseUpEvent, _, cx| me.row_right_click(ev.position, cx)))@@ -1595,7 +1606,8 @@ impl Render for MiddleIsland {let strength = cx.global::<Settings>().dock_magnify.strength();let k = host::size_on(mon, cx);super::thin::pointer_on_island(mon, cx);- me.pointer_moved((f32::from(ev.event.position.x) - host::insets_on(mon, Kind::Middle, cx).margins[0]) / k, strength, false, cx)+ let (p, margin) = if vertical { (ev.event.position.y, 1) } else { (ev.event.position.x, 0) };+ me.pointer_moved((f32::from(p) - host::insets_on(mon, Kind::Middle, cx).margins[margin]) / k, strength, false, cx)})).children(cells),)diff --git a/crates/rf-app/src/dock/panel.rs b/crates/rf-app/src/dock/panel.rsindex 94b981fe..c452e486 100644--- a/crates/rf-app/src/dock/panel.rs+++ b/crates/rf-app/src/dock/panel.rs@@ -231,7 +231,7 @@ impl Hooks for StartHooks {// keeps it inside the work area)let room = host::monitor_work(cx).zip(host::visible_glass_rect(Kind::Left, cx))- .map(|((scale, work), glass)| rf_win::dock::startpage::room_above(glass.top, work.top, scale, geo::GAP));+ .map(|((scale, work), glass)| if host::vertical(cx) { work.height() as f32 / scale } else { rf_win::dock::startpage::room_above(glass.top, work.top, scale, geo::GAP) });(START_SIZE.0, room.map_or(START_SIZE.1, rf_win::dock::startpage::panel_height))}fn redraw(&self, cx: &mut App) {@@ -536,11 +536,11 @@ fn open_panel(id: PanelId, cx: &mut App) {let dark = dark_now(&island);// A panel that grows out of its island (with the setting on) has a window as big as the grown glass; see grow_host.rs.let size = hooks.size(cx);- let panel_rect = geo::place(glass, size, scale, side, work);+ let panel_rect = geo::place_on_edge(glass, size, scale, side, work, host::dock_edge(cx));// (not where the grown glass would lie under another island: that screen opens the panel the ordinary way, see `grow_host::fits`)- let grow_cfg = grow_host::config(id, kind, cx).filter(|cfg| grow_host::fits(*cfg, glass, panel_rect, scale, cx));+ let grow_cfg = grow_host::config(id, kind, cx).filter(|_| !host::vertical(cx)).filter(|cfg| grow_host::fits(*cfg, glass, panel_rect, scale, cx));// (a panel that grows gives up its own bottom row, the island's row is its bottom row: placed with the smaller height)- let panel_rect = grow_cfg.map_or(panel_rect, |cfg| geo::place(glass, grow_host::panel_size(cfg, size), scale, side, work));+ let panel_rect = grow_cfg.map_or(panel_rect, |cfg| geo::place_on_edge(glass, grow_host::panel_size(cfg, size), scale, side, work, host::dock_edge(cx)));// pressed again while the panel shrinks back into its island: the motion turns round and the panel keeps what it showslet reversal = grow_cfg.is_some() && grow_host::is_closing(id, cx);let grown = grow_cfg.and_then(|cfg| grow_host::prepare(grow_host::Prep { id, cfg, side, island_glass: glass, panel: panel_rect, hwnd, island: island.clone(), dark, scale }, cx));@@ -591,7 +591,7 @@ fn open_panel(id: PanelId, cx: &mut App) {}// the rectangle again: opening may have changed what the panel wants to show (its height)let size = hooks.size(cx);- let panel_rect = geo::place(glass, grow_cfg.map_or(size, |cfg| grow_host::panel_size(cfg, size)), scale, side, work);+ let panel_rect = geo::place_on_edge(glass, grow_cfg.map_or(size, |cfg| grow_host::panel_size(cfg, size)), scale, side, work, host::dock_edge(cx));let grown = grow_cfg.and_then(|cfg| grow_host::prepare(grow_host::Prep { id, cfg, side, island_glass: glass, panel: panel_rect, hwnd, island: island.clone(), dark, scale }, cx));let rect = grown.unwrap_or(panel_rect);{@@ -690,12 +690,12 @@ fn refit(id: PanelId, size: Option<(f32, f32)>, cx: &mut App) {// again against them, with the same rule the opening used. One that now lies under another island cannot stay: the panel is put// away at once (a deferred close: this can run inside the panel's own update, which must not be re-entered).if let Some(cfg) = grow_cfg- && !grow_host::fits(cfg, glass, geo::place(glass, size, scale, side, work), scale, cx)+ && !grow_host::fits(cfg, glass, geo::place_on_edge(glass, size, scale, side, work, host::dock_edge(cx)), scale, cx){cx.defer(|cx| close(CloseCause::LayoutChanged, cx));return;}- let panel_rect = geo::place(glass, grow_cfg.map_or(size, |cfg| grow_host::panel_size(cfg, size)), scale, side, work);+ let panel_rect = geo::place_on_edge(glass, grow_cfg.map_or(size, |cfg| grow_host::panel_size(cfg, size)), scale, side, work, host::dock_edge(cx));let grown = grow_cfg.and_then(|cfg| {let dark = dark_now(&island);grow_host::prepare(grow_host::Prep { id, cfg, side, island_glass: glass, panel: panel_rect, hwnd, island, dark, scale }, cx)diff --git a/crates/rf-app/src/dock/right.rs b/crates/rf-app/src/dock/right.rsindex 07872d93..935ff3ce 100644--- a/crates/rf-app/src/dock/right.rs+++ b/crates/rf-app/src/dock/right.rs@@ -227,7 +227,7 @@ impl RightIsland {/// The island's own buttons on the screen (device px): the first one's left edge, the distance from one's left edge to the next/// one's, a button's width, and the glass they stand in as it is drawn now.fn status_geo(&self, cx: &App) -> Option<(i32, i32, i32, rf_win::dock::layout::Rect)> {- let glass = super::host::current_glass_rect_on(self.mon, Kind::Right, cx)?;+ let glass = rf_win::dock::layout::edge_axes(super::host::current_glass_rect_on(self.mon, Kind::Right, cx)?, super::host::dock_edge(cx));let unit = super::host::dock_unit_on(self.mon, cx)?;let u = |v: f32| rf_win::dock::layout::px(v, unit);Some((glass.left + u(plan::SIDE_PAD + self.tray_extra), u(plan::BUTTON + plan::RIGHT_GAP), u(plan::BUTTON), glass))@@ -236,6 +236,7 @@ impl RightIsland {/// Where the pointer at `cursor` would put a dragged button: `None` when it is away from the island (more than the island's/// height above or below it, or more than a button beside it).fn status_target(&self, cursor: (i32, i32), cx: &App) -> Option<usize> {+ let cursor = if super::host::vertical(cx) { (cursor.1, cursor.0) } else { cursor };let (first, step, button, glass) = self.status_geo(cx)?;let near = cursor.1 >= glass.top - glass.height() && cursor.1 < glass.bottom + glass.height() && cursor.0 >= glass.left - step && cursor.0 < glass.right + step;near.then(|| status_order::drop_index(self.status_buttons(cx).len(), first, step, button, cursor.0))@@ -243,6 +244,7 @@ impl RightIsland {/// Whether the pointer at `cursor` is on this button.fn status_hit(&self, which: Status, cursor: (i32, i32), cx: &App) -> bool {+ let cursor = if super::host::vertical(cx) { (cursor.1, cursor.0) } else { cursor };let Some((first, step, button, glass)) = self.status_geo(cx) else { return false };let Some(i) = self.status_buttons(cx).iter().position(|s| *s == which) else { return false };rf_win::dock::layout::Rect::from_xywh(first + i as i32 * step, glass.top + (glass.height() - button) / 2, button, button).contains(cursor.0, cursor.1)@@ -324,6 +326,11 @@ impl RightIsland {/// The width the content needs now (logical px). The primary monitor's: the symbols, the clock and the bell, and the tray strip's/// room; a secondary monitor's: the clock and, when there is room, the bell.fn wanted_width(&self, cx: &App) -> f32 {+ if super::host::vertical(cx) {+ let buttons = self.status_buttons(cx).len();+ let status = if buttons == 0 { 0.0 } else { buttons as f32 * (plan::BUTTON + plan::RIGHT_GAP) + 2.0 * plan::RIGHT_SEP_GAP };+ return 2.0 * plan::SIDE_PAD + status + plan::CLOCK_H + self.tray_extra + if self.content.bell { plan::RIGHT_GAP + plan::BUTTON } else { 0.0 } + if self.mon.is_home() && show_desktop_on(cx) { plan::SHOW_DESKTOP_EXTRA } else { 0.0 };+ }if self.mon.is_home() {plan::right_width_for(&self.lines, self.status_buttons(cx).len()) + self.tray_extra + if show_desktop_on(cx) { plan::SHOW_DESKTOP_EXTRA } else { 0.0 }} else {@@ -455,7 +462,7 @@ impl RightIsland {/// Where one of the island's own controls is on the screen (device px), with its tip's text.fn own_anchor(&self, which: OwnTip, cx: &App) -> Option<super::tray_tip::Anchor> {- let glass = super::host::current_glass_rect_on(self.mon, Kind::Right, cx)?;+ let glass = rf_win::dock::layout::edge_axes(super::host::current_glass_rect_on(self.mon, Kind::Right, cx)?, super::host::dock_edge(cx));let unit = rf_win::dock::size::unit(super::host::home_work(cx)?.0, super::look::dock_size(cx));let clock_w = plan::clock_width(&self.lines);let (controls, first_button) = if self.mon.is_home() {@@ -618,12 +625,11 @@ fn show_desktop_on(cx: &App) -> bool {/// The "Show desktop" strip: a thin bar with a hairline on its left, as at the end of Windows' taskbar. A click minimizes every window/// and shows the desktop, the next one brings them back (Win+D's own toggle, `shell::keylayer`).-fn show_desktop_strip(pal: Palette, k: f32) -> impl IntoElement {+fn show_desktop_strip(pal: Palette, k: f32, vertical: bool) -> impl IntoElement {div().id("dock-show-desktop")- .ml(px(plan::RIGHT_GAP * k))- .w(px(plan::SHOW_DESKTOP_W * k))- .h(px(plan::BUTTON * k))+ .when(!vertical, |d| d.ml(px(plan::RIGHT_GAP * k)).w(px(plan::SHOW_DESKTOP_W * k)).h(px(plan::BUTTON * k)))+ .when(vertical, |d| d.mt(px(plan::RIGHT_GAP * k)).h(px(plan::SHOW_DESKTOP_W * k)).w(px(plan::BUTTON * k))).flex_shrink_0().rounded(px(3. * k)).border_l_1()@@ -762,6 +768,7 @@ impl Render for RightIsland {.detach();}let (mon, home) = (self.mon, self.mon.is_home());+ let vertical = super::host::vertical(cx);let dot: Option<Hsla> = super::notif_state::dot_visible(cx).then(|| gpui_kit::rgb(cx.try_global::<super::look::Env>().map_or(0x0078D4, |e| e.accent)).into());let (network_icon, volume_icon) = (super::sysstate::network_icon(cx), super::sysstate::volume_icon(cx));@@ -771,11 +778,11 @@ impl Render for RightIsland {let clock = v_flex().id("dock-clock")// (the gap after the separator that follows the buttons; without buttons there is no separator)- .ml(px(if buttons.is_empty() { 0.0 } else { plan::RIGHT_SEP_GAP } * k))- .w(px(plan::clock_width(&self.lines) * k))+ .when(!vertical, |d| d.ml(px(if buttons.is_empty() { 0.0 } else { plan::RIGHT_SEP_GAP } * k)).w(px(plan::clock_width(&self.lines) * k)))+ .when(vertical, |d| d.mt(px(plan::RIGHT_SEP_GAP * k)).w_full()).h(px(plan::CLOCK_H * k)).px(px(plan::CLOCK_PAD / 2.0 * k))- .items_end()+ .when(!vertical, |d| d.items_end()).when(vertical, |d| d.items_center()).justify_center().rounded(px(8. * k)).cursor_pointer()@@ -791,7 +798,7 @@ impl Render for RightIsland {// colour stands where it would land (as in the tray strip beside them).let dragged = self.status_press.as_ref().filter(|p| p.press.dragging).map(|p| (p.which, p.target));let status_row = (!buttons.is_empty()).then(|| {- let mut row = h_flex().relative().flex_shrink_0().items_center();+ let mut row = h_flex().relative().flex_shrink_0().items_center().when(vertical, |d| d.flex_col());for (i, which) in buttons.iter().copied().enumerate() {let button = match which {Status::Eject => icon_button("dock-eject", L::Eject, pal, k).into_any_element(),@@ -803,7 +810,7 @@ impl Render for RightIsland {};row = row.child(div()- .ml(px(if i == 0 { 0.0 } else { plan::RIGHT_GAP } * k))+ .when(!vertical, |d| d.ml(px(if i == 0 { 0.0 } else { plan::RIGHT_GAP } * k))).when(vertical, |d| d.mt(px(if i == 0 { 0.0 } else { plan::RIGHT_GAP } * k))).when(dragged.is_some_and(|(w, _)| w == which), |d| d.opacity(0.35)).id(("dock-status", i)).on_hover(cx.listener(move |me, on: &bool, _, cx| me.own_hover(OwnTip::Status(which), *on, cx)))@@ -824,7 +831,7 @@ impl Render for RightIsland {{let x = insert as f32 * (plan::BUTTON + plan::RIGHT_GAP) - plan::RIGHT_GAP / 2.0;let accent: Hsla = gpui_kit::rgb(cx.try_global::<super::look::Env>().map_or(0x0078D4, |e| e.accent)).into();- row = row.child(div().absolute().left(px(x * k - 1.0)).top(px(4. * k)).w(px(2.)).h(px((plan::BUTTON - 8.) * k)).rounded_full().bg(accent));+ row = row.child(div().absolute().when(!vertical, |d| d.left(px(x * k - 1.0)).top(px(4. * k)).w(px(2.)).h(px((plan::BUTTON - 8.) * k))).when(vertical, |d| d.top(px(x * k - 1.0)).left(px(4. * k)).h(px(2.)).w(px((plan::BUTTON - 8.) * k))).rounded_full().bg(accent));}row});@@ -851,20 +858,20 @@ impl Render for RightIsland {.child(h_flex().size_full()- .px(px(plan::SIDE_PAD * k))+ .when(!vertical, |d| d.px(px(plan::SIDE_PAD * k))).when(vertical, |d| d.flex_col().py(px(plan::SIDE_PAD * k))).items_center().children(tray)// the island's own buttons (`status_row` above), then the separator.children(status_row).when(!buttons.is_empty(), |d| {- d.child(div().ml(px(plan::RIGHT_SEP_GAP * k)).w(px(rf_win::dock::layout::SEPARATOR_WIDTH * k)).h(px(plan::RIGHT_SEP_HEIGHT * k)).bg(pal.separator().hsla()))+ d.child(div().when(!vertical, |d| d.ml(px(plan::RIGHT_SEP_GAP * k)).w(px(rf_win::dock::layout::SEPARATOR_WIDTH * k)).h(px(plan::RIGHT_SEP_HEIGHT * k))).when(vertical, |d| d.mt(px(plan::RIGHT_SEP_GAP * k)).h(px(rf_win::dock::layout::SEPARATOR_WIDTH * k)).w(px(plan::RIGHT_SEP_HEIGHT * k))).bg(pal.separator().hsla()))}).child(clock).when(self.content.bell, |d| {d.child(div().id("dock-bell-tip")- .ml(px(plan::RIGHT_GAP * k))+ .when(!vertical, |d| d.ml(px(plan::RIGHT_GAP * k))).when(vertical, |d| d.mt(px(plan::RIGHT_GAP * k))).on_hover(cx.listener(|me, on: &bool, _, cx| me.own_hover(OwnTip::Bell, *on, cx))).on_mouse_down(MouseButton::Left, |_, _, cx| super::tray_tip::press(cx)).child(bell_button(pal, dot, k, move |cx| open_notifications(mon, cx))),@@ -876,7 +883,7 @@ impl Render for RightIsland {.id("dock-show-desktop-tip").on_hover(cx.listener(|me, on: &bool, _, cx| me.own_hover(OwnTip::ShowDesktop, *on, cx))).on_mouse_down(MouseButton::Left, |_, _, cx| super::tray_tip::press(cx))- .child(show_desktop_strip(pal, k)),+ .child(show_desktop_strip(pal, k, vertical)),)}),)diff --git a/crates/rf-app/src/dock/thin.rs b/crates/rf-app/src/dock/thin.rsindex fcdc56ba..f38601f3 100644--- a/crates/rf-app/src/dock/thin.rs+++ b/crates/rf-app/src/dock/thin.rs@@ -175,6 +175,7 @@ pub fn set_entry_width(mon: MonId, width_px: f32, cx: &mut App) {return;}let Some(full) = host::visible_glass_rect_on(mon, Kind::Middle, cx) else { return };+ let full = rf_win::dock::layout::edge_axes(full, host::dock_edge(cx));if let Some(zone) = me(cx).and_then(|h| h.mon_mut(mon)).and_then(|m| m.zone.as_mut()) {zone.set_entry_width(full, width_px.round() as i32);}@@ -314,7 +315,9 @@ fn zone_now(mon: MonId, cx: &App) -> Option<Zone> {let (left, right) = (host::visible_glass_rect_on(mon, Kind::Left, cx)?, host::visible_glass_rect_on(mon, Kind::Right, cx)?);let unit = host::dock_unit_on(mon, cx)?;let monitor = host::dock_monitors(cx).into_iter().find(|(id, _)| *id == mon)?.1.rect;- Some(rf_win::dock::thin::zone(full, left, right, monitor, unit))+ let edge = host::dock_edge(cx);+ let axes = |r| rf_win::dock::layout::edge_axes(r, edge);+ Some(rf_win::dock::thin::zone(axes(full), axes(left), axes(right), axes(monitor), unit))}/// The pointer is on this dock's island (its mouse events say so): near, at once, without waiting for the next look at the cursor.@@ -334,8 +337,8 @@ pub fn pointer_on_island(mon: MonId, cx: &mut App) {/// What a walk asks: each dock, its monitor, and the full glass a docked window is measured against (`host::full_glass_span_on`: the/// middle island's, and the side islands' too when they are as tall as it).-fn what_to_ask(cx: &mut App) -> Vec<(MonId, isize, Option<rf_win::dock::layout::Rect>)> {- host::dock_monitors(cx).into_iter().map(|(id, m)| (id, m.handle, host::full_glass_span_on(id, cx))).collect()+fn what_to_ask(cx: &mut App) -> Vec<(MonId, isize, Option<rf_win::dock::layout::Rect>, rf_win::dock::layout::DockEdge)> {+ host::dock_monitors(cx).into_iter().map(|(id, m)| (id, m.handle, host::full_glass_span_on(id, cx), host::dock_edge(cx))).collect()}/// A walk over the windows, off the UI thread; at most one at a time. One question for each dock's monitor.@@ -358,10 +361,10 @@ fn read_maximized(cx: &mut App) {.spawn(async move {asked.into_iter()- .map(|(id, handle, glass)| {+ .map(|(id, handle, glass, edge)| {// (the home dock follows the primary monitor, whichever handle it has now)let handle = if id.is_home() { rf_win::dock::primary_monitor().map_or(handle, |p| p.handle) } else { handle };- (id, zoomwatch::stands_on_band(handle, glass))+ (id, zoomwatch::stands_on_edge(handle, glass, edge))}).collect()})@@ -437,7 +440,7 @@ fn sync_poller(cx: &mut App) {/// One look at the cursor and at what is open. Gives the time to the next look (ms); `None`: nothing more to look at.fn poll(cx: &mut App) -> Option<u64> {- let pointer = zoomwatch::pointer();+ let pointer = zoomwatch::pointer().map(|(x,y,down)| if host::vertical(cx) { (y,x,down) } else { (x,y,down) });let open = open_anything(cx);let active = host::active(cx);let h = me(cx)?;diff --git a/crates/rf-app/src/dock/tray_strip.rs b/crates/rf-app/src/dock/tray_strip.rsindex 85c91363..94318c6d 100644--- a/crates/rf-app/src/dock/tray_strip.rs+++ b/crates/rf-app/src/dock/tray_strip.rs@@ -480,9 +480,12 @@ fn panel_limits(st: &TrayState, cx: &App) -> ts::OvfLimits {fn source_rect(src: Source, cx: &App) -> Option<Rect> {let st = cx.try_global::<TrayState>()?;let (glass, unit) = glass_and_unit(cx)?;+ let edge = host::dock_edge(cx);+ let axes = |r| rf_win::dock::layout::edge_axes(r, edge);+ let glass = axes(glass);match src {- Source::Strip(j) => (j < st.lay.visible.len()).then(|| ts::cell_rect(glass, unit, j)),- Source::Chevron => st.lay.chevron.then(|| ts::chevron_rect(glass, unit, st.lay.visible.len())),+ Source::Strip(j) => (j < st.lay.visible.len()).then(|| axes(ts::cell_rect(glass, unit, j))),+ Source::Chevron => st.lay.chevron.then(|| axes(ts::chevron_rect(glass, unit, st.lay.visible.len()))),Source::Overflow(k) => {// the overflow panel is a window of its own: its cells are in the monitor's scale, not the dock's sizelet scale = host::home_work(cx)?.0;@@ -527,11 +530,14 @@ pub fn report_rects(cx: &App) {let Some(st) = cx.try_global::<TrayState>() else { return };let Some(snap) = &st.snap else { return };let Some((glass, unit)) = glass_and_unit(cx) else { return };+ let edge = host::dock_edge(cx);+ let axes = |r| rf_win::dock::layout::edge_axes(r, edge);+ let glass = axes(glass);let mut rects: Vec<(IconKey, Rect)> = Vec::with_capacity(snap.icons.len());for (j, &i) in st.lay.visible.iter().enumerate() {- rects.push((snap.icons[i].key, ts::cell_rect(glass, unit, j)));+ rects.push((snap.icons[i].key, axes(ts::cell_rect(glass, unit, j))));}- let chevron = ts::chevron_rect(glass, unit, st.lay.visible.len());+ let chevron = axes(ts::chevron_rect(glass, unit, st.lay.visible.len()));for (k, &i) in st.lay.overflow.iter().enumerate() {let r = if overflow_rect(cx).is_some() { source_rect(Source::Overflow(k), cx).unwrap_or(chevron) } else { chevron };rects.push((snap.icons[i].key, r));@@ -599,7 +605,8 @@ pub fn strip_element(pal: Palette, cx: &App) -> Option<AnyElement> {let n = st.lay.visible.len();let dragging = st.drag.as_ref().map(|d| d.key);let target = st.drag.as_ref().map(|d| d.target);- let mut row = div().id("tray-strip").relative().flex_shrink_0().w(px(st.lay.block_width() * k)).h(px(ts::strip_h() * k));+ let vertical = host::vertical(cx);+ let mut row = div().id("tray-strip").relative().flex_shrink_0().when(!vertical, |d| d.w(px(st.lay.block_width() * k)).h(px(ts::strip_h() * k))).when(vertical, |d| d.h(px(st.lay.block_width() * k)).w(px(ts::strip_h() * k)));for (j, &i) in st.lay.visible.iter().enumerate() {let key = st.icons()[i].key;let hot = dragging.is_none() && st.hover == Some(Source::Strip(j));@@ -608,10 +615,8 @@ pub fn strip_element(pal: Palette, cx: &App) -> Option<AnyElement> {let cell = div().id(("tray-cell", j)).absolute()- .left(px(bx * k))- .top(px(by * k))- .w(px(bw * k))- .h(px(bh * k))+ .when(!vertical, |d| d.left(px(bx * k)).top(px(by * k)).w(px(bw * k)).h(px(bh * k)))+ .when(vertical, |d| d.top(px(bx * k)).left(px(by * k)).h(px(bw * k)).w(px(bh * k))).flex().items_center().justify_center()@@ -630,17 +635,15 @@ pub fn strip_element(pal: Palette, cx: &App) -> Option<AnyElement> {// (at the cell it goes before; after the last cell, at that cell's right edge)let [bx, by, bw, bh] = if drop_at < n { ts::cell_box(drop_at) } else { n.checked_sub(1).map(ts::cell_box).map_or([0.0, 0.0, 0.0, ts::CELL], |b| [b[0] + b[2], b[1], 0.0, b[3]]) };let _ = bw;- row = row.child(div().absolute().left(px(bx * k - 1.0)).top(px((by + 2.) * k)).w(px(2.)).h(px((bh - 4.) * k)).rounded_full().bg(ring));+ row = row.child(div().absolute().when(!vertical, |d| d.left(px(bx * k - 1.0)).top(px((by + 2.) * k)).w(px(2.)).h(px((bh - 4.) * k))).when(vertical, |d| d.top(px(bx * k - 1.0)).left(px((by + 2.) * k)).h(px(2.)).w(px((bh - 4.) * k))).rounded_full().bg(ring));}let chevron_hot = (dragging.is_none() && st.hover == Some(Source::Chevron)) || target == Some(DropTarget::Chevron);let chevron_cursor = st.kb.as_ref().is_some_and(|k| k.cursor == n);let chevron = div().id("tray-chevron").absolute()- .left(px(ts::chevron_x(n) * k))- .top(px((ts::strip_h() - ts::CELL) / 2.0 * k))- .w(px(ts::CHEVRON_W * k))- .h(px(ts::CELL * k))+ .when(!vertical, |d| d.left(px(ts::chevron_x(n) * k)).top(px((ts::strip_h() - ts::CELL) / 2.0 * k)).w(px(ts::CHEVRON_W * k)).h(px(ts::CELL * k)))+ .when(vertical, |d| d.top(px(ts::chevron_x(n) * k)).left(px((ts::strip_h() - ts::CELL) / 2.0 * k)).h(px(ts::CHEVRON_W * k)).w(px(ts::CELL * k))).flex().items_center().justify_center()@@ -655,11 +658,11 @@ pub fn strip_element(pal: Palette, cx: &App) -> Option<AnyElement> {Some(div().flex()- .flex_row()+ .when(!vertical, |d| d.flex_row()).when(vertical, |d| d.flex_col()).items_center().flex_shrink_0().child(row)- .child(div().mx(px(ts::SEP_GAP * k)).w(px(ts::SEP_W * k)).h(px(super::plan::RIGHT_SEP_HEIGHT * k)).bg(pal.separator().hsla()))+ .child(div().when(!vertical, |d| d.mx(px(ts::SEP_GAP * k)).w(px(ts::SEP_W * k)).h(px(super::plan::RIGHT_SEP_HEIGHT * k))).when(vertical, |d| d.my(px(ts::SEP_GAP * k)).h(px(ts::SEP_W * k)).w(px(super::plan::RIGHT_SEP_HEIGHT * k))).bg(pal.separator().hsla())).into_any_element(),)}@@ -918,6 +921,13 @@ fn sync_tip_block(cx: &mut App) {fn drop_target_at(cursor: (i32, i32), cx: &App) -> Option<DropTarget> {let st = cx.try_global::<TrayState>()?;let (glass, unit) = glass_and_unit(cx)?;+ let edge = host::dock_edge(cx);+ if edge == rf_win::dock::layout::DockEdge::Right {+ if overflow_rect(cx).is_some_and(|r| r.contains(cursor.0, cursor.1)) {+ return Some(ts::drop_target(&Geometry { glass: Rect::new(0, 0, 0, 0), scale: unit, visible: st.lay.visible.len(), chevron: false, overflow: overflow_rect(cx) }, cursor));+ }+ return Some(ts::drop_target(&Geometry { glass: rf_win::dock::layout::edge_axes(glass, edge), scale: unit, visible: st.lay.visible.len(), chevron: st.lay.chevron, overflow: None }, (cursor.1, cursor.0)));+ }Some(ts::drop_target(&Geometry { glass, scale: unit, visible: st.lay.visible.len(), chevron: st.lay.chevron, overflow: overflow_rect(cx) }, cursor))}diff --git a/crates/rf-app/src/dock_page.rs b/crates/rf-app/src/dock_page.rsindex 55e3452a..051ba273 100644--- a/crates/rf-app/src/dock_page.rs+++ b/crates/rf-app/src/dock_page.rs@@ -175,6 +175,16 @@ pub(crate) fn entries() -> Vec<Entry> {Some(t!("Büyütülmüş pencereler dock'un üstünde durur. Kapalıyken dock yalnızca pencerelerin üstünde yüzer.")),Control::Switch(|s| s.dock_reserve, |s, v| s.dock_reserve = v),),+ e(+ "dock-position",+ "dock_position",+ General,+ dock,+ L::PanelRight,+ t!("Dock sag kenarda"),+ Some(t!("Dock'u ekranin sag kenarina tasi. Kapaliyken alt kenarda kalir.")),+ Control::Switch(|s| s.dock_position == crate::settings::DockPosition::Right, |s, v| s.dock_position = if v { crate::settings::DockPosition::Right } else { crate::settings::DockPosition::Bottom }),+ ),e("dock-size","dock_size",@@ -882,7 +892,7 @@ mod tests {assert_eq!(secs, Section::ALL.to_vec(), "an empty section would be a heading with nothing under it");// the sections hold what the page promiseslet ids = |sec: Section| g.iter().find(|(s, _)| *s == sec).map(|(_, v)| v.iter().map(|e| e.field).collect::<Vec<_>>()).unwrap();- assert_eq!(ids(Section::General), ["dock_enabled", "dock_reserve", "dock_size", "dock_side_tall", "dock_autohide", "dock_autohide_windows", "dock_opaque", "dock_adaptive_tone", "dock_performance", "dock_show_desktop", "dock_tray_compact", "dock_pins_left", "dock_labels", "dock_tray_two_rows", "dock_all_monitors", "dock_magnify", "dock_lively", "dock_lock_icons", "dock_corner_radius", "dock_preview_size", "dock_scroll_volume", "dock_start_grow"]);+ assert_eq!(ids(Section::General), ["dock_enabled", "dock_reserve", "dock_position", "dock_size", "dock_side_tall", "dock_autohide", "dock_autohide_windows", "dock_opaque", "dock_adaptive_tone", "dock_performance", "dock_show_desktop", "dock_tray_compact", "dock_pins_left", "dock_labels", "dock_tray_two_rows", "dock_all_monitors", "dock_magnify", "dock_lively", "dock_lock_icons", "dock_corner_radius", "dock_preview_size", "dock_scroll_volume", "dock_start_grow"]);assert_eq!(ids(Section::Left), ["dock_own_start", "dock_start_recommended", "dock_search", "dock_search_hypersearch", "dock_weather_city"]);assert_eq!(ids(Section::Middle), ["dock_hover_previews", "dock_app_menu", "dock_thin_when_maximized", "dock_apps_where", "dock_hide_places", "dock_running_divider", "dock_ignored_apps"]);assert_eq!(ids(Section::Right), ["dock_own_control_centre", "dock_own_calendar", "dock_own_notifications", "dock_clock_seconds"]);diff --git a/crates/rf-app/src/i18n_en.rs b/crates/rf-app/src/i18n_en.rsindex 947f8254..16ab9ba9 100644--- a/crates/rf-app/src/i18n_en.rs+++ b/crates/rf-app/src/i18n_en.rs@@ -2059,6 +2059,8 @@ pub const EN: &[(&str, &str)] = &[("Genişlet", "Expand"),("Küçült", "Collapse"),("Dock boyutu", "Dock size"),+ ("Dock sag kenarda", "Dock on the right edge"),+ ("Dock'u ekranin sag kenarina tasi. Kapaliyken alt kenarda kalir.", "Move the dock to the right edge. When off, it stays at the bottom."),("Dock'un tamamı seçtiğiniz boyuta göre büyür ya da küçülür: adalar, simgeler, arama alanı, saat, tepsi simgeleri ve aralıklar. Orta, Dock'un her zamanki boyutudur. Değişiklik çalışan Dock'a hemen uygulanır.", "The whole dock grows or shrinks to the size you choose: the islands, the icons, the search field, the clock, the tray icons and the gaps. Medium is the dock's usual size. A change is applied to the running dock at once."),("Orta boyut", "Medium"),("Çok büyük", "Extra large"),diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rsindex 3ae8e240..1dd70a77 100644--- a/crates/rf-app/src/settings.rs+++ b/crates/rf-app/src/settings.rs@@ -1063,8 +1063,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,+ /// Place the dock on the bottom or right edge.+ pub 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 positiondiff --git a/crates/rf-app/src/shell/live.rs b/crates/rf-app/src/shell/live.rsindex 88c92e44..24bd7e10 100644--- a/crates/rf-app/src/shell/live.rs+++ b/crates/rf-app/src/shell/live.rs@@ -271,6 +271,7 @@ fn sync_work_area(cx: &App) {}let home = super::taskbar_hide::current_band().unwrap_or_else(|| band_thickness(cx));let others = super::taskbar_hide::other_bands();+ let edge = crate::dock::host::dock_edge(cx);let spawned = std::thread::Builder::new().name("rf-workarea-sync".into()).spawn(move || {let mut g = WORK.lock().unwrap_or_else(|p| p.into_inner());// (the monitors are looked at with the lock held: a thread that looked before waiting for the one ahead of it had the work@@ -308,7 +309,8 @@ fn sync_work_area(cx: &App) {// The bands are told to the docks' placement BEFORE the work areas shrink, so that the islands are not worked out from the// shrunken area (they float inside the band): the home dock's as its own band, the others' by the flag the host reads.if let Some(w) = plan.iter().find(|w| w.primary) {- rf_win::dock::system::set_own_band(Some(Rect { top: w.monitor.bottom - w.band.max(1), ..w.monitor }));+ let m = rf_win::dock::layout::edge_axes(w.monitor, edge);+ rf_win::dock::system::set_own_band(Some(rf_win::dock::layout::edge_axes(Rect { top: m.bottom - w.band.max(1), ..m }, edge)));}HOLDS.store(!plan.is_empty(), Ordering::Relaxed);for w in &plan {@@ -316,7 +318,7 @@ fn sync_work_area(cx: &App) {g.push((w.name.clone(), WorkAreaKeeper::new()));}let Some((_, k)) = g.iter_mut().find(|(n, _)| *n == w.name) else { continue };- match k.apply(&SystemShell, &mut SystemSetter, Some(w.band), w.monitor, w.work) {+ match k.apply_on(&SystemShell, &mut SystemSetter, Some(w.band), w.monitor, w.work, edge) {Done::Nothing => {}done => log::info!("work area of {}: {done:?}", w.name),}diff --git a/crates/rf-app/src/shell/taskbar_hide.rs b/crates/rf-app/src/shell/taskbar_hide.rsindex a323c7da..ef616db1 100644--- a/crates/rf-app/src/shell/taskbar_hide.rs+++ b/crates/rf-app/src/shell/taskbar_hide.rs@@ -33,6 +33,7 @@ use crate::settings::Settings;/// The dock's band as the dock last said it (`None` inside: it reserves none). `None` outside: the dock has not said yet.static BAND: Mutex<Option<Option<i32>>> = Mutex::new(None);+static EDGE: Mutex<rf_win::dock::layout::DockEdge> = Mutex::new(rf_win::dock::layout::DockEdge::Bottom);/// Remembers the dock's band; true when it is not what was remembered before.fn note_band(band: Option<i32>) -> bool {@@ -57,10 +58,15 @@ pub(super) fn other_bands() -> Vec<(String, i32)> {/// The dock reserves `band` px at the bottom of the primary monitor (device px), or none (`None`: `dock_reserve` is off). Costs a lock/// and a comparison when nothing changed and nothing is running; with the hide in force the work area follows.pub fn band_changed(band: Option<i32>, cx: &App) {- if note_band(band)- && let Some(h) = cx.try_global::<Hiding>()- {- h.hider.set_band(band);+ let edge = crate::dock::host::dock_edge(cx);+ let changed = {+ let mut last = EDGE.lock().unwrap_or_else(|p| p.into_inner());+ let changed = *last != edge;+ *last = edge;+ changed+ };+ if (note_band(band) || changed) && let Some(h) = cx.try_global::<Hiding>() {+ h.hider.set_band_on(band, edge);}}@@ -155,7 +161,7 @@ fn stale_check() {}log::warn!("taskbar hiding: the setting is off but an earlier run left a record of hidden windows; undoing it");let cfg = Config { state_dir: dir, guard_exe: taskbar_hide::guard_next_to_exe(), band_px: None, band_known: false };- match TaskbarHider::start(cfg) {+ match TaskbarHider::start_on(cfg, crate::dock::host::dock_edge(cx)) {Ok(hider) => hider.finish(Duration::from_secs(10)),Err(e) => log::warn!("taskbar hiding: the earlier run's record could not be undone: {e}"),}@@ -179,7 +185,7 @@ fn start(cx: &mut App) {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) {+ match TaskbarHider::start_on(cfg, crate::dock::host::dock_edge(cx)) {Ok(hider) => {hider.set_wanted(true);let others = OTHER_BANDS.lock().unwrap_or_else(|p| p.into_inner()).clone();diff --git a/crates/rf-win/src/dock/preview.rs b/crates/rf-win/src/dock/preview.rsindex 6b78bd95..407ea146 100644--- a/crates/rf-win/src/dock/preview.rs+++ b/crates/rf-win/src/dock/preview.rs@@ -224,6 +224,15 @@ pub fn above_icon(icon_center: i32, glass_top: i32, size: (f32, f32), scale: f32Rect::from_xywh(left, top, w, h)}+/// Place an upright pop-up inward from a vertical dock, centred on its icon.+pub fn beside_icon(icon_center: i32, glass_left: i32, size: (f32, f32), scale: f32, dock: f32, work: Rect) -> Rect {+ let right = (glass_left - px(icon_gap(dock), scale)).min(work.right).max(work.left + 1);+ let w = px(size.0, scale).clamp(1, right - work.left);+ let h = px(size.1, scale).clamp(1, work.height().max(1));+ let top = (icon_center - h / 2).clamp(work.top, (work.bottom - h).max(work.top));+ Rect::from_xywh(right - w, top, w, h)+}+/// The room above the dock's glass for a pop-up, logical px (what [`above_icon`] shortens a tall pop-up to).pub fn room_above(glass_top: i32, scale: f32, dock: f32, work: Rect) -> f32 {let room = (glass_top - px(icon_gap(dock), scale) - work.top).max(1);diff --git a/crates/rf-win/src/dock/zoomwatch.rs b/crates/rf-win/src/dock/zoomwatch.rsindex e2658760..0d59ebea 100644--- a/crates/rf-win/src/dock/zoomwatch.rs+++ b/crates/rf-win/src/dock/zoomwatch.rs@@ -308,6 +308,10 @@ pub fn maximized_on(monitor: isize) -> bool {/// (`thin::docked_under`: snapped to a half or a lower quarter). The same walk; a window that is not maximised costs one more style/// test, and its rectangle is read only when it is visible and not a child.pub fn stands_on_band(monitor: isize, glass: Option<Rect>) -> bool {+ stands_on_edge(monitor, glass, super::layout::DockEdge::Bottom)+}++pub fn stands_on_edge(monitor: isize, glass: Option<Rect>, position: super::layout::DockEdge) -> bool {use windows::Win32::Graphics::Gdi::{GetMonitorInfoW, HMONITOR, MONITORINFO};use windows::Win32::UI::WindowsAndMessaging::EnumWindows;use windows::core::BOOL;@@ -324,7 +328,7 @@ pub fn stands_on_band(monitor: isize, glass: Option<Rect>) -> bool {// the edge a docked window stands on: the monitor's work area as it is nowlet edge = glass.and_then(|glass| {let mut mi = MONITORINFO { cbSize: size_of::<MONITORINFO>() as u32, ..Default::default() };- unsafe { GetMonitorInfoW(HMONITOR(monitor as *mut _), &mut mi) }.as_bool().then_some(Edge { work_bottom: mi.rcWork.bottom, glass })+ unsafe { GetMonitorInfoW(HMONITOR(monitor as *mut _), &mut mi) }.as_bool().then_some(Edge { work_bottom: if position == super::layout::DockEdge::Right { mi.rcWork.right } else { mi.rcWork.bottom }, glass: super::layout::edge_axes(glass, position), position })});let mut walk = Walk { monitor, pid: std::process::id(), edge, found: false };unsafe {@@ -338,6 +342,7 @@ pub fn stands_on_band(monitor: isize, glass: Option<Rect>) -> bool {struct Edge {work_bottom: i32,glass: Rect,+ position: super::layout::DockEdge,}struct Walk {@@ -360,15 +365,17 @@ fn is_docked(h: HWND, style: u32, edge: Option<Edge>) -> bool {return false;}let mut r = RECT::default();- if unsafe { GetWindowRect(h, &mut r) }.is_err() || r.bottom < edge.work_bottom - super::thin::DOCK_ABOVE {+ if unsafe { GetWindowRect(h, &mut r) }.is_err() {return false;}+ let rect = super::layout::edge_axes(Rect::new(r.left, r.top, r.right, r.bottom), edge.position);+ if rect.bottom < edge.work_bottom - super::thin::DOCK_ABOVE { return false; }// (the invisible frame under the edge is as thick as the window's own scale makes it)let scale = match unsafe { GetDpiForWindow(h) } {0 => 1.0,dpi => dpi as f32 / 96.0,};- super::thin::docked_under(Rect::new(r.left, r.top, r.right, r.bottom), edge.work_bottom, edge.glass, super::thin::dock_below_px(scale))+ super::thin::docked_under(rect, edge.work_bottom, edge.glass, super::thin::dock_below_px(scale))}/// Where the pointer is (device px) and whether a mouse button is held. Two system calls, no allocation: the thin dock asks every 60 ms