Skip to main content

Module video

Module video 

Source
Expand description

“Pause during fullscreen video” detection.

Each platform’s check() combines two signals:

  1. Display-wake assertionpmset / powercfg / systemd-inhibit tell 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.
  2. 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§

WindowKnowledge 🔒
Whether the platform can answer “is a fullscreen window present?”. Linux Wayland uses Unknowable; everywhere else passes a concrete Fullscreen(bool). Exists so the combining logic in pause_decision is 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 windows matches any monitor in monitors. 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 window covers monitor within FULLSCREEN_TOLERANCE_PX on every edge.
spawn_monitor