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 assertion — pmset / 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.
parse_active_window_id 🔒
Linux xprop -root _NET_ACTIVE_WINDOW: extract the 0x… window id, rejecting the 0x0 “no active window” sentinel so we don’t chain a useless follow-up xprop call.
parse_display_request 🔒
Windows powercfg /requests: true if the DISPLAY: section lists any request other than None. (something is requesting the display stay on).
parse_display_sleep_blocked 🔒
macOS pmset -g assertions: true if PreventUserIdleDisplaySleep has a non-zero count (something is keeping the display awake).
parse_idle_inhibitor 🔒
Linux systemd-inhibit --list: true if any inhibitor’s WHAT column (colon-separated types) includes idle. System-managed inhibitors like handle-lid-switch / sleep don’t carry the idle component.
parse_net_wm_state_fullscreen 🔒
Linux xprop -id <id> _NET_WM_STATE: true iff _NET_WM_STATE_FULLSCREEN is present. Crucially _NET_WM_STATE_MAXIMIZED_* must NOT match — a maximised window with the taskbar visible is the case we exclude.
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