Expand description
“Pause during fullscreen video” detection.
Each platform’s check() combines two signals:
- Display-wake assertion —
pmset/powercfg/systemd-inhibittell us whether anything on the system is asking the display to stay awake. Most video players (browser HTML5, VLC, video calls) set this, but so do tiny background-tab videos. On its own it’s a false-positive magnet. - Fullscreen window present — at least one on-screen, normal application window has bounds matching one of the connected monitors. This narrows (1) to the “I’m actually committed to watching this” case, which is what the user-facing setting “Pause during fullscreen video” actually promises.
Combined: active = assertion && fullscreen_window_present. The
assertion check is the fast path — we skip the window enumeration
when nothing is keeping the display awake.
Wayland is a known degraded case: there is no portable way to
enumerate windows from outside the compositor, so we treat the
fullscreen check as always-true and fall back to assertion-only
behaviour. A one-time log::info! at startup records the
degradation.
Modules§
- linux 🔒
Structs§
- Rect 🔒
- Plain rectangle used by the bounds-comparison helpers below. Decoupled from any platform type so the matching logic is pure and testable.
Enums§
- Window
Knowledge 🔒 - Whether the platform can answer “is a fullscreen window present?”.
Linux Wayland uses
Unknowable; everywhere else passes a concreteFullscreen(bool). Exists so the combining logic inpause_decisionis one pure function with one truth-table test, instead of three near-identical chains duplicated per platform.
Constants§
- FULLSCREEN_
TOLERANCE_ 🔒PX - Pixel tolerance when comparing window bounds to monitor bounds. Native fullscreen on macOS/Windows is exact, but X11 reparenting window managers (i3, openbox) sometimes leave a 1–2px border. Keep this small — a 5px tolerance would catch maximised-but-not-fullscreen windows on some setups.
- POLL_
INTERVAL 🔒
Functions§
- any_
window_ 🔒is_ fullscreen - True if any window in
windowsmatches any monitor inmonitors. This is the platform-independent core of the fullscreen check. - pause_
decision 🔒 - Should breaks pause right now, given the two signals?
- rect_
matches 🔒 - True if
windowcoversmonitorwithinFULLSCREEN_TOLERANCE_PXon every edge. - spawn_
monitor