Skip to main content

Module tray_positioning

Module tray_positioning 

Source
Expand description

M-RECP.1 / AUT-262 — Multi-display window positioning under the tray click.

Pure-Rust helper that picks the right monitor for a given click position. The Tauri-side caller in main.rs invokes pick_monitor inside the on_tray_icon_event handler before showing the main window. OS hardware integration (querying real monitor bounds, applying the clamp) is the deferred follow-up.

Structs§

MonitorBounds
Axis-aligned rectangle in screen coordinates. Same shape as Tauri’s tauri::PhysicalRect but lives here as a Copy-friendly pure-Rust struct so the picker is unit-testable without a Tauri runtime.

Functions§

pick_monitor
Find the monitor whose bounds contain the click position. Returns the first monitor as a fallback if no bounds contain the click (defensive — shouldn’t normally happen with valid monitor geometry, but multi-display setups can have negative coords).
position_window_top_right
Top-left position that anchors the popover’s top-right corner to the monitor’s top-right corner — flush against the screen edge, matching the macOS Control-Center / Notification-Center convention. The click position is only used by the caller to pick which monitor to anchor on; within that monitor the popover always lands top-right.