Tear down a break whose overlay never reported rendering — the #196/#226
watchdog firing, or the shown == 0 no-overlay case. Mirrors the cleanup
half of end_break (clear the current break, resume any paused media, hide
every overlay window, emit break:end) but records no stats: an
invisible break was never taken or dismissed. Scheduler-free so the
watchdog task can run it from cloned Arcs without holding &Scheduler.
Monitor index to cover for the Active placement: whichever monitor
holds the cursor, else the reported primary, else the first available.
Pure so the fallback chain is unit-testable. Returns an empty list only
when there are no monitors at all.
Shrink monitor to fraction of its size and centre it inside
the original. fraction is clamped to [0.1, 1.0]. Used to size
the BreakDelivery::Windowed overlay so the desktop stays
clickable around it.
Surface a break through whichever channel the active settings ask
for: a system notification or the overlay (full-screen or windowed).
Notification delivery short-circuits the overlay path entirely.
Stash the break event in current_break, position an overlay window
on each selected monitor, and emit break:start to the renderer. Used
directly for sleep/resume-last paths; normal scheduled breaks go
through deliver_break instead.
Human-friendly break duration for notifications (e.g. "20 seconds",
"5 minutes", "1m 30s"). Drops the seconds part when the
duration is a whole-minute multiple.
Hide every break overlay window. Shared by the break-teardown paths
(end_break, postpone_break, and the render watchdog) so the
"overlay-" label convention lives in exactly one place.
Whether this is a Wayland session. Used to decide if the overlay
geometry needs the HiDPI scale correction below (#67). Mirrors the
probe in video.rs; kept local so the overlay path stays
self-contained.
Locate needle in rects by identity-ish geometry match on position
and size. available_monitors and primary_monitor return independent
Monitor values, so the only stable cross-reference is their reported
rect. Pure so the lookup is unit-testable.
Index of the monitor that contains (cursor_x, cursor_y), or
None if the cursor sits outside every rect. Used by
MonitorPlacement::Active to decide which display the overlay
should pop on.
Post a desktop notification. Split on cfg(test) so the OS-posting body
is compiled out of the test/coverage build: the scheduler’s delivery
tests drive the routing glue end to end, and without this a real
tauri_plugin_notification would post an actual macOS notification on
every cargo test run — attributed to the terminal, since a test binary
is not an app bundle. The routing the tests assert runs before this call,
so no meaningful coverage is lost.
Monitor indices to cover for the Primary placement. When the
windowing system names a primary monitor we cover exactly it. When it
can’t (Wayland has no “primary” concept) we cover every monitor
instead of just the first: “the primary screen” is meaningless there,
and leaving the other monitors uncovered lets the user dodge an
enforceable break by glancing at the next screen (#67, Steffi’s
dual-monitor setup). Pure so the fallback is unit-testable without a
windowing system.
Correct a monitor’s reported geometry for the GNOME/Wayland HiDPI
quirk where tao returns monitor.size() and position() already
multiplied by the scale factor. Feeding those straight into
set_size/set_position (which divide by the window’s scale factor
again) builds an overlay scale× too large in each axis — it spills
onto the neighbouring monitor and pushes the hint and Skip controls
off the bottom of the screen (#67, Steffi’s 2×4K @ 200% report). On
Wayland with a >1 scale we divide back out to the true physical
geometry; on X11 and macOS monitor.size() is already true physical,
so it’s a no-op. Pure so the correction is unit-testable without a
windowing system.